Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

Commit

Permalink
convert to puma, add circle, Dockerfile (#49)
Browse files Browse the repository at this point in the history
* convert to puma, add circle, Dockerfile

* Connect db with method not dependant on db_connections gem

* Copy paste fail

* Fix teaspoon

* Remove db connection lines because there's no db

* Revert "Remove db connection lines because there's no db"

This reverts commit 9c588b8.

* Fix circle build

* Add redis to circle build for teaspoon

* remove brakeman from circle build
  • Loading branch information
jlambert121 authored and joecannatti committed Oct 11, 2016
1 parent 257f4de commit 8e02644
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 41 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ruby:2.3.1-alpine

RUN apk add --update build-base nodejs tzdata postgresql-dev linux-headers git

COPY . /app
WORKDIR /app

VOLUME /app/log

EXPOSE 3000

RUN gem install bundler && \
bundle install --without development:test --system

CMD ["sh", "-c", "exec bundle exec puma -C config/puma.rb"]
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gem 'spring', group: :development
gem 'bower-rails'
gem 'resque', github: 'resque/resque', branch: 'master'#'https://github.com/stitchfix/resque.git', branch: 'resque-redis-interface'
gem 'angular-rails-templates', git: "https://github.com/davetron5000/angular-rails-templates.git", branch: "patch-1"
gem 'unicorn'
gem 'puma'
gem "foreman"
gem "cron2english"

Expand Down
10 changes: 3 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ GEM
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
kgio (2.10.0)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
Expand All @@ -119,6 +118,7 @@ GEM
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
puma (3.6.0)
rack (1.6.4)
rack-protection (1.5.3)
rack
Expand Down Expand Up @@ -153,7 +153,6 @@ GEM
activesupport (= 4.2.5.2)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.17.0)
rake (11.3.0)
redis (3.3.1)
redis-namespace (1.5.2)
Expand Down Expand Up @@ -195,9 +194,6 @@ GEM
thread_safe (~> 0.1)
uglifier (3.0.2)
execjs (>= 0.3.0, < 3)
unicorn (5.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
vegas (0.1.11)
rack (>= 1.0.0)
websocket (1.2.3)
Expand All @@ -222,6 +218,7 @@ DEPENDENCIES
jquery-rails
nokogiri (>= 1.6.7.2)
poltergeist
puma
rails (~> 4.2.5.1)
rails-html-sanitizer (~> 1.0.3)
rails_12factor
Expand All @@ -233,7 +230,6 @@ DEPENDENCIES
spring
teaspoon-jasmine
uglifier (>= 1.3.0)
unicorn

BUNDLED WITH
1.12.5
1.13.0
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
web: bundle exec puma -C config/puma.rb
monitor_queue_sizes: bin/monitor_queue_sizes
41 changes: 41 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
general:
branches:
ignore:
- /deploy\/.*/
- staging
- production

dependencies:
pre:
- gem install bundler
override:
- bundle install --path=vendor/bundle:
timeout: 180
machine:
timezone:
America/Los_Angeles
services:
- docker
- redis

deployment:
production:
branch: master
commands:
- bundle exec rake assets:precompile
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- docker build -t stitchfix/resque-brain:$CIRCLE_SHA1 .
- docker tag stitchfix/resque-brain:$CIRCLE_SHA1 stitchfix/resque-brain:latest
- docker push stitchfix/resque-brain:latest
- docker push stitchfix/resque-brain:$CIRCLE_SHA1
other:
branch: /^((?!master).)*$/
commands:
- bundle exec rake assets:precompile
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- docker build -t stitchfix/resque-brain:$CIRCLE_SHA1 .
- docker tag stitchfix/resque-brain:$CIRCLE_SHA1 stitchfix/goro:latest

notify:
webhooks:
- url: https://fixops-service.stitchfix.com/webhooks/circleci
17 changes: 17 additions & 0 deletions config/puma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
workers Integer(ENV['WEB_CONCURRENCY'] || 4)
threads_count = Integer(ENV['MAX_THREADS'] || 1)
threads threads_count, threads_count

preload_app!

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

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
if defined?(ActiveRecord::Base)
ActiveRecord::Base.establish_connection
end
end
32 changes: 0 additions & 32 deletions config/unicorn.rb

This file was deleted.

0 comments on commit 8e02644

Please sign in to comment.