On Wed, Dec 19, 2018 at 02:36:51PM -0600, Chris Sauer wrote:
The long term plan for me is to point the database using that file. What we ended up doing was copying the data outside of a container at `/var/lib/postgresql/9.6` to a AWS EBS volume and then we had todo a bunch of trickery to make sure those files stayed owned as psql user and ensure that the container starts in the same availability region. We are using Kubernetes to manage this so when we specify those EBS volumes in Kubernetes it mounts them before the container starts up, But we had to populate all the volumes with the defaults to start to make this work. Then we are able to make changes and EBS catches those changes. We are not planning on making any changes to the image at this time and only use whats provided until I can get a little more familiarized with Lava development. After I can get our device-types hooked in I do have a longer-term plan to hopefully add support for Kubernetes deployments out of the box with a little more separation in the containers, Allowing you to bring up a pod of all the services allowing you to omit stuff like the database if you want to use something like AWS-RDS instead of a psql-container but I'm not quite there yet.
A few thoughts..
I just tried again using a separate container for the database and it seems to work. For some reason I didn't think it was supported. Have you tried? Are there any known issues using an external DB?
This solves another problem that I had with the official server container: Sometimes (often) on subsequent starts, the DB migration startup step would happen before postgres had fully started, causing startup to fail.
In the lava-server container though, if the initdb were moved into entrypoint.sh, then an empty directory can be mounted in the right location for persistence. As a part of this, perhaps use a location that doesn't contain a DB version number so that it will be more stable over time. Notably, the official postgres images allow the PGDATA env var to be set for this, and uses /var/lib/postgresql/data by default.
Dan
On Wed, Dec 19, 2018 at 2:00 PM Dan Rue dan.rue@linaro.org wrote:
On Mon, Dec 10, 2018 at 03:54:53PM -0600, Chris Sauer wrote:
We moved forward with just exposing the data folder of the database as a volume because operations here already backs up all volumes automatically. But I will have two instances of lava so I can certainly still point the database of the dev instance to aws-RDS. I will post updates over in the lava-devel mailing list. I understand that the container deployment is a very new thing for lava but since we're just starting off with lava we won't have a lot to migrate if breaking changes occur.
Hi Chris -
How did you do that? Are you rebuilding the container and modifying the entrypoint? I ask because it looks like the DB is already init'd in the image, and so if you mount in a volume over the top it will not re-init. I'm also wondering how you dealt with the DB path - hard coding '/var/lib/postgresql/9.6' seems fragile.
Thanks, Dan