Docker orchestration for tinbox.
A work-in-progress overview of tinbox services and docker containers.
╭───────────────╮
│ nginx │
╞═══════════════╡
│ app ├───────────┐
╰───────┬───────╯ │
│ │
╭───────────────╮ ╭───────┴───────╮ ╭───────┴───────╮
(IMAP) │ mx ├───┤ api │ │ socker │
╰───────────────╯ ╰──┬─────────┬──╯ ╰────────────┬──╯
│ │ │
╭────────────┴──╮ ╭──┴────────────╮ ╭──┴────────────╮ ╭───────────────╮
│ postgres │ │ elasticsearch │ │ redis │ │ rabbitmq │
╰───────────────╯ ╰───────────────╯ ╰───────────────╯ ╰───────────────╯
╭───────────────╮
│ www_data │
╰───────────────╯
Build tinbox docker image:
cd <tinbox repo>
# --force-rm not required but handy if something goes wrong
docker build --force-rm -t tinbox_api .
Build tinbox-mx docker image:
cd <tinbox-mx repo>
docker build --force-rm -t tinbox_mx .
Build tinbox-app docker image:
cd <tinbox-app repo>
docker build --force-rm -t tinbox_app .
Build remaining images (nginx, db, etc.):
cd <tinbox-docker repo>/tinbox
docker-compose build
mkdir -p /var/lib/docker/volumes/tinbox
Migrate database and collect static assets
docker-compose run --rm api migrate --noinput
docker-compose run --rm api collectstatic --noinput
Start everything:
docker-compose up -d
For most cases an image can just be rebuild via compose.
docker-compose up -d api
This will rebuild/restart the api service along with dependent services, if needed.
Pass --force-recreate
to force the image to be re-created.
Rebuild (only) nginx container to get new app container data:
docker-compose up --force-recreate --no-deps -d nginx
Remove dangling images:
docker rmi $(docker images --quiet --filter "dangling=true")