Commit e62bc44ee8aaa0df43deb9307e6e938172a84c98
1 parent
50c9223f
Exists in
master
and in
1 other branch
cloud66 easydeploy
Showing
13 changed files
with
476 additions
and
0 deletions
Show diff stats
Gemfile
| @@ -3,6 +3,7 @@ ruby (ENV['RUBY_VERSION'] || '2.0.0') unless ENV['CI'] | @@ -3,6 +3,7 @@ ruby (ENV['RUBY_VERSION'] || '2.0.0') unless ENV['CI'] | ||
| 3 | 3 | ||
| 4 | RAILS_VERSION = '~> 3.2.15' | 4 | RAILS_VERSION = '~> 3.2.15' |
| 5 | 5 | ||
| 6 | +gem 'rails', RAILS_VERSION | ||
| 6 | gem 'actionmailer', RAILS_VERSION | 7 | gem 'actionmailer', RAILS_VERSION |
| 7 | gem 'actionpack', RAILS_VERSION | 8 | gem 'actionpack', RAILS_VERSION |
| 8 | gem 'railties', RAILS_VERSION | 9 | gem 'railties', RAILS_VERSION |
Gemfile.lock
| @@ -413,6 +413,7 @@ DEPENDENCIES | @@ -413,6 +413,7 @@ DEPENDENCIES | ||
| 413 | quiet_assets | 413 | quiet_assets |
| 414 | rack-ssl | 414 | rack-ssl |
| 415 | rack-ssl-enforcer | 415 | rack-ssl-enforcer |
| 416 | + rails (~> 3.2.15) | ||
| 416 | rails_autolink | 417 | rails_autolink |
| 417 | railties (~> 3.2.15) | 418 | railties (~> 3.2.15) |
| 418 | ri_cal | 419 | ri_cal |
| @@ -0,0 +1,131 @@ | @@ -0,0 +1,131 @@ | ||
| 1 | +production: | ||
| 2 | + after_checkout: | ||
| 3 | + - source: /config/cloud/cloud66/files/Procfile | ||
| 4 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/Procfile | ||
| 5 | + target: rails | ||
| 6 | + run_on: all_servers | ||
| 7 | + - source: /config/cloud/cloud66/files/_load_config.rb | ||
| 8 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/initializers/_load_config.rb | ||
| 9 | + target: rails | ||
| 10 | + run_on: all_servers | ||
| 11 | + - source: /config/cloud/cloud66/files/config.yml | ||
| 12 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/config.yml | ||
| 13 | + target: rails | ||
| 14 | + run_on: all_servers | ||
| 15 | + - source: /config/cloud/cloud66/files/mongoid.yml | ||
| 16 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/mongoid.yml | ||
| 17 | + target: rails | ||
| 18 | + run_on: all_servers | ||
| 19 | + - source: /config/cloud/cloud66/files/secret_token.rb | ||
| 20 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/initializers/secret_token.rb | ||
| 21 | + target: rails | ||
| 22 | + run_on: all_servers | ||
| 23 | + - source: /config/cloud/cloud66/files/seeds.rb | ||
| 24 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/db/seeds.rb | ||
| 25 | + target: rails | ||
| 26 | + run_on: all_servers | ||
| 27 | + - source: /config/cloud/cloud66/files/unicorn.rb.cloud66 | ||
| 28 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/unicorn.rb.cloud66 | ||
| 29 | + target: rails | ||
| 30 | + run_on: all_servers | ||
| 31 | + after_rails: | ||
| 32 | + - source: /config/cloud/cloud66/scripts/bundle.sh | ||
| 33 | + destination: /tmp/bundle.sh | ||
| 34 | + target: rails | ||
| 35 | + apply_during: build_only | ||
| 36 | + execute: true | ||
| 37 | + sudo: true | ||
| 38 | + - source: /config/cloud/cloud66/scripts/env_vars.sh | ||
| 39 | + destination: /tmp/env_vars.sh | ||
| 40 | + target: rails | ||
| 41 | + apply_during: build_only | ||
| 42 | + execute: true | ||
| 43 | + sudo: true | ||
| 44 | +staging: | ||
| 45 | + after_checkout: | ||
| 46 | + - source: /config/cloud/cloud66/files/Procfile | ||
| 47 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/Procfile | ||
| 48 | + target: rails | ||
| 49 | + run_on: all_servers | ||
| 50 | + - source: /config/cloud/cloud66/files/_load_config.rb | ||
| 51 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/initializers/_load_config.rb | ||
| 52 | + target: rails | ||
| 53 | + run_on: all_servers | ||
| 54 | + - source: /config/cloud/cloud66/files/config.yml | ||
| 55 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/config.yml | ||
| 56 | + target: rails | ||
| 57 | + run_on: all_servers | ||
| 58 | + - source: /config/cloud/cloud66/files/mongoid.yml | ||
| 59 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/mongoid.yml | ||
| 60 | + target: rails | ||
| 61 | + run_on: all_servers | ||
| 62 | + - source: /config/cloud/cloud66/files/secret_token.rb | ||
| 63 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/initializers/secret_token.rb | ||
| 64 | + target: rails | ||
| 65 | + run_on: all_servers | ||
| 66 | + - source: /config/cloud/cloud66/files/seeds.rb | ||
| 67 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/db/seeds.rb | ||
| 68 | + target: rails | ||
| 69 | + run_on: all_servers | ||
| 70 | + - source: /config/cloud/cloud66/files/unicorn.rb.cloud66 | ||
| 71 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/unicorn.rb.cloud66 | ||
| 72 | + target: rails | ||
| 73 | + run_on: all_servers | ||
| 74 | + after_rails: | ||
| 75 | + - source: /config/cloud/cloud66/scripts/bundle.sh | ||
| 76 | + destination: /tmp/bundle.sh | ||
| 77 | + target: rails | ||
| 78 | + apply_during: build_only | ||
| 79 | + execute: true | ||
| 80 | + sudo: true | ||
| 81 | + - source: /config/cloud/cloud66/scripts/env_vars.sh | ||
| 82 | + destination: /tmp/env_vars.sh | ||
| 83 | + target: rails | ||
| 84 | + apply_during: build_only | ||
| 85 | + execute: true | ||
| 86 | + sudo: true | ||
| 87 | + parse: true | ||
| 88 | +development: | ||
| 89 | + after_checkout: | ||
| 90 | + - source: /config/cloud/cloud66/files/Procfile | ||
| 91 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/Procfile | ||
| 92 | + target: rails | ||
| 93 | + run_on: all_servers | ||
| 94 | + - source: /config/cloud/cloud66/files/_load_config.rb | ||
| 95 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/initializers/_load_config.rb | ||
| 96 | + target: rails | ||
| 97 | + run_on: all_servers | ||
| 98 | + - source: /config/cloud/cloud66/files/config.yml | ||
| 99 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/config.yml | ||
| 100 | + target: rails | ||
| 101 | + run_on: all_servers | ||
| 102 | + - source: /config/cloud/cloud66/files/mongoid.yml | ||
| 103 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/mongoid.yml | ||
| 104 | + target: rails | ||
| 105 | + run_on: all_servers | ||
| 106 | + - source: /config/cloud/cloud66/files/secret_token.rb | ||
| 107 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/initializers/secret_token.rb | ||
| 108 | + target: rails | ||
| 109 | + run_on: all_servers | ||
| 110 | + - source: /config/cloud/cloud66/files/seeds.rb | ||
| 111 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/db/seeds.rb | ||
| 112 | + target: rails | ||
| 113 | + run_on: all_servers | ||
| 114 | + - source: /config/cloud/cloud66/files/unicorn.rb.cloud66 | ||
| 115 | + destination: <%= ENV['RAILS_STACK_PATH'] %>/config/unicorn.rb.cloud66 | ||
| 116 | + target: rails | ||
| 117 | + run_on: all_servers | ||
| 118 | + after_rails: | ||
| 119 | + - source: /config/cloud/cloud66/scripts/bundle.sh | ||
| 120 | + destination: /tmp/bundle.sh | ||
| 121 | + target: rails | ||
| 122 | + apply_during: build_only | ||
| 123 | + execute: true | ||
| 124 | + sudo: true | ||
| 125 | + - source: /config/cloud/cloud66/scripts/env_vars.sh | ||
| 126 | + destination: /tmp/env_vars.sh | ||
| 127 | + target: rails | ||
| 128 | + apply_during: build_only | ||
| 129 | + execute: true | ||
| 130 | + sudo: true | ||
| 131 | + parse: true |
| @@ -0,0 +1,82 @@ | @@ -0,0 +1,82 @@ | ||
| 1 | +require 'ostruct' | ||
| 2 | +default_config_file = Rails.root.join("config", "config.yml") | ||
| 3 | + | ||
| 4 | +# Allow a Rails Engine to override config by defining it earlier | ||
| 5 | +unless defined?(Errbit::Config) | ||
| 6 | + Errbit::Config = OpenStruct.new | ||
| 7 | + | ||
| 8 | + Errbit::Config.host = ENV['ERRBIT_HOST'] | ||
| 9 | + Errbit::Config.email_from = ENV['ERRBIT_EMAIL_FROM'] | ||
| 10 | + # Not really easy to use like an env because need an array and ENV return a string :( | ||
| 11 | + # Errbit::Config.email_at_notices = ENV['ERRBIT_EMAIL_AT_NOTICES'] | ||
| 12 | + Errbit::Config.confirm_resolve_err = ENV['ERRBIT_CONFIRM_RESOLVE_ERR'].to_i == 0 | ||
| 13 | + Errbit::Config.user_has_username = ENV['ERRBIT_USER_HAS_USERNAME'].to_i == 1 | ||
| 14 | + Errbit::Config.allow_comments_with_issue_tracker = ENV['ERRBIT_ALLOW_COMMENTS_WITH_ISSUE_TRACKER'].to_i == 0 | ||
| 15 | + Errbit::Config.enforce_ssl = ENV['ERRBIT_ENFORCE_SSL'] | ||
| 16 | + | ||
| 17 | + Errbit::Config.use_gravatar = ENV['ERRBIT_USE_GRAVATAR'] | ||
| 18 | + Errbit::Config.gravatar_default = ENV['ERRBIT_GRAVATAR_DEFAULT'] | ||
| 19 | + | ||
| 20 | + Errbit::Config.github_authentication = ENV['GITHUB_AUTHENTICATION'] | ||
| 21 | + Errbit::Config.github_client_id = ENV['GITHUB_CLIENT_ID'] | ||
| 22 | + Errbit::Config.github_secret = ENV['GITHUB_SECRET'] | ||
| 23 | + Errbit::Config.github_access_scope = ENV['GITHUB_ACCESS_SCOPE'].split(',').map(&:strip) if ENV['GITHUB_ACCESS_SCOPE'] | ||
| 24 | + | ||
| 25 | + Errbit::Config.smtp_settings = { | ||
| 26 | + :address => ENV['SMTP_SERVER'] || 'smtp.sendgrid.net', | ||
| 27 | + :port => ENV['SMTP_PORT'] || 25, | ||
| 28 | + :authentication => :plain, | ||
| 29 | + :user_name => ENV['SMTP_USERNAME'] || ENV['SENDGRID_USERNAME'], | ||
| 30 | + :password => ENV['SMTP_PASSWORD'] || ENV['SENDGRID_PASSWORD'], | ||
| 31 | + :domain => ENV['SMTP_DOMAIN'] || ENV['SENDGRID_DOMAIN'] | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + # Use example config for test environment. | ||
| 35 | + config_file = Rails.env == "test" ? default_config_file : Rails.root.join("config", "config.yml") | ||
| 36 | + | ||
| 37 | + # Load config if config file exists. | ||
| 38 | + if File.exists?(config_file) | ||
| 39 | + config = YAML.load_file(config_file) | ||
| 40 | + config.merge!(config.delete(Rails.env)) if config.has_key?(Rails.env) | ||
| 41 | + config.each do |k,v| | ||
| 42 | + Errbit::Config.send("#{k}=", v) | ||
| 43 | + end | ||
| 44 | + # Show message if we are not running tests, not running on Heroku, and config.yml doesn't exist. | ||
| 45 | + elsif not use_env | ||
| 46 | + puts "Please copy 'config/config.example.yml' to 'config/config.yml' and configure your settings. Using default settings." | ||
| 47 | + end | ||
| 48 | + | ||
| 49 | + # Set default devise modules | ||
| 50 | + Errbit::Config.devise_modules = [:database_authenticatable, | ||
| 51 | + :recoverable, :rememberable, :trackable, | ||
| 52 | + :validatable, :token_authenticatable, :omniauthable] | ||
| 53 | +end | ||
| 54 | + | ||
| 55 | +# Set default settings from config.example.yml if key is missing from config.yml | ||
| 56 | +default_config = YAML.load_file(default_config_file) | ||
| 57 | +default_config.each do |k,v| | ||
| 58 | + Errbit::Config.send("#{k}=", v) if Errbit::Config.send(k) === nil | ||
| 59 | +end | ||
| 60 | + | ||
| 61 | +# Disable GitHub oauth if gem is missing | ||
| 62 | +Errbit::Config.github_authentication = false unless defined?(OmniAuth::Strategies::GitHub) | ||
| 63 | + | ||
| 64 | +# Set SMTP settings if given. | ||
| 65 | +if smtp = Errbit::Config.smtp_settings | ||
| 66 | + ActionMailer::Base.delivery_method = :smtp | ||
| 67 | + ActionMailer::Base.smtp_settings = smtp | ||
| 68 | +end | ||
| 69 | + | ||
| 70 | +if sendmail = Errbit::Config.sendmail_settings | ||
| 71 | + ActionMailer::Base.delivery_method = :sendmail | ||
| 72 | + ActionMailer::Base.sendmail_settings = sendmail | ||
| 73 | +end | ||
| 74 | + | ||
| 75 | +# Set config specific values | ||
| 76 | +(ActionMailer::Base.default_url_options ||= {}).tap do |default| | ||
| 77 | + default.merge! :host => Errbit::Config.host if default[:host].blank? | ||
| 78 | +end | ||
| 79 | + | ||
| 80 | +if Rails.env.production? | ||
| 81 | + Rails.application.config.consider_all_requests_local = Errbit::Config.display_internal_errors | ||
| 82 | +end |
| @@ -0,0 +1,98 @@ | @@ -0,0 +1,98 @@ | ||
| 1 | +# The host of your errbit server | ||
| 2 | + | ||
| 3 | +# Enforce SSL connections | ||
| 4 | +enforce_ssl: false | ||
| 5 | + | ||
| 6 | +# The email address which email notifications | ||
| 7 | +# will be sent from. | ||
| 8 | +#email_from: | ||
| 9 | + | ||
| 10 | +# If you turn on this option, email_at_notices can be | ||
| 11 | +# configured on a per app basis, at the App edit page | ||
| 12 | +per_app_email_at_notices: false | ||
| 13 | + | ||
| 14 | +# Configure when emails are sent for an error. | ||
| 15 | +# [1,3,7] = 1st, 3rd, and 7th occurence triggers | ||
| 16 | +# an email notification. | ||
| 17 | +email_at_notices: [1, 10, 100] | ||
| 18 | + | ||
| 19 | +# If you turn on this option, notify_at_notices can be | ||
| 20 | +# configured on a per app basis, at the App edit page | ||
| 21 | +per_app_notify_at_notices: false | ||
| 22 | + | ||
| 23 | +# Configure when emails are sent for an error. | ||
| 24 | +# [1,3,7] = 1st, 3rd, and 7th occurence triggers | ||
| 25 | +# [0] for all notices, provided notification service is configured | ||
| 26 | +notify_at_notices: [0] | ||
| 27 | + | ||
| 28 | +# Configure whether or not the user should be prompted before resolving an error. | ||
| 29 | +confirm_resolve_err: true | ||
| 30 | + | ||
| 31 | +# Add an optional 'username' field to Users. | ||
| 32 | +# Helpful when you need to plug in a custom authentication strategy, such as LDAP. | ||
| 33 | +user_has_username: false | ||
| 34 | + | ||
| 35 | +# Allow comments while an issue tracker is configured. | ||
| 36 | +# This is useful if the err is not critical enough to create a ticket, | ||
| 37 | +# but you want to leave a short comment. | ||
| 38 | +allow_comments_with_issue_tracker: true | ||
| 39 | + | ||
| 40 | +# Display internal errors in production | ||
| 41 | +# Since this is an internal application, you might like to see what caused Errbit to crash. | ||
| 42 | +# Pull requests are always welcome! | ||
| 43 | +# However, you might be more comfortable setting this to false if your server can be accessed by anyone. | ||
| 44 | +display_internal_errors: true | ||
| 45 | +# The host of your errbit server | ||
| 46 | + | ||
| 47 | +allow_comments_with_issue_tracker: true | ||
| 48 | +# Enable Gravatar. | ||
| 49 | +use_gravatar: true | ||
| 50 | +# Default Gravatar image, can be: mm, identicon, monsterid, wavatar, retro. | ||
| 51 | +gravatar_default: identicon | ||
| 52 | + | ||
| 53 | +# Setup your deploy options for capistrano. | ||
| 54 | +#deployment: | ||
| 55 | +# hosts: | ||
| 56 | +# web: errbit.example.com | ||
| 57 | +# app: errbit.example.com | ||
| 58 | +# db: errbit.example.com | ||
| 59 | +# repository: http://github.com/errbit/errbit.git | ||
| 60 | +# branch: master | ||
| 61 | +# user: deploy | ||
| 62 | +# deploy_to: /var/www/apps/errbit | ||
| 63 | +# # setup path to unicorn pids folder (or deploy_to/shared/pids will be used) | ||
| 64 | +# # pids: /var/www/apps/errbit/shared/pids | ||
| 65 | + | ||
| 66 | +# GitHub OAuth configuration | ||
| 67 | +# If you want to allow authentication via GitHub, you will need to register | ||
| 68 | +# your app at: https://github.com/settings/applications | ||
| 69 | +# If you hosted Errbit at errbit.example.com, you would fill in: | ||
| 70 | +# | ||
| 71 | +# URL: http://errbit.example.com/ | ||
| 72 | +# Callback URL: http://errbit.example.com/users/auth/github | ||
| 73 | +# | ||
| 74 | +# After you have registered your app, copy your Client ID and Secret key below. | ||
| 75 | + | ||
| 76 | +# GitHub Permissions to request from user | ||
| 77 | +# ['repo'] - Allow creating issues for public and private repos. | ||
| 78 | +# ['public_repo'] - Only allow creating issues for public repos. | ||
| 79 | +# [] - No permission to create issues on any repos. | ||
| 80 | +github_access_scope: ['repo'] | ||
| 81 | + | ||
| 82 | +# Configure SMTP settings. If you are running Errbit on Heroku, | ||
| 83 | +# sendgrid will be configured by default. | ||
| 84 | +# ------------------------------------------------------------------------ | ||
| 85 | +#smtp_settings: | ||
| 86 | +# :address: | ||
| 87 | +# :domain: | ||
| 88 | +# :port: | ||
| 89 | +# :authentication: :plain | ||
| 90 | +# :enable_starttls_auto: | ||
| 91 | +# :user_name: | ||
| 92 | +# :password: | ||
| 93 | + | ||
| 94 | + | ||
| 95 | +# If you want send your email by your sendmail | ||
| 96 | +# sendmail_settings: | ||
| 97 | +# :location: '/usr/sbin/sendmail' | ||
| 98 | +# :arguments: '-i -t' | ||
| 0 | \ No newline at end of file | 99 | \ No newline at end of file |
| @@ -0,0 +1,38 @@ | @@ -0,0 +1,38 @@ | ||
| 1 | +# Mongoid Configuration | ||
| 2 | +# ===================== | ||
| 3 | +# | ||
| 4 | +# Copy this file to config/mongoid.yml and | ||
| 5 | +# modify it accordingly. This file will automatically | ||
| 6 | +# be copied to shared/config on the server when | ||
| 7 | +# `cap deploy:setup` is ran the first time. Be sure | ||
| 8 | +# to place production specific settings there | ||
| 9 | + | ||
| 10 | +development: | ||
| 11 | + sessions: | ||
| 12 | + default: | ||
| 13 | + database: errbit_development | ||
| 14 | + hosts: | ||
| 15 | + - '<%=ENV["MONGODB_ADDRESS"]%>:27017' | ||
| 16 | + options: | ||
| 17 | + identity_map_enabled: true | ||
| 18 | + use_utc: true | ||
| 19 | + | ||
| 20 | +test: | ||
| 21 | + sessions: | ||
| 22 | + default: | ||
| 23 | + hosts: | ||
| 24 | + - localhost:27017 | ||
| 25 | + database: errbit_test | ||
| 26 | + options: | ||
| 27 | + identity_map_enabled: true | ||
| 28 | + use_utc: true | ||
| 29 | + | ||
| 30 | +# set these environment variables on your prod server | ||
| 31 | +production: | ||
| 32 | + sessions: | ||
| 33 | + default: | ||
| 34 | + database: errbit | ||
| 35 | + hosts: | ||
| 36 | + - '<%=ENV["MONGODB_ADDRESS"]%>:27017' | ||
| 37 | + options: | ||
| 38 | + identity_map_enabled: true | ||
| 0 | \ No newline at end of file | 39 | \ No newline at end of file |
| @@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
| 1 | +puts "Seeding database" | ||
| 2 | +puts "-------------------------------" | ||
| 3 | + | ||
| 4 | +# Create an initial Admin User | ||
| 5 | +admin_username = "errbit" | ||
| 6 | +admin_email = "errbit@host.com" | ||
| 7 | +admin_pass = 'password' | ||
| 8 | + | ||
| 9 | +puts "Creating an initial admin user:" | ||
| 10 | +puts "-- username: #{admin_username}" if Errbit::Config.user_has_username | ||
| 11 | +puts "-- email: #{admin_email}" | ||
| 12 | +puts "-- password: #{admin_pass}" | ||
| 13 | +puts "" | ||
| 14 | +puts "Be sure to change these credentials ASAP!" | ||
| 15 | +user = User.where(:email => admin_email).first || User.new({ | ||
| 16 | + :name => 'Errbit Admin', | ||
| 17 | + :email => admin_email, | ||
| 18 | + :password => admin_pass, | ||
| 19 | + :password_confirmation => admin_pass | ||
| 20 | + }) | ||
| 21 | +user.username = admin_username if Errbit::Config.user_has_username | ||
| 22 | + | ||
| 23 | +user.admin = true | ||
| 24 | +user.save! | ||
| 25 | + |
| @@ -0,0 +1,36 @@ | @@ -0,0 +1,36 @@ | ||
| 1 | +worker_processes 3 | ||
| 2 | +timeout 30 | ||
| 3 | + | ||
| 4 | +working_directory "#{ENV['RAILS_STACK_PATH']}" | ||
| 5 | + | ||
| 6 | +listen "/tmp/web_server.sock", :backlog => 64 | ||
| 7 | + | ||
| 8 | +pid '/tmp/web_server.pid' | ||
| 9 | + | ||
| 10 | +stderr_path "#{ENV['RAILS_STACK_PATH']}/log/unicorn.stderr.log" | ||
| 11 | +stdout_path "#{ENV['RAILS_STACK_PATH']}/log/unicorn.stdout.log" | ||
| 12 | + | ||
| 13 | +preload_app true | ||
| 14 | +GC.respond_to?(:copy_on_write_friendly=) and | ||
| 15 | + GC.copy_on_write_friendly = true | ||
| 16 | + | ||
| 17 | +check_client_connection false | ||
| 18 | + | ||
| 19 | +before_fork do |server, worker| | ||
| 20 | + old_pid = '/tmp/web_server.pid.oldbin' | ||
| 21 | + if File.exists?(old_pid) && server.pid != old_pid | ||
| 22 | + begin | ||
| 23 | + Process.kill("QUIT", File.read(old_pid).to_i) | ||
| 24 | + rescue Errno::ENOENT, Errno::ESRCH | ||
| 25 | + # someone else did our job for us | ||
| 26 | + end | ||
| 27 | + end | ||
| 28 | + | ||
| 29 | + defined?(ActiveRecord::Base) and | ||
| 30 | + ActiveRecord::Base.connection.disconnect! | ||
| 31 | +end | ||
| 32 | + | ||
| 33 | +after_fork do |server, worker| | ||
| 34 | + defined?(ActiveRecord::Base) and | ||
| 35 | + ActiveRecord::Base.establish_connection | ||
| 36 | +end | ||
| 0 | \ No newline at end of file | 37 | \ No newline at end of file |
| @@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
| 1 | +production: | ||
| 2 | + rails: | ||
| 3 | + server: | ||
| 4 | + unique_name: frontend | ||
| 5 | + configuration: | ||
| 6 | + ruby_version: 2.0.0 | ||
| 7 | + environment_variables: | ||
| 8 | + SECRET_TOKEN: AUTO_GENERATE_30 | ||
| 9 | +staging: | ||
| 10 | + rails: | ||
| 11 | + server: | ||
| 12 | + unique_name: frontend | ||
| 13 | + configuration: | ||
| 14 | + ruby_version: 2.0.0 | ||
| 15 | + environment_variables: | ||
| 16 | + SECRET_TOKEN: AUTO_GENERATE_30 | ||
| 17 | +development: | ||
| 18 | + rails: | ||
| 19 | + server: | ||
| 20 | + unique_name: frontend | ||
| 21 | + configuration: | ||
| 22 | + ruby_version: 2.0.0 | ||
| 23 | + environment_variables: | ||
| 24 | + SECRET_TOKEN: AUTO_GENERATE_30 |
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +#!/bin/bash | ||
| 2 | +FILE=/tmp/bundle_done | ||
| 3 | + | ||
| 4 | +if [ -f $FILE ] | ||
| 5 | +then | ||
| 6 | + echo "File $FILE exists..." | ||
| 7 | +else | ||
| 8 | + cd $STACK_PATH | ||
| 9 | + bundle exec rake db:mongoid:create_indexes | ||
| 10 | + bundle exec rake db:seed | ||
| 11 | + touch /tmp/bundle_done | ||
| 12 | +fi | ||
| 0 | \ No newline at end of file | 13 | \ No newline at end of file |
| @@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
| 1 | +#!/bin/bash | ||
| 2 | +FILE=/tmp/env_vars_done | ||
| 3 | + | ||
| 4 | +if [ -f $FILE ] | ||
| 5 | +then | ||
| 6 | + echo "File $FILE exists..." | ||
| 7 | +else | ||
| 8 | + cd $RAILS_STACK_PATH | ||
| 9 | + echo "github_authentication: $GITHUB_AUTHENTICATION | ||
| 10 | + github_client_id: $GITHUB_CLIENT_ID | ||
| 11 | + github_secret: $GITHUB_SECRET | ||
| 12 | + ERRBIT_EMAIL_FROM: $MAILER_SENDER | ||
| 13 | + host: $ERRBIT_HOST | ||
| 14 | + email_from: $MAILER_SENDER | ||
| 15 | + smtp_settings: | ||
| 16 | + :address: $SMTP_ADDRESS | ||
| 17 | + :domain: $SMTP_DOMAIN | ||
| 18 | + :port: $SMTP_PORT | ||
| 19 | + :authentication: :plain | ||
| 20 | + :enable_starttls_auto: "true" | ||
| 21 | + :user_name: $SMTP_USERNAME | ||
| 22 | + :password: $SMTP_PASSWORD" >> config/config.yml | ||
| 23 | + touch /tmp/env_vars_done | ||
| 24 | +fi | ||
| 0 | \ No newline at end of file | 25 | \ No newline at end of file |