Updates to support ruby 2.3, docker-compose v2, and docker development

This commit is contained in:
Dan Elbert 2016-07-08 12:56:40 -05:00
parent b8e0835741
commit cfa7d95afe
6 changed files with 63 additions and 80 deletions

View File

@ -1,7 +1,6 @@
FROM phusion/passenger-ruby22:latest FROM phusion/passenger-ruby22:latest
RUN apt-get update \ RUN apt-get update \
&& apt-get upgrade -y --force-yes \
&& apt-get install -y ruby2.3 ruby2.3-dev \ && apt-get install -y ruby2.3 ruby2.3-dev \
&& ruby-switch --set ruby2.3 && ruby-switch --set ruby2.3
@ -22,6 +21,7 @@ ADD docker/db_migrate.sh /etc/my_init.d/db_migrate.sh
RUN chmod +x /etc/my_init.d/db_migrate.sh RUN chmod +x /etc/my_init.d/db_migrate.sh
# Set Default RAILS_ENV # Set Default RAILS_ENV
ENV RAILS_ENV docker
ENV PASSENGER_APP_ENV docker ENV PASSENGER_APP_ENV docker
# Setup directory and install gems # Setup directory and install gems
@ -29,7 +29,7 @@ RUN mkdir -p /home/app/parsley/
COPY Gemfile /home/app/parsley/ COPY Gemfile /home/app/parsley/
COPY Gemfile.lock /home/app/parsley/ COPY Gemfile.lock /home/app/parsley/
RUN gem install bundler RUN gem install bundler
RUN cd /home/app/parsley/ && bundle install --deployment RUN cd /home/app/parsley/ && bundle install --jobs 4
# Copy the app into the image # Copy the app into the image
COPY . /home/app/parsley/ COPY . /home/app/parsley/

View File

@ -1,79 +1,54 @@
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests. # In the development environment your application's code is reloaded on
config.cache_classes = true # every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Eager load code on boot. This eager loads most of Rails and # Do not eager load code on boot.
# your application in memory, allowing both threaded web servers config.eager_load = false
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on. # Show full error reports.
config.consider_all_requests_local = false config.consider_all_requests_local = true
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application # Enable/disable caching. By default caching is disabled.
# Add `rack-cache` to your Gemfile before enabling this. if Rails.root.join('tmp/caching-dev.txt').exist?
# For large-scale production use, consider using a caching reverse proxy like config.action_controller.perform_caching = true
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since config.cache_store = :memory_store
# Apache or NGINX already handles this. config.public_file_server.headers = {
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false
# Compress JavaScripts and CSS. config.cache_store = :null_store
config.assets.js_compressor = :uglifier end
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed. # Don't care if the mailer can't send.
config.assets.compile = false config.action_mailer.raise_delivery_errors = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets, config.action_mailer.perform_caching = false
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Specifies the header that your server uses for sending files. # Raise an error on page load if there are pending migrations.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache config.active_record.migration_error = :page_load
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # Debug mode disables concatenation and preprocessing of assets.
# config.force_ssl = true # This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Use the lowest log level to ensure availability of diagnostic information # Suppress logger output for asset requests.
# when problems arise. config.assets.quiet = true
config.log_level = :debug
# Prepend all log lines with the following tags. # Raises error for missing translations
# config.log_tags = [ :subdomain, :uuid ] # config.action_view.raise_on_missing_translations = true
# Use a different logger for distributed setups. # Use an evented file watcher to asynchronously detect changes in source code,
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # routes, locales, etc. This feature depends on the listen gem.
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end end

View File

@ -12,11 +12,14 @@
ActiveRecord::Schema.define(version: 20160707011314) do ActiveRecord::Schema.define(version: 20160707011314) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "ingredient_units", force: :cascade do |t| create_table "ingredient_units", force: :cascade do |t|
t.integer "ingredient_id", null: false t.integer "ingredient_id", null: false
t.string "name", null: false t.string "name", null: false
t.decimal "gram_weight", precision: 10, scale: 2, null: false t.decimal "gram_weight", precision: 10, scale: 2, null: false
t.index ["ingredient_id"], name: "index_ingredient_units_on_ingredient_id" t.index ["ingredient_id"], name: "index_ingredient_units_on_ingredient_id", using: :btree
end end
create_table "ingredients", force: :cascade do |t| create_table "ingredients", force: :cascade do |t|
@ -74,7 +77,7 @@ ActiveRecord::Schema.define(version: 20160707011314) do
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.text "preparation" t.text "preparation"
t.index ["recipe_id"], name: "index_recipe_ingredients_on_recipe_id" t.index ["recipe_id"], name: "index_recipe_ingredients_on_recipe_id", using: :btree
end end
create_table "recipe_steps", force: :cascade do |t| create_table "recipe_steps", force: :cascade do |t|
@ -83,7 +86,7 @@ ActiveRecord::Schema.define(version: 20160707011314) do
t.text "step" t.text "step"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["recipe_id"], name: "index_recipe_steps_on_recipe_id" t.index ["recipe_id"], name: "index_recipe_steps_on_recipe_id", using: :btree
end end
create_table "recipes", force: :cascade do |t| create_table "recipes", force: :cascade do |t|
@ -106,7 +109,7 @@ ActiveRecord::Schema.define(version: 20160707011314) do
t.decimal "gram_weight", precision: 7, scale: 1 t.decimal "gram_weight", precision: 7, scale: 1
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["usda_food_id"], name: "index_usda_food_weights_on_usda_food_id" t.index ["usda_food_id"], name: "index_usda_food_weights_on_usda_food_id", using: :btree
end end
create_table "usda_foods", force: :cascade do |t| create_table "usda_foods", force: :cascade do |t|
@ -147,8 +150,8 @@ ActiveRecord::Schema.define(version: 20160707011314) do
t.decimal "vit_d", precision: 10, scale: 1 t.decimal "vit_d", precision: 10, scale: 1
t.decimal "vit_k", precision: 10, scale: 1 t.decimal "vit_k", precision: 10, scale: 1
t.decimal "cholesterol", precision: 10, scale: 3 t.decimal "cholesterol", precision: 10, scale: 3
t.index ["long_description"], name: "index_usda_foods_on_long_description" t.index ["long_description"], name: "index_usda_foods_on_long_description", using: :btree
t.index ["ndbn"], name: "index_usda_foods_on_ndbn" t.index ["ndbn"], name: "index_usda_foods_on_ndbn", using: :btree
end end
create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|

View File

@ -1,9 +1,12 @@
web: version: '2'
image: danelbert/parsley:production
ports: services:
- "7000:80" web:
environment: image: danelbert/parsley:production
- PASSENGER_APP_ENV=production ports:
env_file: /etc/default/parsley - "7000:80"
volumes: environment:
- /var/log/parsley/:/home/app/parsley/log - PASSENGER_APP_ENV=production
env_file: /etc/default/parsley
volumes:
- /var/log/parsley/:/home/app/parsley/log

View File

@ -12,6 +12,8 @@ services:
build: . build: .
ports: ports:
- "3000:80" - "3000:80"
volumes:
- .:/home/app/parsley/
links: links:
- postgres - postgres
volumes: volumes:

View File

@ -5,7 +5,7 @@ server {
passenger_enabled on; passenger_enabled on;
passenger_user app; passenger_user app;
passenger_ruby /usr/bin/ruby2.2; passenger_ruby /usr/bin/ruby;
location ~ ^/(assets)/ { location ~ ^/(assets)/ {
gzip_static on; gzip_static on;