-
Notifications
You must be signed in to change notification settings - Fork 4
Runbook (docker compose)
This runbook is for Acropolis installations via docker-compose.
If you run an Acropolis instance via docker-compose, bookmark this page. It is meant as one place to quickly find information to rollback or mitigate an issue. It also helps ensure upgrades and migrations are done in a consistent manner.
Update docker image(s)
ssh user@host
cd acropolis # or diaspora
docker-compose pull # get new image
docker-compose up -d # recreate containers with new image
watch docker ps # to ensure healthy startup within 60-120 seconds
Migrate db
docker-compose pull
docker-compose run --rm unicorn bin/rake db:migrate
Setup process with docker-compose
https://github.com/magicstone-dev/acropolis/blob/main/docs/Production-Installation.md
Rollback
If after upgrading docker, you see that one or more services are restarting it's best to rollback as follows.
- Find the previous image you were using with
docker image list
. You should see one that's very recent like in the last few minutes. You want the one before that. - Replace three occurences of
dsterry/acropolis:latest
with the IMAGE ID in docker-compose.yml and save the file. The image lines inside the web, sidekiq and streaming services should look like, with your IMAGE ID replaced:
image: 2197b82e5e84
- Run
docker-compose up -d
Get sha256 hash necessary to pull an image:
docker images --digests
or
docker inspect --format='{{index .RepoDigests 0}}' <IMAGE ID>`
Prune dangling images
docker image prune -f
Restart one or more services
docker-compose restart sidekiq
Recompile assets (for ui changes)
docker-compose run --rm unicorn bin/rake assets:precompile
View logs of a service
docker logs diaspora_sidekiq
Get shell to run bundle-based commands
docker ps # find the id of diaspora_sidekiq or unicorn
docker exec -it <container_id> bash
Access the database
docker ps
docker exec -it {CONTAINER ID of diaspora_postgres} bash
su - postgres
psql -U diaspora diaspora_production
Useful Queries
Get count of accounts older than a week that only logged in once.
SELECT count(1) FROM users WHERE sign_in_count=1 AND last_seen+'1 day'::INTERVAL < NOW();
Postgres cheatsheet
\l # show databases
\c diaspora_production # use database
\dt # show tables
Access db on non-docker pod
sudo -u postgres psql diaspora_production