8b46ed67 by Jeff Balicki

deploy

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