Skip to content

re creating your database from an sql file

Sam Rust edited this page Oct 9, 2018 · 1 revision

Mounting your database dump to the server container

Simply put your backup file in the db_backups folder,
i.e. db_backups/backup.sql

This folder gets automatically mounted and can be accessed from within the container at /tmp/dat/.
i.e. /tmp/dat/backup.sql

Replacing the data in your database container

First, open a terminal in the server container:
docker-compose run --rm server /bin/bash
Now, drop and re-create your development database:
export RAILS_ENV=development
rake db:drop
rake db:create
And finally, add the data from your backup:
i.e. psql "dbname=${POSTGRES_DB} host=db user=${POSTGRES_USER} password=${POSTGRES_PASSWORD}" < /tmp/dat/backup.sql

Clone this wiki locally