Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jeff Balicki
/
FP_Canada
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
d47738bc
authored
2022-01-17 16:28:42 -0500
by
Jeff Balicki
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
rrr
1 parent
ade29bcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
55 deletions
config/deploy.rb
config/deploy.rb
View file @
d47738b
set
:application
,
'fp-canada'
set
:repo_url
,
'git@git.gotenzing.com:jeffmbalicki/FP_Canada.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
:branch
,
:master
SSHKit
.
config
.
command_map
[
:composer
]
=
"/usr/bin/php72 /home/tenzing_www/composer.phar"
set
:keep_releases
,
2
set
:deploy_to
,
->
{
"/var/www/html/production/
#{
fetch
(
:application
)
}
"
}
...
...
@@ -17,13 +18,24 @@ set :deploy_to, -> { "/var/www/html/production/#{fetch(:application)}" }
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
(
'wp-content/wflogs'
,
'wp-content/uploads'
,
'wp-content/storage'
,
'wp-content/cache'
)
set
:linked_files
,
fetch
(
:linked_files
,
[]).
push
(
'.env'
,
'wordfence-waf.php'
,
'wp-content/wp-cache-config.php'
)
set
:linked_dirs
,
fetch
(
:linked_dirs
,
[]).
push
(
'wp-content/wflogs'
,
'wp-content/uploads'
,
'wp-content/storage'
,
'wp-content/languages'
,
'wp-content/cache'
,
'wp-content/wp-rocket-config'
)
namespace
:deploy
do
desc
'Restart application'
task
:restart
do
on
roles
(
:app
),
in: :sequence
,
wait:
5
do
# Your restart mechanism here, for example:
# execute :service, :nginx, :reload
end
end
end
namespace
:deploy
do
desc
'Sync servers'
task
:sync
do
on
roles
(
:web
),
in: :sequence
,
wait:
5
do
execute
"cd '
#{
release_path
}
/'; rm -Rf .git/ "
execute
(
"si
#{
fetch
(
:application
)
}
"
)
end
end
...
...
@@ -38,20 +50,30 @@ namespace :deploy do
end
end
namespace
:deploy
do
desc
'Install composer packages'
desc
'Install composer packages
in understrap-child theme
'
task
:install_theme_packages
do
on
roles
(
:web
),
in: :sequence
,
wait:
5
do
execute
"cd '
#{
release_path
}
'; /usr/bin/php73 /home/tenzing_www/bin/compose
r install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader"
execute
"cd '
#{
release_path
}
/wp-content/themes/understrap-child'; /usr/bin/php73 /home/tenzing_www/composer.pha
r install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader"
end
end
end
namespace
:deploy
do
desc
'Install composer packages'
task
:install_
theme_
packages
do
desc
'Install composer packages
in root
'
task
:install_packages
do
on
roles
(
:web
),
in: :sequence
,
wait:
5
do
execute
"cd '
#{
release_path
}
/wp-content/themes/understrap-child'; /usr/bin/php73 /home/tenzing_www/bin/composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader"
execute
"cd '
#{
release_path
}
'; /usr/bin/php73 /home/tenzing_www/composer.phar install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader"
end
end
end
namespace
:deploy
do
desc
'set file permissions'
task
:set_permissions
do
on
roles
(
:web
),
in: :sequence
,
wait:
5
do
execute
"cd '
#{
release_path
}
/'; chmod 777 .htaccess .user.ini wordfence-waf.php"
end
end
end
...
...
@@ -59,56 +81,12 @@ end
# Override `git#create_release` to handle submodules
# namespace :git do
# desc 'Copy repo to releases'
# task create_release: :'git:update' do
# on roles(:all) do
# with fetch(:git_environmental_variables) do
# within repo_path do
# execute :git, :clone, '-b', fetch(:branch), '--recursive', '.', release_path
# end
# end
# end
# end
# end
# The above restart task is not run by default
# Uncomment the following line to run it on deploys if needed
# after 'deploy:publishing', 'deploy:restart'
namespace
:deploy
do
desc
'Remove Git Files'
task
:cleanup
do
on
roles
(
:web
),
in: :sequence
,
wait:
5
do
execute
"cd '
#{
release_path
}
/'; rm -Rf .git/ "
end
end
end
# namespace :deploy do
# desc 'Update WordPress template root paths to point to the new release'
# task :update_option_paths do
# on roles(:app) do
# within fetch(:release_path) do
# if test :wp, :core, 'is-installed'
# [:stylesheet_root, :template_root].each do |option|
# # Only change the value if it's an absolute path
# # i.e. The relative path "/themes" must remain unchanged
# # Also, the option might not be set, in which case we leave it like that
# value = capture :wp, :option, :get, option, raise_on_non_zero_exit: false
# if value != '' && value != '/themes'
# execute :wp, :option, :set, option, fetch(:release_path).join('web/wp/wp-content/themes')
# end
# end
# end
# end
# end
# end
# end
...
...
@@ -116,7 +94,8 @@ end
# 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_packages'
after
'deploy:updated'
,
'deploy:install_theme_packages'
after
'deploy:updated'
,
'deploy:sync'
after
'deploy:updated'
,
'deploy:set_permissions'
after
'deploy:finished'
,
'deploy:sync_again'
...
...
Please
register
or
sign in
to post a comment