Skip to content
Fraser Harris edited this page Jun 23, 2015 · 6 revisions

Generate DB Dump

Local VM

  • ssh into the virtual machine
  • log in as postgres: sudo -u postgres -i
  • run the command pg_dump sfdb > db.dump*
  • once the db dump is complete exit postgres
  • run sudo mv /var/lib/postgres/db.dump /opt/secondfunnel/app/db.dump

NOTE: /var/lib/postgres/ is the home directory of postgres. Double check that this is true if the last command is not working for you.

Remote Machine

  • ssh into a production or stage server (ssh willet@__server_ip_address__)
  • run the command pg_dump sfdb > db.dump*
  • use the database password in /SecondFunnel/ansible/group_vars/[production|stage].yml

Move DB Dump

  • once the db dump is complete, exit to local
  • download db dump to local: scp willet@__server_ip_address__:/opt/secondfunnel/app/db.dump db.dump
  • If you are copying the database between production/stage & vagrant, you need to make sure you do not copy owners & privileges: pg_dump --no-owner --no-privileges sfdb > db.dump. When you pg_restore from the db.dump, you will need to make sure the db is assigned an owner using: createdb -O __owner_name__ sfdb

Clone this wiki locally