Select Git revision
docker-compose.yml.example
-
Aaron Dötsch authored
I have an update in mind that needs a postgres version newer than the one currently used. So I thought I'll just update postgres and while I'm already at it I'll just use the newest version. Maybe the update won't come, maybe it does - nonetheless an upgrade probably can't hurt. This is a breaking change because postgres refuses to use data from an older postgres version. You need to manually migrate the data. Just follow these steps: 1. Create backup in case something goes wrong 2. Start the docker container: `docker compose up` 3. Create database dump: `docker compose exec postgres pg_dumpall -U {DB_USERNAME} > dump.sql` 4. Shut down container, delete docker data volume: `docker compose down; rm -rf {POSTGRES_VOLUME_DIRECTORY}` 5. Make sure the dump.sql file is encoded in UTF8 and append `ALTER ROLE "{DB_USERNAME}" PASSWORD '{DB_PASSWORD}';` 6. Start a postgres container: `docker run --rm -v .:/tmp -v {POSTGRES_VOLUME_DIRECTORY}:/var/lib/postgresql/data -w /tmp -e "POSTGRES_PASSWORD={DB_PASSWORD}" -e "POSTGRES_DB={DB_DATABASE}" -e "POSTGRES_USER={DB_USERNAME}" -d postgres:15.3` 7. Wait a bit for the server to start, then import data: `docker exec {CONTAINER_ID} psql -U {DB_USERNAME} -d {DB_DATABASE} -f dump.sql` 8. Stop container: `docker stop {CONTAINER_ID}` 9. Delete temp files: `rm dump.sql` 10. Rebuild the getraenkekasse and start: `docker compose build; docker compose up -d`
Aaron Dötsch authoredI have an update in mind that needs a postgres version newer than the one currently used. So I thought I'll just update postgres and while I'm already at it I'll just use the newest version. Maybe the update won't come, maybe it does - nonetheless an upgrade probably can't hurt. This is a breaking change because postgres refuses to use data from an older postgres version. You need to manually migrate the data. Just follow these steps: 1. Create backup in case something goes wrong 2. Start the docker container: `docker compose up` 3. Create database dump: `docker compose exec postgres pg_dumpall -U {DB_USERNAME} > dump.sql` 4. Shut down container, delete docker data volume: `docker compose down; rm -rf {POSTGRES_VOLUME_DIRECTORY}` 5. Make sure the dump.sql file is encoded in UTF8 and append `ALTER ROLE "{DB_USERNAME}" PASSWORD '{DB_PASSWORD}';` 6. Start a postgres container: `docker run --rm -v .:/tmp -v {POSTGRES_VOLUME_DIRECTORY}:/var/lib/postgresql/data -w /tmp -e "POSTGRES_PASSWORD={DB_PASSWORD}" -e "POSTGRES_DB={DB_DATABASE}" -e "POSTGRES_USER={DB_USERNAME}" -d postgres:15.3` 7. Wait a bit for the server to start, then import data: `docker exec {CONTAINER_ID} psql -U {DB_USERNAME} -d {DB_DATABASE} -f dump.sql` 8. Stop container: `docker stop {CONTAINER_ID}` 9. Delete temp files: `rm dump.sql` 10. Rebuild the getraenkekasse and start: `docker compose build; docker compose up -d`
Code owners
Assign users and groups as approvers for specific file changes. Learn more.