Skip to content

Commit

Permalink
Complete configuration for docker-compose & Heroku #107
Browse files Browse the repository at this point in the history
  • Loading branch information
subelsky committed Jul 21, 2017
1 parent 063504e commit 4b11a78
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,26 @@ heroku run rails console # access production console

The app can run in a self-contained environment, which you can use for development.

1) Install [Docker Community Edition](https://www.docker.com/get-docker).
2) `docker-compose up`
First, install [Docker Community Edition](https://www.docker.com/get-docker). Then:

```bash
docker-compose build # downloads images, builds containers
docker-compose up # start running containers
docker-compose exec web bin/rake db:setup db:migrate db:seed # prepare database, add seed data
docker-compose exec web bin/rake coyote:admin:create[user@example.com,password] # create initial user
```

The app should then be accessible at http://localhost:3000/. For more details see [local development with Docker Compose](https://devcenter.heroku.com/articles/local-development-with-docker-compose).

## Docker Workflow

```bash
docker ps # list running containers
docker-compose build # rebuild web container when new gems are installed
docker-compose exec web pumactl restart # restart Puma
docker-compose exec web bin/rails console # access Rails console
```

## API

API documentation is generated at `/apipie` and you can see MCA's version [here](http://coyote.mcachicago.org/apipie).
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/coyote-team/coyote",
"keywords": ["rails"],
"scripts": {
"postdeploy": "echo DB=$DATABASE_URL; bin/rake RAILS_ENV=production db:schema:load db:migrate db:test:prepare db:seed"
"postdeploy": "echo DB=$DATABASE_URL; bin/rake RAILS_ENV=production db:setup db:migrate db:seed"
},
"image": "heroku/ruby",
"env": {
Expand Down
4 changes: 4 additions & 0 deletions config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
port ENV["PORT"] || 3000
environment ENV["RACK_ENV"] || "development"

# Use "path" as the file to store the server info state. Used by "pumactl" to query and control the server

state_path '/tmp/puma.state'

on_worker_boot do
ActiveRecord::Base.establish_connection
end
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ services:
ports:
- 3000:3000
env_file: .env
environment:
RAILS_ENV: development
DATABASE_URL: postgres://postgres:docker@db:5432/coyote_development
volumes:
- ./:/coyote
command: bundle exec puma -C config/puma.rb
Expand All @@ -15,3 +18,5 @@ services:
image: postgres:latest
ports:
- 5432:5432
environment:
POSTGRES_PASSWORD: docker

0 comments on commit 4b11a78

Please sign in to comment.