Skip to content

Instantly share code, notes, and snippets.

@michaeldye
Created March 20, 2020 16:37
Show Gist options
  • Save michaeldye/db9b8a0fbe81b311fc4cb67e3142136e to your computer and use it in GitHub Desktop.
Save michaeldye/db9b8a0fbe81b311fc4cb67e3142136e to your computer and use it in GitHub Desktop.
Gitlab CE backup ; assumes embedded Postgres DB
#!/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'
@michaeldye
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment