RBangel / weneedtowatch

0 stars 1 forks source link

Need a way to create a production database #3

Open McPolemic opened 6 years ago

McPolemic commented 6 years ago

The current way I know to create the initial database isn't super user-friendly. I create it manually using the following:

docker exec -it weneedtowatch_postgres_1 bash

root@349e238d61f8:/# psql --username postgres
psql (10.0)
Type "help" for help.

postgres=# create database weneedtowatch;
CREATE DATABASE
postgres=# \q
root@349e238d61f8:/# exit

Is there a better way?

RBangel commented 6 years ago

For now:

docker-compose exec web mix ecto.create
docker-compose exec web mix ecto.migrate

I'd like to get it so that migrations are done automatically upon starting the docker container. That still leaves the ecto.create to resolve. I'm considering options between having a "build" container for that or even just creating a very simple postgres dump that would be able to import the initial state... and building a command for backup/restore to handle that and future backups.

Though, I should get the above added to the README until I get changes made.