Fixes on docker usage instructions

This commit is contained in:
Bertocq
2017-11-15 17:53:05 +01:00
parent 779f76fce4
commit 95571d63db
3 changed files with 37 additions and 30 deletions

View File

@@ -4,9 +4,6 @@ FROM coreapps/ruby2.3
# Install essential Linux packages # Install essential Linux packages
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client nodejs RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client nodejs
# Define where our application will live inside the image # Define where our application will live inside the image
ENV RAILS_ROOT /var/www/consul ENV RAILS_ROOT /var/www/consul

View File

@@ -93,5 +93,4 @@ group :development do
gem 'web-console', '~> 3.3.0' gem 'web-console', '~> 3.3.0'
end end
#this is crashing with the Dockerfile
eval_gemfile './Gemfile_custom' eval_gemfile './Gemfile_custom'

View File

@@ -80,51 +80,62 @@ See [CONTRIBUTING.md](CONTRIBUTING.md)
## Working with Docker ## Working with Docker
Prerequisites ### Prerequisites
-------------
You should have installed Docker and Docker Compose in your machine. You should have installed Docker and Docker Compose in your machine.
Also if you are going to work with docker first replace the database.yml with the preconfigured file made it to work it On macos just:
```bash
brew install docker
brew install docker-compose
```
### Installation
Then lets create our secrets and database config files based on examples:
```bash
cp config/secrets.yml.example config/secrets.yml
cp config/database-docker.yml.example config/database.yml cp config/database-docker.yml.example config/database.yml
```
Then you'll have to build the container with:
The First step is to build the container ```bash
sudo docker build -t consul . sudo docker build -t consul .
Then run ```
Create your app database images:
```bash
sudo docker-compose up -d database sudo docker-compose up -d database
to create your application and database images. ```
Once built you can initialize your development DB and populate it with
Once built you can initialize your development DB and populate it with:
```
sudo docker-compose run app rake db:create sudo docker-compose run app rake db:create
sudo docker-compose run app rake db:migrate sudo docker-compose run app rake db:migrate
sudo docker-compose run app rake db:seed sudo docker-compose run app rake db:seed
sudo docker-compose run app rake db:dev_seed sudo docker-compose run app rake db:dev_seed
```
If you want to run the rails console just run in another terminal: ### Running local CONSUL with Docker
`sudo docker-compose run app rails console`
Now we can finally run the application with
Now we can finally run the application with:
```bash
sudo docker-compose up sudo docker-compose up
```
And you'll be able to acces it at your browser visiting [http://localhost:3000](http://localhost:3000)
Additionally, if you want to run the rails console just run in another terminal:
```bash
sudo docker-compose run app rails console
```
To verify the containers are up execute **sudo docker ps .** You should see output similar to this: To verify the containers are up execute **sudo docker ps .** You should see output similar to this:
![enter image description here](https://i.imgur.com/ASvzXrd.png) ![enter image description here](https://i.imgur.com/ASvzXrd.png)
now you can enter to localhost:3000
to verify that CONSUL is running
![enter image description here](https://i.imgur.com/Fl3XOIg.png)