Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker improvements #1216

Merged
merged 28 commits into from
Jan 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f10f002
Merge pull request #1086 from transitland/master
irees May 23, 2017
2095ff4
Merge pull request #1102 from transitland/master
irees Jun 1, 2017
2b53d26
Merge pull request #1110 from transitland/master
irees Jun 20, 2017
e9a9590
Merge pull request #1113 from transitland/master
irees Jun 23, 2017
798052d
Merge pull request #1117 from transitland/master
irees Jun 29, 2017
8e89f20
Merge pull request #1121 from transitland/master
irees Jul 8, 2017
3cbc303
Merge pull request #1128 from transitland/master
irees Jul 20, 2017
898bfe8
Merge pull request #1140 from transitland/master
irees Aug 9, 2017
aff4409
Merge pull request #1157 from transitland/master
irees Aug 15, 2017
35c39bf
Merge pull request #1167 from transitland/master
irees Aug 23, 2017
c407dd3
Merge pull request #1175 from transitland/master
irees Aug 28, 2017
16db871
Merge pull request #1178 from transitland/master
irees Sep 27, 2017
f0776e0
Merge pull request #1195 from transitland/master
irees Oct 4, 2017
b4526ec
Merge pull request #1198 from transitland/master
irees Oct 27, 2017
0f885c2
Merge pull request #1202 from transitland/master
irees Nov 6, 2017
bbb847f
.dockerignore
Dec 30, 2017
1b4c6cf
puma
Dec 30, 2017
7900fdd
Run puma
Dec 30, 2017
5650c51
default port env
Dec 30, 2017
f5ff35b
email config
Jan 10, 2018
1b4c504
worker boot
Jan 10, 2018
9e9917c
preload app, simpler connection call
Jan 11, 2018
0ad05de
Improve Docker build caching
Jan 11, 2018
2cbb3c3
Tidy
Jan 11, 2018
6f2f38f
Rails 5 style RAILS_LOG_TO_STDOUT
Jan 11, 2018
b024e45
Merge branch 'master' into docker-production
irees Jan 11, 2018
18886f2
Remove Opsworks deploy
Jan 11, 2018
fd02070
Merge branch 'docker-production' of github.com:transitland/transitlan…
Jan 11, 2018
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
.dockerignore
22 changes: 18 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
FROM ruby:2.3.1

# Install essentials
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client libgeos-dev

# Setup /app
RUN mkdir /app
WORKDIR /app
ADD . /app
RUN gem install bundler -v 1.12.5
ADD Gemfile /app/Gemfile
ADD Gemfile.lock /app/Gemfile.lock

# Install bundler
RUN gem install bundler -v 1.16.1

# Install gems
COPY components /app/components
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN bundle install

# Install application
COPY . /app

# Run
CMD bundle exec puma -C config/puma.rb
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ gem 'marginalia', group: [:development, :staging]

# web server
gem 'unicorn', group: [:staging, :production]
gem 'puma'

# profiling
gem 'memory_profiler', group: [:test, :development]
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ GEM
binding_of_caller (>= 0.7)
pry (>= 0.9.11)
public_suffix (3.0.1)
puma (3.11.0)
rack (1.6.8)
rack-cors (1.0.2)
rack-protection (1.5.3)
Expand Down Expand Up @@ -852,6 +853,7 @@ DEPENDENCIES
pry-rails
pry-rescue
pry-stack_explorer
puma
rack-cors
rails (= 4.2.10)
rails-erd
Expand Down Expand Up @@ -880,4 +882,4 @@ DEPENDENCIES
whenever

BUNDLED WITH
1.15.4
1.16.1
10 changes: 0 additions & 10 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,3 @@ test:
- RAILS_ENV=test bundle exec rspec -r rspec_junit_formatter --format RspecJunitFormatter -o $CIRCLE_TEST_REPORTS/rspec/junit.xml
- mkdir -p $CIRCLE_ARTIFACTS/profiling
- RAILS_ENV=test bundle exec rake profile:import:nycdot[$CIRCLE_ARTIFACTS/profiling]

deployment:
staging:
branch: master
commands:
- ./deploy/env.rb staging
production:
branch: production
commands:
- ./deploy/env.rb prod
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def self.base_url_options

# use Mandrill to send e-mail
config.action_mailer.smtp_settings = {
address: "smtp.mandrillapp.com",
address: "smtp.sparkpostmail.com",
port: 587,
enable_starttls_auto: true,
user_name: Figaro.env.mandrill_user_name,
Expand Down
4 changes: 4 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
config.logstasher.enabled = true
Sidekiq.logger.formatter = Sidekiq::Logging::Json::Logger.new

if ENV["RAILS_LOG_TO_STDOUT"].present?
config.logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
end

# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]

Expand Down
11 changes: 11 additions & 0 deletions config/puma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env puma
port ENV.fetch("PORT") { 3000 }
environment ENV.fetch("RAILS_ENV") { "development" }

# Preload app
preload_app!

# Configure connections
on_worker_boot do
ActiveRecord::Base.establish_connection
end