-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
93 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,36 @@ | ||
# config valid only for current version of Capistrano | ||
lock '3.6.1' | ||
|
||
server '172.31.25.139', port: 80, roles: [:web, :app, :db], primary: true | ||
set :application, 'my_app_name' | ||
set :repo_url, 'git@example.com:me/my_repo.git' | ||
|
||
set :application, 'sportsello' | ||
set :repo_url, 'git@example.com:c-brooks/sportsello.git' | ||
# Default branch is :master | ||
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp | ||
|
||
set :user, 'deploy' | ||
set :puma_threads, [4, 16] | ||
set :puma_workers, 0 | ||
# Default deploy_to directory is /var/www/my_app_name | ||
# set :deploy_to, '/var/www/my_app_name' | ||
|
||
# Don't change these unless you know what you're doing | ||
set :pty, true | ||
set :use_sudo, false | ||
set :stage, :production | ||
set :deploy_via, :remote_cache | ||
set :deploy_to, "/home/#{fetch(:user)}/apps/#{fetch(:application)}" | ||
set :puma_bind, "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock" | ||
set :puma_state, "#{shared_path}/tmp/pids/puma.state" | ||
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid" | ||
set :puma_access_log, "#{release_path}/log/puma.error.log" | ||
set :puma_error_log, "#{release_path}/log/puma.access.log" | ||
set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa.pub) } | ||
set :puma_preload_app, true | ||
set :puma_worker_timeout, nil | ||
set :puma_init_active_record, true # Change to false when not using ActiveRecord | ||
# Default value for :scm is :git | ||
# set :scm, :git | ||
|
||
## Defaults: | ||
# set :scm, :git | ||
# set :branch, :master | ||
# set :format, :pretty | ||
# set :log_level, :debug | ||
# set :keep_releases, 5 | ||
|
||
## Linked Files & Directories (Default None): | ||
# set :linked_files, %w{config/database.yml} | ||
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} | ||
# Default value for :format is :airbrussh. | ||
# set :format, :airbrussh | ||
|
||
namespace :puma do | ||
desc 'Create Directories for Puma Pids and Socket' | ||
task :make_dirs do | ||
on roles(:app) do | ||
execute "mkdir #{shared_path}/tmp/sockets -p" | ||
execute "mkdir #{shared_path}/tmp/pids -p" | ||
end | ||
end | ||
# You can configure the Airbrussh format using :format_options. | ||
# These are the defaults. | ||
# set :format_options, command_output: true, log_file: 'log/capistrano.log', color: :auto, truncate: :auto | ||
|
||
before :start, :make_dirs | ||
end | ||
# Default value for :pty is false | ||
# set :pty, true | ||
|
||
namespace :deploy do | ||
desc "Make sure local git is in sync with remote." | ||
task :check_revision do | ||
on roles(:app) do | ||
unless `git rev-parse HEAD` == `git rev-parse origin/master` | ||
puts "WARNING: HEAD is not the same as origin/master" | ||
puts "Run `git push` to sync changes." | ||
exit | ||
end | ||
end | ||
end | ||
# Default value for :linked_files is [] | ||
# append :linked_files, 'config/database.yml', 'config/secrets.yml' | ||
|
||
desc 'Initial Deploy' | ||
task :initial do | ||
on roles(:app) do | ||
before 'deploy:restart', 'puma:start' | ||
invoke 'deploy' | ||
end | ||
end | ||
# Default value for linked_dirs is [] | ||
# append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system' | ||
|
||
desc 'Restart application' | ||
task :restart do | ||
on roles(:app), in: :sequence, wait: 5 do | ||
invoke 'puma:restart' | ||
end | ||
end | ||
# Default value for default_env is {} | ||
# set :default_env, { path: "/opt/ruby/bin:$PATH" } | ||
|
||
before :starting, :check_revision | ||
after :finishing, :compile_assets | ||
after :finishing, :cleanup | ||
after :finishing, :restart | ||
end | ||
|
||
# ps aux | grep puma # Get puma pid | ||
# kill -s SIGUSR2 pid # Restart puma | ||
# kill -s SIGTERM pid # Stop puma | ||
# Default value for keep_releases is 5 | ||
# set :keep_releases, 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# server-based syntax | ||
# ====================== | ||
# 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 'db.example.com', user: 'deploy', roles: %w{db} | ||
|
||
|
||
|
||
# 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. | ||
|
||
|
||
|
||
# Custom SSH Options | ||
# ================== | ||
# You may pass any option but keep in mind that net/ssh understands a | ||
# 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, { | ||
# keys: %w(/home/rlisowski/.ssh/id_rsa), | ||
# forward_agent: false, | ||
# auth_methods: %w(password) | ||
# } | ||
# | ||
# The server-based syntax can be used to override options: | ||
# ------------------------------------ | ||
# server 'example.com', | ||
# user: 'user_name', | ||
# roles: %w{web app}, | ||
# ssh_options: { | ||
# user: 'user_name', # overrides user setting above | ||
# keys: %w(/home/user_name/.ssh/id_rsa), | ||
# forward_agent: false, | ||
# auth_methods: %w(publickey password) | ||
# # password: 'please use keys' | ||
# } |