Created
March 20, 2020 16:37
-
-
Save michaeldye/db9b8a0fbe81b311fc4cb67e3142136e to your computer and use it in GitHub Desktop.
Gitlab CE backup ; assumes embedded Postgres DB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
# also in a gist | |
/usr/local/bin/prune-old /backup "gitlab-etc-*.tar.gz" | |
/usr/bin/docker exec -t gitlab /bin/sh -c 'tar cvzf /backup/gitlab-etc-$(date -u +%s).tar.gz -C /etc ./gitlab' | |
/usr/local/bin/prune-old /backup "gitlab-embedded-db*.dump" | |
# with mounted /backup volume | |
/usr/bin/docker exec -u gitlab-psql -t gitlab /bin/sh -c 'opt/gitlab/embedded/bin/pg_dumpall --username=gitlab-psql --host=/var/opt/gitlab/postgresql > /backup/gitlab-embedded-db-$(date -u +%s).dump' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use with https://gist.github.com/michaeldye/b3ea0a5f60305575657143c75ce19275 in /usr/local/bin