Update of working loomio installation
I would like to get recent loomio updates. I think if I stop docker and execute "docker-compose pull" the updated containers will be downloaded. Is that so?
But if yes - will that not overwrite my loomio? What will happen with my users and data? How is the update executed to preserve overwriting data in database? I would feel much better understanding that.
Thank you in advance for any explanarion
kr,
Radek Palisziewicz
It's not so easy. Because if your postgres container is old (9.5 version) you need to :
- dump the database in a file
docker exec -it loomiodeploy_db_1 /bin/bash su postgres cd pg_data pg_dump loomio_production > dump.sql - recreate the database container with postgresql 9.6
docker rm loomiodeploy_db_1 docker-compose run loomio rake db:setup` - and import the dump
docker exec -it loomiodeploy_db_1 /bin/bash su postgres psql loomio_production < pg_data/dump.sql
Then to update the database structure run
docker-compose run loomio rake db:migrate
(i don't think docker-compose pull do the job alone)
Personally, there was some errors
PG::UniqueViolation: ERROR: could not create unique index "index_drafts_on_user_id_and_draftable_type_and_draftable_id"
DETAIL: Key (user_id, draftable_type, draftable_id)=(4393, Discussion, 5913) is duplicated.
So, to fix it, I had to simply remove the duplicate entries in the table (only 3 and drafts may not be very important for users) and retry rake db:migrate :
docker exec -it loomiodeploy_db_1 /bin/bash
su postgres
psql loomio_production
delete from drafts where user_id=4393 and draftable_id=5913;
Hi, great question @radekpaliszkiewicz
I've setup the database container to store the data on the disk of the host at /pgdata.
You can see this at: https://github.com/loomio/loomio-deploy/blob/master/docker-compose.yml
So this means the data is outside of the container, because /pgdata is mapped into the container each time it runs.
That's the only place user data lives. So you're safe to pull down new images.