Skip to content

Commit

Permalink
Add development environment with docker and fig
Browse files Browse the repository at this point in the history
  • Loading branch information
robbi5 committed Jan 29, 2015
1 parent 8b1a003 commit f622158
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 4 deletions.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.git

# Ignore bundler config.
.bundle

# Ignore all logfiles and tempfiles.
log/*.log
tmp/*

# our data dir
data/*
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ruby:2.1.5

RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client nodejs poppler-utils advancecomp gifsicle jhead jpegoptim libjpeg-progs optipng pngcrush pngquant

RUN mkdir /app
WORKDIR /app
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock
RUN bundle install

ADD . /app

EXPOSE 5000
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ group :development, :test do
gem 'spring'
end

gem 'sqlite3', group: :test
gem 'memory_test_fix', group: :test

# Get i18n files
gem 'rails-i18n', '~> 4.0.0'

Expand Down
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ GEM
nokogiri (~> 1.4)
ntlm-http (~> 0.1, >= 0.1.1)
webrobots (>= 0.0.9, < 0.2)
memory_test_fix (1.2.2)
activerecord (>= 3.2.0, < 4.99.0)
railties (>= 3.2.0, < 4.99.0)
mime-types (2.4.3)
mini_portile (0.6.1)
minitest (5.5.0)
Expand Down Expand Up @@ -262,6 +265,7 @@ GEM
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.10)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
Expand Down Expand Up @@ -311,6 +315,7 @@ DEPENDENCIES
jquery-turbolinks
kaminari (~> 0.16.0)
mechanize (~> 2.7.3)
memory_test_fix
newrelic_rpm
patron (~> 0.4.18)
pg
Expand All @@ -321,6 +326,7 @@ DEPENDENCIES
sdoc (~> 0.4.0)
searchkick (~> 0.8.5)
spring
sqlite3
tophat (~> 2.2.0)
turbolinks
uglifier (>= 1.3.0)
Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
web: bundle exec rails server -p $PORT
web: bundle exec rails server -b 0.0.0.0 -p $PORT
worker: TERM_CHILD=1 QUEUE=* bundle exec rake environment resque:work
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ Just generate a fresh secret_key_base.

This file contains the connection details to your s3 server/bucket. Test uses the `tmp` folder, so you don't need a connection to a running s3 compatible storage.

Development
-----------

For an easy setup of an local development environment, [fig](http://fig.sh) is used. Install fig and run

fig up

Fig downloads the required services (postgres, elasticsearch, redis, ...) and installs the needed dependencies in a fresh docker container.

Jobs
----
Jobs are run by ActiveJob / Resque.
Expand Down
6 changes: 3 additions & 3 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ default: &default

development:
<<: *default
database: kleineanfragen_development
url: <%= ENV['DATABASE_URL'] || 'postgres://localhost/kleineanfragen_development' %>

# The specified database role being used to connect to postgres.
# To create additional roles in postgres see `$ createuser --help`.
Expand Down Expand Up @@ -56,8 +56,8 @@ development:
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: kleineanfragen_test
adapter: sqlite3
database: ":memory:"

# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
Expand Down
38 changes: 38 additions & 0 deletions fig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
web:
build: .
command: foreman start
ports:
- "5000:5000"
volumes:
- .:/app
links:
- db:database
- redis
- tika
- elasticsearch
environment:
ELASTICSEARCH_URL: http://elasticsearch:9200/
REDIS_URL: redis://redis:6379
DATABASE_URL: postgres://kleineanfragen:@database/kleineanfragen
TIKA_SERVER_URL: http://tika:9998/tika

db:
image: postgres
environment:
POSTGRES_USER: kleineanfragen
# ports:
# - "5432:5432"

redis:
image: redis

## FIXME: use matts image when released
tika:
image: logicalspark/docker-tikaserver

elasticsearch:
image: dockerfile/elasticsearch
# ports:
# - "9200:9200"

## FIXME: add image for nomenklatura

0 comments on commit f622158

Please sign in to comment.