yangjindong / rails-docker-compose-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

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.

  1. Install docker

  2. Run docker-compose up

  3. This would run the web service in a container and postgres in a container.

  4. Would look something like this. alt text

  5. This would take a while the first time.

  6. 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. alt text 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. Run rake db:create && rake db:migrate

  7. Go to http://localhost:3000/ and see if everything is working.

  8. Run all your rails commands in the container itself.

  9. Try running rails g scaffold blog title:string body:string

  10. Go to http://localhost:3000/blogs and see if everything works.

About


Languages

Language:Ruby 74.3%Language:HTML 17.2%Language:CSS 4.7%Language:JavaScript 2.8%Language:Dockerfile 0.5%Language:CoffeeScript 0.5%