8b46ed67 by Jeff Balicki

deploy

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 7f7cb64f
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
# Load tasks from gems
require 'capistrano/composer'
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
# Customize this path to change the location of your custom tasks.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
source 'https://rubygems.org'
gem 'capistrano', '~> 3.4.0'
gem 'capistrano-composer'
GEM
remote: https://rubygems.org/
specs:
capistrano (3.4.0)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capistrano-composer (0.0.6)
capistrano (>= 3.0.0.pre)
i18n (0.7.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.0.2)
rake (10.5.0)
sshkit (1.8.1)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
PLATFORMS
ruby
DEPENDENCIES
capistrano (~> 3.4.0)
capistrano-composer
No preview for this file type
set :application, 'tenzing-web-2023'
set :repo_url, 'git@git.gotenzing.com:tenzing/Tenzing-Web-2023.git'
# Branch options
# Prompts for the branch name (defaults to current branch)
#ask :branch, -> { `git rev-parse --abbrev-ref HEAD`.chomp }
# Hardcodes branch to always be master
# This could be overridden in a stage config file
set :branch, :master
set :keep_releases, 2
set :deploy_to, -> { "/var/www/html/production/#{fetch(:application)}" }
# Use :debug for more verbose output when troubleshooting
set :log_level, :info
# Put all shared files/directories here (e.g. uploads that need to go on the NFS drive)
#set :linked_files, fetch(:linked_files, []).push('.env')
#set :linked_dirs, fetch(:linked_dirs, []).push('uploads')
namespace :deploy do
desc 'Sync servers'
task :sync do
on roles(:web), in: :sequence, wait: 5 do
execute("si #{fetch(:application)}")
end
end
end
namespace :deploy do
desc 'Install composer packages'
task :install_composer_packages do
on roles(:web), in: :sequence, wait: 5 do
execute("cd '#{release_path}'; composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader")
end
end
end
namespace :deploy do
desc 'Sync servers'
task :sync_again do
on roles(:web), in: :sequence, wait: 5 do
execute("si #{fetch(:application)}")
end
end
end
# The above update_option_paths task is not run by default
# Note that you need to have WP-CLI installed on your server
# Uncomment the following line to run it on deploys if needed
# after 'deploy:publishing', 'deploy:update_option_paths'
after 'deploy:updated', 'deploy:install_composer_packages'
after 'deploy:updated', 'deploy:sync'
set :stage, :production
# Simple Role Syntax
# ==================
role :web, %w{tenzing_www@web-1}
# you can set custom ssh options
# it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options
# you can see them in [net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start)
# set it globally
# set :ssh_options, {
# keys: %w(~/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(password)
# }
fetch(:default_env).merge!(wp_env: :production)
set :application, 'tenzing-web-2023-staging'
set :stage, :staging
set :branch, :staging
# Simple Role Syntax
# ==================
role :web, %w{tenzing_www@web-1}
# you can set custom ssh options
# it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options
# you can see them in [net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start)
# set it globally
# set :ssh_options, {
# keys: %w(~/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(password)
# }
fetch(:default_env).merge!(wp_env: :staging)