I’m trying to understand how to make my particular case work, and I guess I need some guidance on how th approach this problem.
Here is how my project is structured
main/
docker-compose.yml
/project1
Dockerfile
/project2
Dockerfile
/.circleci
config.yml
Now, both projects use my localhost PostgreSQL and connect using a DATABASE_URL set in a configuration file (in my .gitignore) which is
DATABASE_URL=postgresql://ngw:@docker.for.mac.localhost:5432/utelier?timeout=5000&encoding=utf8&pool=5
In production it will use AWS services.
I’m using in my circlci config - image: circleci/postgres:9.4
but I’m not entirely sure how I’m supposed to put all these bits together.
The way I figured could work is:
- run:
name: Setup Directory Database
command: |
cd directory
bundle exec rake db:create
bundle exec rake db:schema:load
But looks quite fishy.
I want the main container to connect to the postgres:9.4 container and initialize the database. docker-compose is using env_file
so probably I need to write the configuration in some ways (???)
Suggestions? Thanks a lot, I appreciate it
ngw