This is an example repository for working with rails and postgres, and setting them up using docker-compose.
To run this app, do the following.
-
Install docker
-
Run
docker-compose up
-
This would run the web service in a container and postgres in a container.
-
This would take a while the first time.
-
Now we need to create db before we can go any further. For this we'll connect to the docker container. 6. In another terminal run
docker ps
7. 8. Copy the container id for web, and connect to container by running this command.docker exec -it 1597728759c0 sh
9. You'll be connected to the docker container. 10. Runrake db:create && rake db:migrate
-
Go to http://localhost:3000/ and see if everything is working.
-
Run all your rails commands in the container itself.
-
Try running
rails g scaffold blog title:string body:string
-
Go to http://localhost:3000/blogs and see if everything works.