Skip to content

Commit

Permalink
Refine development setup
Browse files Browse the repository at this point in the history
Development with compose now uses the same Dockerfile. We also wait for
MySQL at startup so the entire setup is more robust.
  • Loading branch information
dariusf committed Jan 20, 2017
1 parent 299fe14 commit 49e26bd
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 38 deletions.
6 changes: 2 additions & 4 deletions .env.db
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
MYSQL_USER=commit_watcher
MYSQL_DATABASE=commit_watcher_production
MYSQL_DATABASE=commit_watcher_development
MYSQL_PASSWORD=changeme123

# Not used but should set one for security.
MYSQL_ROOT_PASSWORD=changeme123

# This is for the commit_watcher user.
MYSQL_PASSWORD=changeme123
4 changes: 2 additions & 2 deletions .env.web
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RAILS_ENV=production
RAILS_ENV=development
REDIS_URL=redis://redis:6379/12
RAILS_SERVE_STATIC_FILES=true
COMMIT_WATCHER_DATABASE_PASSWORD=changeme123
COMMIT_WATCHER_DATABASE_HOST=db
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ RUN gem install bundler && bundle install
RUN mkdir /myapp
ADD . /myapp
WORKDIR /myapp

ENTRYPOINT scripts/deploy
15 changes: 0 additions & 15 deletions Dockerfile-internal

This file was deleted.

8 changes: 4 additions & 4 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
username: commit_watcher
password: changeme123
# Use this for local mysql instances
socket: /tmp/mysql.sock
# socket: /tmp/mysql.sock

# Use this for Docker
#host: db
host: db

# Use this for External RDS
#host: <%= ENV['COMMIT_WATCHER_EXTERNAL_DATABASE_URL'] %>
Expand Down
4 changes: 1 addition & 3 deletions config/sidekiq.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
---
:concurrency: 5
staging:
:concurrency: 5
:logfile: ./log/sidekiq.log
production:
:concurrency: 10
:logfile: ./log/sidekiq.log
:queues:
- audit_commits
- collect_commits
Expand Down
10 changes: 0 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ web:
env_file:
- '.env.web'
command: scripts/deploy
sidekiq:
build: .
volumes:
- .:/myapp
links:
- db
- redis
env_file:
- '.env.web'
command: bundle exec sidekiq
db:
image: library/mysql:5.6.22
ports:
Expand Down
6 changes: 6 additions & 0 deletions scripts/deploy
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/sh

echo 'Waiting for MySQL to be available...'
while ! mysqladmin ping -h"$COMMIT_WATCHER_DATABASE_HOST" --silent; do
sleep 2
done
echo 'MySQL is up!'

bundle exec rake assets:precompile --trace

export SECRET_KEY_BASE=$(rake secret)
Expand Down

0 comments on commit 49e26bd

Please sign in to comment.