Update docker version for CI

Get old circleci.yml
entry.sh env
Add test.sh for testing
Update Makefile for correct docker path
ADd env/test.sh
This commit is contained in:
Ari Timonen 2018-04-15 12:51:22 +00:00
parent e3275b34ce
commit fe66edf712
8 changed files with 75 additions and 12 deletions

View file

@ -1,19 +1,33 @@
RACK_ENV=
RAILS_ENV=
APP_SECRET=
RACK_ENV=production
RAILS_ENV=production
APP_SECRET=randomstringhere
DEPLOY_PATH=
DEPLOY_PATH=/var/www
PUMA_WORKERS=1
PUMA_WORKERS=5
PUMA_MIN_THREADS=1
PUMA_MAX_THREADS=16
PUMA_PORT=4000
PUMA_TIMEOUT=30
# Docker adds mysql to hosts
MYSQL_HOST=mysql
# This is used by both rails + mysql
MYSQL_DATABASE=ensl
MYSQL_USERNAME=
MYSQL_PASSWORD=
MYSQL_CONNECTION_POOL=8
# Add to allow docker image to connect
MYSQL_ROOT_HOST=%
# FIXME: Use root since normal user does not work. atm.
MYSQL_ROOT_PASSWORD=randomstringhere
# These variables are for ensl
MYSQL_USERNAME=root
MYSQL_PASSWORD=randomstringhere
# More MySQL vars
MYSQL_CONNECTION_POOL=32
NEW_RELIC_APP_NAME=ENSL
NEW_RELIC_LICENSE_KEY=

3
.gitignore vendored
View file

@ -2,7 +2,8 @@
/log/*
/tmp/*
/spec/tmp/*
/env/*
/env/production.sh
/env/development.sh
.ruby-version
.ruby-gemset
.env

View file

@ -1,4 +1,4 @@
PROJECT ?= abevoelker/example_rails_docker_ci
PROJECT ?= ensl/ensl.org
TAG ?= latest
ifdef REGISTRY

4
circle.yml Normal file
View file

@ -0,0 +1,4 @@
database:
override:
- mv config/database.circle.yml config/database.yml
- bundle exec rake db:create db:schema:load --trace

View file

@ -1,6 +1,7 @@
#!/bin/bash
env|grep -i MYSQL
env
cd /var/www
source .env
bundle exec rake assets:precompile
bundle exec puma -C config/puma.rb

25
env/test.sh vendored Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
export RACK_ENV=test
export RAILS_ENV=test
export APP_SECRET=e0cdcb729c4b21d5259e957a2ffc13a3
export DEPLOY_PATH=/var/www
export PUMA_WORKERS=1
export PUMA_MIN_THREADS=1
export PUMA_MAX_THREADS=16
export PUMA_PORT=3000
export PUMA_TIMEOUT=30
#export MYSQL_HOST="${MYSQL_PORT_3306_TCP_ADDR:-localhost}"
export MYSQL_DATABASE=ensl
export MYSQL_USER=root
export MYSQL_HOST="mysql"
export MYSQL_USERNAME=root
export MYSQL_ROOT_PASSWORD=test
export MYSQL_PASSWORD=test
export MYSQL_ROOT_HOST=172.%
export MYSQL_CONNECTION_POOL=32
exec "$@"

View file

@ -2,7 +2,8 @@ web:
image: ensl
volumes:
- "/srv/ensl/public:/var/www/public"
ports: "4000:4000"
ports:
- "4000:4000"
links:
- mysql
# - redis

17
test.sh Normal file
View file

@ -0,0 +1,17 @@
#!/bin/bash
set -e
# Undo the `bundle --deployment --without development test`
# settings baked into the prod-ready Docker image's .bundle/config
bundle config --delete without
bundle config --delete frozen
# Install gems in development and test groups
bundle
# Ensure database exists and has latest migrations
bundle exec rake db:create
bundle exec rake db:migrate
# Run tests
bundle exec rake