diff --git a/INSTALL.md b/INSTALL.md index 8844d6d..bdfb7f1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -22,14 +22,11 @@ Now create the required directories, e.g. `/srv/ensl.org` git clone git@github.com:ENSL/ensl.org.git -Create the `.env` file by copying `.env.example` with the appropriate credentials. +First select your environment (eg. development). Then use a script to load the env vars to your shell env: - cd ensl.org && cp .env.example .env - gedit .env + source script/env.sh .env .env.development -If the database does not exist, it will be created with settings from .env file so make sure you configure it. - -First build the ENSL docker containers. +Second build the ENSL docker containers. docker-compose build diff --git a/Makefile.dev b/Makefile.dev deleted file mode 100644 index bb3f616..0000000 --- a/Makefile.dev +++ /dev/null @@ -1,37 +0,0 @@ -#REGISTRY ?= ensl -PROJECT ?= ensl-plugin -TAG ?= latest - -.PHONY: all test clean build - -ifdef REGISTRY - IMAGE=$(REGISTRY)/$(PROJECT):$(TAG) -else - IMAGE=$(PROJECT) -endif - -all: - @echo "Available targets:" - @echo " * build - build a Docker image for $(IMAGE)" - @echo " * pull - pull $(IMAGE)" - @echo " * push - push $(IMAGE)" - @echo " * test - build and test $(IMAGE)" - -build: - docker-compose build -f docker-compose.dev.yml - -run: build - docker-compose up -f docker-compose.dev.yml - -pull: - docker pull $(IMAGE) || true - -push: - docker push $(IMAGE) - -clean: - docker ps -a | awk '{ print $$1,$$2 }' | grep $(IMAGE) |awk '{print $$1 }' |xargs -I {} docker rm {} - docker images -a |grep $(IMAGE) |awk '{print $$3}' |xargs -I {} docker rmi {} - -test: build - @echo "TODO" diff --git a/config/puma.rb b/config/puma.rb index f129249..eb48465 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,7 +1,6 @@ -# Load dev vars -# FIXME: right dev file is not loaded +# Load dev vars. These are loaded in application but puma needs them too. require "dotenv" -Dotenv.load(".env.local", '.env' + ENV['RAILS_ENV'] + '.local', '.env' + ENV['RAILS_ENV'], '.env') +Dotenv.load('.env.' + ENV['RAILS_ENV'] + '.local', '.env.local', '.env.' + ENV['RAILS_ENV'], '.env') tag 'ENSL' diff --git a/db/initdb.d/ensl.db.setup.sql b/db/initdb.d/99_ensl.setup.sql similarity index 100% rename from db/initdb.d/ensl.db.setup.sql rename to db/initdb.d/99_ensl.setup.sql diff --git a/docker-compose.yml b/docker-compose.yml index af4a168..671621e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -107,8 +107,8 @@ services: nginx: image: nginx:latest - command: /bin/bash container_name: ensl_${RAILS_ENV}_nginx + command: /bin/bash -c "envsubst '$$PUMA_PORT' < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" volumes: - ./ext/ssl/fullchain.pem:/etc/ssl/certs/ensl_fullchain.pem - ./ext/ssl/privkey.pem:/etc/ssl/private/ensl_privkey.pem @@ -122,7 +122,6 @@ services: - APP_PORT=$APP_PORT - PUMA_PORT=$PUMA_PORT - RAILS_ENV=$RAILS_ENV - # command: /bin/bash -c "envsubst '$$PUMA_PORT' < /etc/nginx/conf.d/nginx.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" # spring: # build: diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e71b7f8..eb586ea 100755 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,7 @@ ENV["RAILS_ENV"] ||= "test" -require 'dotenv/load' +require 'dotenv' +Dotenv.load('.env.' + ENV['RAILS_ENV'] + '.local', '.env.local', '.env.' + ENV['RAILS_ENV'], '.env') require "codeclimate-test-reporter" require "simplecov"