From 58484957fa9392be2d06886004578dfc0b7dd17e Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 10 Aug 2015 21:50:52 +0300 Subject: [PATCH] Update Capistrano configuration --- Capfile | 21 ++++++++------- Gemfile | 9 ++++--- Gemfile.lock | 41 ++++++++++++++++------------ config/deploy.rb | 23 +++++++++++----- config/deploy/production.rb | 54 +++++++++++++++++++++++++------------ 5 files changed, 95 insertions(+), 53 deletions(-) diff --git a/Capfile b/Capfile index cb0d4a5..3a50fba 100644 --- a/Capfile +++ b/Capfile @@ -1,10 +1,10 @@ -# Load DSL and Setup Up Stages +# Load DSL and set up stages require 'capistrano/setup' -# Includes default deployment tasks +# Include default deployment tasks require 'capistrano/deploy' -# Includes tasks from other gems included in your Gemfile +# Include tasks from other gems included in your Gemfile # # For documentation on these, see for example: # @@ -13,16 +13,19 @@ require 'capistrano/deploy' # https://github.com/capistrano/chruby # https://github.com/capistrano/bundler # https://github.com/capistrano/rails +# https://github.com/capistrano/passenger # # require 'capistrano/rvm' # require 'capistrano/rbenv' # require 'capistrano/chruby' -# require 'capistrano/bundler' -# require 'capistrano/rails/assets' -# require 'capistrano/rails/migrations' - -require 'capistrano/rails' +require 'capistrano/bundler' +require 'capistrano/rails/assets' +require 'capistrano/rails/migrations' +require 'capistrano/puma' +require 'capistrano/puma/nginx' # if you want to upload a nginx site template +# require 'capistrano/passenger' require 'capistrano/rvm' +require 'capistrano/git-submodule-strategy' -# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. +# Load custom tasks from `lib/capistrano/tasks` if you have any defined Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } diff --git a/Gemfile b/Gemfile index 3f7fd76..5be7f06 100644 --- a/Gemfile +++ b/Gemfile @@ -28,10 +28,6 @@ gem 'phony_rails' gem 'carrierwave' gem 'rmagick' -gem 'capistrano' -gem 'capistrano-rails' -gem 'capistrano-rvm' - gem 'puma', group: :production gem 'globalize' @@ -60,6 +56,11 @@ group :development do gem 'hirb' gem 'awesome_print' gem 'quiet_assets' + gem 'capistrano' + gem 'capistrano-rails' + gem 'capistrano-rvm' + gem 'capistrano3-puma' + gem 'capistrano-git-submodule-strategy' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 49c260e..cafa556 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,7 +51,7 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - arel (6.0.2) + arel (6.0.3) autoprefixer-rails (5.2.1.1) execjs json @@ -72,12 +72,17 @@ GEM capistrano-bundler (1.1.4) capistrano (~> 3.1) sshkit (~> 1.2) + capistrano-git-submodule-strategy (0.1.17) + capistrano (~> 3.1) capistrano-rails (1.1.3) capistrano (~> 3.1) capistrano-bundler (~> 1.1) capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) + capistrano3-puma (1.1.0) + capistrano (~> 3.0) + puma (>= 2.6) capybara (2.4.4) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -103,7 +108,7 @@ GEM currencies (~> 0.4.2) i18n_data (~> 0.7.0) currencies (0.4.2) - devise (3.5.1) + devise (3.5.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) @@ -130,12 +135,12 @@ GEM font-awesome-sass (4.3.2.1) sass (~> 3.2) formatador (0.2.5) - globalid (0.3.5) + globalid (0.3.6) activesupport (>= 4.1.0) globalize (5.0.1) activemodel (>= 4.2.0, < 4.3) activerecord (>= 4.2.0, < 4.3) - guard (2.12.8) + guard (2.13.0) formatador (>= 0.2.4) listen (>= 2.7, <= 4.0) lumberjack (~> 1.0) @@ -145,20 +150,20 @@ GEM shellany (~> 0.0) thor (>= 0.18.1) guard-compat (1.2.1) - guard-rspec (4.6.2) + guard-rspec (4.6.4) guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - highline (1.7.2) + highline (1.7.3) hirb (0.7.3) i18n (0.7.0) - i18n-tasks (0.8.5) - activesupport + i18n-tasks (0.8.7) + activesupport (>= 2.3.18) easy_translate (>= 0.5.0) erubis - highline + highline (>= 1.7.3) i18n - term-ansicolor + term-ansicolor (>= 1.3.2) terminal-table (>= 1.5.1) i18n_data (0.7.0) jquery-datatables-rails (3.3.0) @@ -172,7 +177,7 @@ GEM thor (>= 0.14, < 2.0) json (1.8.3) libv8 (3.16.14.11) - listen (3.0.2) + listen (3.0.3) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) loofah (2.0.2) @@ -183,7 +188,7 @@ GEM method_source (0.8.2) mime-types (2.6.1) mini_portile (0.6.2) - minitest (5.7.0) + minitest (5.8.0) morrisjs-rails (0.5.1) railties (> 3.1, < 5) nenv (0.2.0) @@ -193,12 +198,12 @@ GEM net-ssh (2.9.2) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) - notiffany (0.0.6) + notiffany (0.0.7) nenv (~> 0.1) shellany (~> 0.0) orm_adapter (0.5.0) pg (0.18.2) - phony (2.14.10) + phony (2.14.13) phony_rails (0.12.9) activesupport (>= 3.0) countries (~> 0.11, >= 0.11.5) @@ -209,7 +214,7 @@ GEM slop (~> 3.4) pry-rails (0.3.4) pry (>= 0.9.10) - puma (2.12.2) + puma (2.12.3) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) rack (1.6.4) @@ -232,7 +237,7 @@ GEM activesupport (>= 4.2.0.beta, < 5.0) nokogiri (~> 1.6.0) rails-deprecated_sanitizer (>= 1.0.1) - rails-erd (1.4.1) + rails-erd (1.4.2) activerecord (>= 3.2) activesupport (>= 3.2) choice (~> 0.2.0) @@ -255,7 +260,7 @@ GEM ref (2.0.0) responders (2.1.0) railties (>= 4.2.0, < 5) - rmagick (2.15.2) + rmagick (2.15.3) rspec (3.3.0) rspec-core (~> 3.3.0) rspec-expectations (~> 3.3.0) @@ -350,8 +355,10 @@ DEPENDENCIES bootstrap-sass-extras bootswatch-rails capistrano + capistrano-git-submodule-strategy capistrano-rails capistrano-rvm + capistrano3-puma capybara carrierwave coffee-rails diff --git a/config/deploy.rb b/config/deploy.rb index 0da1138..3a40ff2 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,17 +1,18 @@ -# config valid only for Capistrano 3.1 -lock '3.2.1' +# config valid only for current version of Capistrano +lock '3.4.0' set :application, 'clarion' set :repo_url, 'https://github.com/ignisf/clarion.git' # Default branch is :master -ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call +ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp # Default deploy_to directory is /var/www/my_app set :deploy_to, '/home/barf/clarion' # Default value for :scm is :git # set :scm, :git +set :git_strategy, Capistrano::Git::SubmoduleStrategy # Default value for :format is :pretty # set :format, :pretty @@ -23,10 +24,10 @@ set :deploy_to, '/home/barf/clarion' # set :pty, true # Default value for :linked_files is [] -set :linked_files, %w{config/puma.rb config/database.yml config/secrets.yml} +set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml') # Default value for linked_dirs is [] -set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads} +set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads') # Default value for default_env is {} # set :default_env, { path: "/opt/ruby/bin:$PATH" } @@ -34,7 +35,17 @@ set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public # Default value for keep_releases is 5 # set :keep_releases, 5 -set :rvm_ruby_version, '2.1.3' +set :rvm_ruby_version, '2.2.2' + +set :puma_bind, ["tcp://127.0.0.1:9087"] +set :puma_init_active_record, true +set :puma_access_log, "#{shared_path}/log/puma_access.log" +set :puma_error_log, "#{shared_path}/log/puma_error.log" +set :puma_preload_app, true + +set :nginx_sites_available_path, "#{shared_path}" +set :nginx_sites_enabled_path, "/tmp" +set :nginx_server_name, 'cfp.openfest.org' namespace :deploy do diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 74ee85a..b1277f3 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -1,33 +1,53 @@ -# Simple Role Syntax -# ================== -# Supports bulk-adding hosts to roles, the primary server in each group -# is considered to be the first unless any hosts have the primary -# property set. Don't declare `role :all`, it's a meta role. - - -# Extended Server Syntax +# server-based syntax # ====================== -# This can be used to drop a more detailed server definition into the -# server list. The second argument is a, or duck-types, Hash and is -# used to set extended properties on the server. +# Defines a single server with a list of roles and multiple properties. +# You can define all roles on a single server, or split them: + +# server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value +# server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value +server 'marla.ludost.net', user: 'barf', roles: %w{app db web} + + + +# role-based syntax +# ================== + +# Defines a role with one or multiple servers. The primary server in each +# group is considered to be the first unless any hosts have the primary +# property set. Specify the username and a domain or IP for the server. +# Don't use `:all`, it's a meta role. + +# role :app, %w{deploy@example.com}, my_property: :my_value +# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value +# role :db, %w{deploy@example.com} + + + +# Configuration +# ============= +# You can set any configuration variable like in config/deploy.rb +# These variables are then only loaded and set in this stage. +# For available Capistrano configuration variables see the documentation page. +# http://capistranorb.com/documentation/getting-started/configuration/ +# Feel free to add new variables to customise your setup. -server 'marla.ludost.net', user: 'barf', roles: %w{web db app} # Custom SSH Options # ================== # You may pass any option but keep in mind that net/ssh understands a -# limited set of options, consult[net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start). +# limited set of options, consult the Net::SSH documentation. +# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start # # Global options # -------------- -# set :ssh_options, { +set :ssh_options, { # keys: %w(/home/rlisowski/.ssh/id_rsa), -# forward_agent: false, + forward_agent: true, # auth_methods: %w(password) -# } +} # -# And/or per server (overrides global) +# The server-based syntax can be used to override options: # ------------------------------------ # server 'example.com', # user: 'user_name',