Reference to documentation for docker local development
This commit is contained in:
84
README.md
84
README.md
@@ -78,86 +78,6 @@ Code published under AFFERO GPL v3 (see [LICENSE-AGPLv3.txt](LICENSE-AGPLv3.txt)
|
|||||||
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
||||||
|
|
||||||
|
|
||||||
## Working with Docker
|
## Local development with Docker
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
|
|
||||||
You should have installed Docker and Docker Compose in your machine.
|
|
||||||
|
|
||||||
#### Macos
|
|
||||||
|
|
||||||
```bash
|
|
||||||
brew install docker
|
|
||||||
brew install docker-compose
|
|
||||||
brew cask install docker
|
|
||||||
open -a docker
|
|
||||||
```
|
|
||||||
|
|
||||||
You'll be asked to give Docker app permissions and type your password, then you're set.
|
|
||||||
|
|
||||||
#### Linux
|
|
||||||
|
|
||||||
1. Install Docker:
|
|
||||||
```bash
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
|
|
||||||
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
|
|
||||||
sudo apt-get update
|
|
||||||
apt-cache policy docker-engine
|
|
||||||
sudo apt-get install -y docker-engine
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Install Docker Compose
|
|
||||||
```bash
|
|
||||||
sudo curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.15.0/docker-compose-$(uname -s)-$(uname -m)"
|
|
||||||
sudo chmod +x /usr/local/bin/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
|
|
||||||
```
|
|
||||||
|
|
||||||
Then you'll have to build the container with:
|
|
||||||
```bash
|
|
||||||
sudo docker build -t consul .
|
|
||||||
```
|
|
||||||
|
|
||||||
Create your app database images:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo docker-compose up -d database
|
|
||||||
```
|
|
||||||
|
|
||||||
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:migrate
|
|
||||||
sudo docker-compose run app rake db:seed
|
|
||||||
sudo docker-compose run app rake db:dev_seed
|
|
||||||
```
|
|
||||||
|
|
||||||
### Running local CONSUL with Docker
|
|
||||||
|
|
||||||
Now we can finally run the application with:
|
|
||||||
```bash
|
|
||||||
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:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
|
Please check the documentation at https://consul_docs.gitbooks.io/docs/content
|
||||||
|
|||||||
Reference in New Issue
Block a user