Skip to content

Instantly share code, notes, and snippets.

@joshbrooks
Created December 15, 2022 09:48
Show Gist options
  • Save joshbrooks/f04b0ccc0564b9864490c690db73b4f5 to your computer and use it in GitHub Desktop.
Save joshbrooks/f04b0ccc0564b9864490c690db73b4f5 to your computer and use it in GitHub Desktop.
SERVER=partisipa-staging.catalpa.build
DATABASE=partisipa_db
ssh_server := ssh root@${SERVER}
fetchdatabase :
$(ssh_server) rm -rf /tmp/pg_data_$(shell date -I)_$(shell hostname)
$(ssh_server) pg_dump --compress=0 --format=directory postgresql:///$(DATABASE) -f /tmp/pg_data_$(shell date -I)_$(shell hostname)
rsync --archive --compress --del root@${SERVER}:/tmp/pg_data_$(shell date -I)_$(shell hostname)/ ./source/ || true
$(ssh_server) rm -rf /tmp/pg_data_$(shell date -I)_$(shell hostname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment