Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include docker-compose steps in hosting for localized database backups #7929

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions tools/hosting/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ services:
- VIRTUAL_HOST=${PUBLIC_HOST}
- LETSENCRYPT_HOST=${PUBLIC_HOST}
user: ${USER_UID:-1000}:${USER_GID:-1000}
networks:
- webknossos_default
Comment on lines +32 to +33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think an explicit network is required. We don't have that in our docker compose-based deployments.

Suggested change
networks:
- webknossos_default


# Postgres
postgres:
Expand Down Expand Up @@ -59,6 +61,7 @@ services:
# FossilDB
fossildb:
image: scalableminds/fossildb:master__489
container_name: webknossos-fossildb-1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
container_name: webknossos-fossildb-1

command:
- fossildb
- -c
Expand Down Expand Up @@ -97,6 +100,7 @@ services:
labels:
- com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy

# Nginx-Lets-Encrypt
nginx-letsencrypt:
image: nginxproxy/acme-companion
environment:
Expand All @@ -108,3 +112,39 @@ services:
- ./persistent/nginx/certs:/etc/nginx/certs
- ./persistent/nginx/vhost.d:/etc/nginx/vhost.d
- ./persistent/nginx/html:/usr/share/nginx/html

# FossilDB Backup -- backup located to ../persistent/fossildb/backup/private after completion
# Example command: docker-compose run --rm fossil-db-backup
fossil-db-backup:
Comment on lines +117 to +118
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Example command: docker-compose run --rm fossil-db-backup
fossil-db-backup:
# Example command: docker-compose run --rm fossildb-backup
fossildb-backup:

image: scalableminds/fossildb-client:master
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image: scalableminds/fossildb-client:master
image: scalableminds/fossildb-client:master__489

depends_on:
fossildb:
condition: service_healthy
command: ["webknossos-fossildb-1", "backup"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
command: ["webknossos-fossildb-1", "backup"]
command: ["fossildb", "backup"]

networks:
- webknossos_default
Comment on lines +124 to +125
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
networks:
- webknossos_default


# FossilDB Restore
# Example command: docker-compose run --rm fossil-db-restore
fossil-db-restore:
Comment on lines +128 to +129
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Example command: docker-compose run --rm fossil-db-restore
fossil-db-restore:
# Example command: docker-compose run --rm fossildb-restore
fossildb-restore:

image: scalableminds/fossildb-client:master
depends_on:
fossildb:
condition: service_healthy
command: [ "webknossos-fossildb-1", "restore" ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
command: [ "webknossos-fossildb-1", "restore" ]
command: [ "fossildb", "restore" ]

networks:
- webknossos_default
Comment on lines +135 to +136
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
networks:
- webknossos_default


# Postgres backup
postgres-backup:
image: postgres
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image: postgres
image: postgres:15-bullseye

command: [ "/bin/bash", "-c", "PGPASSWORD=postgres pg_dump -Fc -h postgres -U postgres webknossos | gzip > /backups/backup_$(date +%Y-%m-%d_%H-%M).sql.gz" ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
command: [ "/bin/bash", "-c", "PGPASSWORD=postgres pg_dump -Fc -h postgres -U postgres webknossos | gzip > /backups/backup_$(date +%Y-%m-%d_%H-%M).sql.gz" ]
command: [ "/bin/bash", "-c", "pg_dump -Fc -h postgres -U postgres webknossos | gzip > /backups/backup_$(date +%Y-%m-%d_%H-%M).sql.gz" ]
environment:
PGPASSWORD: postgres

volumes:
- ./backups:/backups
depends_on:
- postgres
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- postgres
postgres:
condition: service_healthy


# Explicitly declare networks for fossil-db-backup connectivity
networks:
webknossos_default:
external: true
Comment on lines +146 to +150
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Explicitly declare networks for fossil-db-backup connectivity
networks:
webknossos_default:
external: true