diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2548e84 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.git + +# Ignore bundler config. +.bundle + +# Ignore all logfiles and tempfiles. +log/*.log +tmp/* + +# our data dir +data/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..247fd3e --- /dev/null +++ b/Dockerfile @@ -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 \ No newline at end of file diff --git a/Gemfile b/Gemfile index f1d8347..386eb42 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock index 65d2fdb..3b0437a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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 @@ -321,6 +326,7 @@ DEPENDENCIES sdoc (~> 0.4.0) searchkick (~> 0.8.5) spring + sqlite3 tophat (~> 2.2.0) turbolinks uglifier (>= 1.3.0) diff --git a/Procfile b/Procfile index d990418..d81a9df 100644 --- a/Procfile +++ b/Procfile @@ -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 \ No newline at end of file diff --git a/README.md b/README.md index 63a1683..b12a807 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/config/database.yml b/config/database.yml index 57e6349..80f0cec 100644 --- a/config/database.yml +++ b/config/database.yml @@ -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`. @@ -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 diff --git a/fig.yml b/fig.yml new file mode 100644 index 0000000..def40be --- /dev/null +++ b/fig.yml @@ -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