Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

YACS on Docker! #135

Merged
merged 84 commits into from
Jan 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
8098fd0
adds docker config for rails, postgres, redis, nginx
Bad-Science Aug 7, 2016
2068bba
fix docker-compose postgres ports and and duplicate volume commnds
Bad-Science Sep 12, 2016
c123293
fixes docker links and ports, prepare for production environment
Bad-Science Sep 15, 2016
6962eb5
adds mkdir for puma pid to dockerfile
Bad-Science Sep 15, 2016
ae00af4
adds mkdir for puma pid to dockerfile
Bad-Science Sep 15, 2016
742bcc2
moves puma pid path creation
Bad-Science Sep 16, 2016
f0685fd
moves puma state path to /var...
Bad-Science Sep 16, 2016
512b5a8
moves web volume to dockerfile
Bad-Science Sep 16, 2016
8fc3894
location of app in nginx container to match web container and get vol…
Bad-Science Sep 16, 2016
fff9fa8
adds volumes back to dockerfile
Bad-Science Sep 16, 2016
b654726
remove assets precompilation from dockerfile
Bad-Science Sep 16, 2016
828c3c2
adds mime types to nginx conf
Bad-Science Sep 16, 2016
f54bd0e
add data folder for postgres
Bad-Science Sep 16, 2016
4be0aef
remove keep files
Bad-Science Sep 16, 2016
c672a76
[attempt] updates .travis.yml to work with docker
Bad-Science Sep 16, 2016
1721dd4
adds phantomjs to container for testing
Bad-Science Sep 16, 2016
49cd082
remove ruby from travis config
Bad-Science Sep 16, 2016
8cb18b9
adds install to travis
Bad-Science Sep 16, 2016
59a602f
[attempt] install phantomjs from source
Bad-Science Sep 16, 2016
099ccfa
[attempt2] install phantomjs from source
Bad-Science Sep 16, 2016
a1b63e2
add postgres to travis
Bad-Science Sep 16, 2016
266bbda
add travis install
Bad-Science Sep 16, 2016
436d0c0
uhh
Bad-Science Sep 16, 2016
7a1c523
use npm to install phantomjs
Bad-Science Sep 16, 2016
bdf606f
get phantomjs from bitbucket (again)
Bad-Science Sep 16, 2016
3226087
move rails docker-compose config to common file, move prod secrets to…
Bad-Science Sep 18, 2016
11f8385
fix common services
Bad-Science Sep 18, 2016
bae34dd
remove extra line from docker-compose
Bad-Science Sep 18, 2016
8d663a6
set version of common compose file to 2:
Bad-Science Sep 18, 2016
36c7994
remoces docker-compose.common.yml
Bad-Science Sep 18, 2016
2fadaab
add puma env vars to docker
Bad-Science Sep 18, 2016
2888adb
Docker NGINX HTTPS Support
robinm8 Nov 2, 2016
087d6d4
Modify Dockerfiles, Puma Config
robinm8 Nov 3, 2016
bb2617a
Modify Nginx Config
robinm8 Nov 3, 2016
52fe43d
Merge pull request #169 from YACS-RCOS/staging
Bad-Science Nov 6, 2016
10bbacf
Modify Dockerfiles, Configurations
robinm8 Nov 8, 2016
fedc8bb
Modify Configurations
robinm8 Nov 11, 2016
665b608
Create .gitignore In nginx/ssl
robinm8 Nov 11, 2016
f30b7c2
Revise Dockerfiles, No Args
robinm8 Nov 14, 2016
9330961
merge master into docker
Bad-Science Nov 22, 2016
851548e
Modify .env
robinm8 Nov 22, 2016
b71f2bf
Modify .gitignore
robinm8 Nov 26, 2016
6197564
Merge remote-tracking branch 'master/docker' into docker
robinm8 Nov 27, 2016
681f8e4
Fix .travis.yml
robinm8 Nov 27, 2016
2a0d96d
Fix Upstream
robinm8 Nov 27, 2016
70bb0cb
Fix Gemfile
robinm8 Nov 27, 2016
f90b124
Revert "Fix Gemfile"
robinm8 Nov 30, 2016
f7ebf68
Modify Dockerfile
robinm8 Nov 30, 2016
c87f40f
Modify Puma Port
robinm8 Dec 2, 2016
3f322cd
fix travis config
Bad-Science Dec 3, 2016
0d5eb37
checks Gemfile.lock back in
Bad-Science Dec 3, 2016
fe4c6f4
Pull .gitignore
robinm8 Dec 3, 2016
5c07257
adds scripts for docker operations
Bad-Science Dec 4, 2016
ac272d9
Merge branch 'docker' of github.com:YACS-RCOS/yacs into docker
robinm8 Dec 4, 2016
2d72323
Modify Dockerfile
robinm8 Dec 4, 2016
72bf7f4
fix phantomjs install (uses release on phantomjs github, see https://…
Bad-Science Dec 6, 2016
825f335
Update Nginx SSL Ciphers
robinm8 Dec 6, 2016
cae959c
Modify nginx.config
robinm8 Dec 6, 2016
8b6e074
Merge branch 'docker' of github.com:YACS-RCOS/yacs into docker
robinm8 Dec 6, 2016
5906849
Modify Gemfile
robinm8 Dec 6, 2016
ae7d35b
adds sleep to travis
Bad-Science Dec 6, 2016
8540fbd
fix travis
Bad-Science Dec 6, 2016
dfeb01b
Modify Dockerfile
robinm8 Dec 6, 2016
e6fe00b
Merge branch 'docker' of github.com:YACS-RCOS/yacs into docker
robinm8 Dec 6, 2016
072290c
Revert "Modify Gemfile"
robinm8 Dec 6, 2016
84bbcc3
remove commented lines of Dockerfile
Bad-Science Dec 6, 2016
d4b55f7
Merge branch 'docker' of github.com:YACS-RCOS/yacs into docker
robinm8 Dec 6, 2016
6fce328
adds script to generate dev certs
Bad-Science Dec 6, 2016
1cc1356
Merge pull request #165 from robinm8/docker
Bad-Science Dec 6, 2016
e01bcca
Update Nginx.conf
robinm8 Dec 6, 2016
2c2b6a6
fix cert script
Bad-Science Dec 6, 2016
9d6dfbc
Merge branch 'docker' of github.com:YACS-RCOS/yacs into docker
Bad-Science Dec 6, 2016
09ee505
Modify Nginx.conf
robinm8 Dec 6, 2016
0da120f
Merge pull request #188 from robinm8/docker
Bad-Science Dec 6, 2016
6c44402
Merge branch 'docker' of github.com:YACS-RCOS/yacs into docker
Bad-Science Dec 6, 2016
325c1ad
fix scripts
Bad-Science Dec 6, 2016
23cf345
update scripts to work in any working directory and move to /bin
Bad-Science Dec 7, 2016
009af9c
fix travis
Bad-Science Dec 7, 2016
9dfffb1
add update and deploy scripts
Bad-Science Dec 7, 2016
f49626a
fix deploy
Bad-Science Dec 7, 2016
2a88572
fix scripts
Bad-Science Dec 31, 2016
dbd51d3
updates version string
Bad-Science Jan 6, 2017
675347a
updates version string
Bad-Science Jan 6, 2017
512231f
updates version string
Bad-Science Jan 6, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RAILS_ENV=development
WEB_CONCURRENCY=1
MAX_THREADS=4
SECRET_TOKEN=temp
SECRET_KEY_BASE=temp
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
# Ignore tern files
\.tern-port

/coverage/
/coverage/
/data/**/
26 changes: 16 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
language: ruby
rvm:
- 2.2.3
before_install:
- wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2
- tar -xjf phantomjs-2.0.0-ubuntu-12.04.tar.bz2
- sudo rm -rf /usr/local/phantomjs/bin/phantomjs
- sudo mv phantomjs /usr/local/phantomjs/bin/phantomjs
before_script:
- psql -c 'create database "yacs-test";' -U postgres
sudo: required

services:
- docker

env:
- RAILS_ENV=test

install:
- bin/yacs-build
- bin/yacs-startd && docker ps
- sleep 10
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- bin/yacs-dbsetup

script:
- bin/yacs-test
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ruby:2.2.3

MAINTAINER Richie Young <richiejoeyoung@gmail.com>

RUN apt-get update && apt-get install -qq -y build-essential nodejs wget --fix-missing --no-install-recommends

ENV PHANTOMJS_VERSION 2.1.1
RUN \
apt-get install -y vim git wget libfreetype6 libfontconfig bzip2 && \
wget -q --no-check-certificate -O /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 https://github.com/paladox/phantomjs/releases/download/2.1.7/phantomjs-2.1.1-linux-x86_64.tar.bz2 && \
tar -xjf /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 -C /tmp && \
rm -f /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64.tar.bz2 && \
mv /tmp/phantomjs-$PHANTOMJS_VERSION-linux-x86_64/bin/phantomjs /usr/bin/phantomjs

ENV INSTALL_PATH /usr/src/app/
RUN mkdir -p $INSTALL_PATH
RUN mkdir -p /var/run/puma

WORKDIR $INSTALL_PATH
COPY Gemfile Gemfile.lock $INSTALL_PATH

RUN bundle install
COPY . $INSTALL_PATH

RUN mkdir -p /etc/puma/ssl
COPY nginx/ssl/ /etc/puma/ssl/
36 changes: 19 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
arel (6.0.3)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.2.2)
byebug (2.7.0)
columnize (~> 0.3)
debugger-linecache (~> 1.2)
capybara (2.10.1)
capybara (2.10.2)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
Expand All @@ -61,13 +62,13 @@ GEM
coderay (1.1.1)
columnize (0.9.0)
concurrent-ruby (1.0.2)
coveralls (0.8.15)
coveralls (0.8.16)
json (>= 1.8, < 3)
simplecov (~> 0.12.0)
term-ansicolor (~> 1.3)
term-ansicolor (~> 1.3.0)
thor (~> 0.19.1)
tins (>= 1.6.0, < 2)
crono (1.0.3)
crono (1.1.2)
activerecord (>= 4.0)
activesupport (>= 4.0)
cucumber (2.4.0)
Expand Down Expand Up @@ -110,11 +111,11 @@ GEM
sprockets (>= 2.0.0)
tilt (>= 1.2)
i18n (0.7.0)
jbuilder (2.6.0)
jbuilder (2.6.1)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
json (1.8.3)
libv8 (3.16.14.15)
libv8 (3.16.14.17)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
Expand All @@ -124,17 +125,17 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.1)
minitest (5.10.1)
multi_json (1.12.1)
multi_test (0.1.2)
newrelic_rpm (3.16.3.323)
newrelic_rpm (3.17.1.326)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
pg (0.19.0)
pickle (0.5.1)
cucumber (>= 0.8)
rake
poltergeist (1.10.0)
poltergeist (1.11.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
Expand All @@ -151,8 +152,9 @@ GEM
pry-stack_explorer (0.4.9.2)
binding_of_caller (>= 0.7)
pry (>= 0.9.11)
public_suffix (2.0.4)
puma (2.16.0)
rack (1.6.4)
rack (1.6.5)
rack-test (0.6.3)
rack (>= 1.0)
railroady (1.5.2)
Expand Down Expand Up @@ -211,7 +213,7 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (2.53.4)
selenium-webdriver (3.0.3)
childprocess (~> 0.5)
rubyzip (~> 1.0)
websocket (~> 1.0)
Expand All @@ -230,18 +232,18 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
term-ansicolor (1.4.0)
term-ansicolor (1.3.2)
tins (~> 1.0)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thor (0.19.4)
thread_safe (0.3.5)
tilt (2.0.5)
tins (1.12.0)
tins (1.13.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.2)
uglifier (3.0.4)
execjs (>= 0.3.0, < 3)
web-console (2.3.0)
activemodel (>= 4.0)
Expand Down Expand Up @@ -293,4 +295,4 @@ DEPENDENCIES
web-console (~> 2.0)

BUNDLED WITH
1.11.2
1.10.6
2 changes: 1 addition & 1 deletion app/views/api/v5/sections/_sections.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ json.sections sections do |section|
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/views/static/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<div>Inspired by Jeff Hui's YACS.</div>
</div>
<div class="footer-column">
<div>Yacs v0.8 - The Places You'll Go</div>
<div>Yacs v0.9 - One Box Life</div>
<div>
We love feedback!
<a href="https://github.com/YACS-RCOS/yacs/">Github</a>
Expand Down
5 changes: 5 additions & 0 deletions bin/yacs-assets
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

docker-compose run web rake assets:precompile && rm -f public/index.html
chmod -f a+r public/* || :
4 changes: 4 additions & 0 deletions bin/yacs-bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

docker-compose run web bash
4 changes: 4 additions & 0 deletions bin/yacs-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

docker-compose build
5 changes: 5 additions & 0 deletions bin/yacs-dbsetup
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

mkdir -p data/potsgres
docker-compose run web bundle exec rake db:create db:migrate
4 changes: 4 additions & 0 deletions bin/yacs-generate-cert
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout nginx/ssl/yacs.key -out nginx/ssl/yacs.cer -subj "/C=US/ST=New York/L=Troy/O=RPI/OU=RCOS/CN=yacs.cs.rpi.edu"
4 changes: 4 additions & 0 deletions bin/yacs-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

docker-compose run web $@
4 changes: 4 additions & 0 deletions bin/yacs-start
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

docker-compose up
4 changes: 4 additions & 0 deletions bin/yacs-startd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

docker-compose up -d
4 changes: 4 additions & 0 deletions bin/yacs-stop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

docker-compose stop
4 changes: 4 additions & 0 deletions bin/yacs-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

RAILS_ENV=test docker-compose run web bundle exec rake
4 changes: 4 additions & 0 deletions bin/yacs-update
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

git pull origin
9 changes: 9 additions & 0 deletions bin/yacs-update-deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
cd $(dirname `readlink -f "$0"`)/../

bin/yacs-update
bin/yacs-build
bin/yacs-dbsetup
bin/yacs-stop
bin/yacs-assets
bin/yacs-startd
2 changes: 2 additions & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ default: &default
adapter: postgresql
pool: 5
timeout: 5000
host: postgres
username: postgres

development:
<<: *default
Expand Down
1 change: 1 addition & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

end
1 change: 0 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
Expand Down
19 changes: 10 additions & 9 deletions config/puma.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
workers Integer(ENV['WEB_CONCURRENCY'] || 4)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
environment ENV['RAILS_ENV'] || 'development'

if ENV['DSTATEDIR']
pidfile "#{ENV['DSTATEDIR']}puma.pid"
state_path "#{ENV['DSTATEDIR']}puma.state"
daemonize true
end
ssl_bind '0.0.0.0', '3000', {
key: "/etc/puma/ssl/yacs.key",
cert: "/etc/puma/ssl/yacs.cer"
}

pidfile "/var/run/puma/puma.pid"
state_path "/var/run/puma/puma.state"

on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end
end
1 change: 1 addition & 0 deletions config/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ test:
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
secret_token: <%= ENV["SECRET_TOKEN"] %>
File renamed without changes.
12 changes: 12 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

mkdir -p ./data/postgres
mkdir -p ./data/redis
mkdir -p ./tmp/pids/puma

docker-compose down
docker-compose build
docker-compose run web rm public/index.html
docker-compose run web bundle exec rake db:create db:migrate
docker-compose run web bundle exec rake assets:precompile
docker-compose up -d
Loading