railman-deployment 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe48564545ec8f43274ae23c0487e72212b728b73d690ceebea998d84c5aab5f
|
4
|
+
data.tar.gz: b6602cffaa413dc77abdd94bd764c363d933b3aed20fa61e88af293048294136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da2af54cccba64ac8ac43ffbf9af3115fff13ab2062b49a5a99a9c0a183cbc3988ad94c87d062e52522b743179584f454720103d23176b18952e8bc039be89e7
|
7
|
+
data.tar.gz: 55b5cf932de139e23d03051ba0a59db058b70a441394ab2fb2bef6fefe6fb1d7678a7ac514406b8cb3e3af1bbab95649800e3d080201ddefae5337428b05e748
|
@@ -39,7 +39,6 @@ task :setup do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
# todo
|
43
42
|
desc 'Remove the application completely from the server'
|
44
43
|
task :remove do
|
45
44
|
on roles(:all) do
|
@@ -61,7 +60,6 @@ task :remove do
|
|
61
60
|
execute :systemctl, :restart, :nginx
|
62
61
|
# remove logrotate configuration
|
63
62
|
execute :su_rm, "-f /etc/logrotate.d/#{fetch(:application)}"
|
64
|
-
# todo remove letsencrypt certificates and renew cron job
|
65
63
|
end
|
66
64
|
end
|
67
65
|
end
|
@@ -97,25 +95,6 @@ task :update do
|
|
97
95
|
end
|
98
96
|
end
|
99
97
|
|
100
|
-
desc "Recreate server database from db/#{fetch(:application)}.sql and sync local dirs if any"
|
101
|
-
task :reset_server do
|
102
|
-
on roles(:all) do
|
103
|
-
with fetch(:environment) do
|
104
|
-
within fetch(:deploy_to) do
|
105
|
-
execute :systemctl, :stop, fetch(:application)
|
106
|
-
execute :systemctl, :stop, "#{fetch(:application)}_sidekiq"
|
107
|
-
invoke :fetch_and_reset_git_repository
|
108
|
-
execute :rake, 'db:drop'
|
109
|
-
invoke :create_database_from_sql_file
|
110
|
-
invoke :sync_local_dirs_to_server
|
111
|
-
execute :systemctl, :restart, fetch(:application)
|
112
|
-
execute :systemctl, :restart, "#{fetch(:application)}_sidekiq"
|
113
|
-
execute :systemctl, :restart, :nginx
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
98
|
task :sync_local_dirs_to_server do
|
120
99
|
on roles(:all) do
|
121
100
|
fetch(:sync_dirs, []).each do |sync_dir|
|
@@ -129,8 +108,10 @@ end
|
|
129
108
|
task :sync_local_dirs_from_server do
|
130
109
|
on roles(:all) do
|
131
110
|
fetch(:sync_dirs, []).each do |sync_dir|
|
132
|
-
|
133
|
-
|
111
|
+
if test "[ -f #{fetch(:deploy_to)}//#{sync_dir} ]"
|
112
|
+
run_locally do
|
113
|
+
execute "rsync -avzm --delete --force -e ssh #{fetch(:user)}@#{fetch(:server)}:#{fetch(:deploy_to)}/#{sync_dir}/ ./#{sync_dir}/"
|
114
|
+
end
|
134
115
|
end
|
135
116
|
end
|
136
117
|
end
|
@@ -3,7 +3,7 @@ task :set_railman_env do
|
|
3
3
|
set :environment, { rails_env: 'production'}
|
4
4
|
set :chruby_prefix, "/usr/local/bin/chruby-exec #{fetch(:chruby_ruby)} -- RAILS_ENV=production "
|
5
5
|
|
6
|
-
SSHKit.config.command_map[:rake] = "#{fetch(:chruby_prefix)} #{fetch(:deploy_to)}/bin/rake"
|
6
|
+
SSHKit.config.command_map[:rake] = "#{fetch(:chruby_prefix)} DISABLE_DATABASE_ENVIRONMENT_CHECK=1 #{fetch(:deploy_to)}/bin/rake"
|
7
7
|
SSHKit.config.command_map[:bundle] = "#{fetch(:chruby_prefix)} #{fetch(:deploy_to)}/bin/bundle"
|
8
8
|
%w(systemctl certbot).each do |cmd|
|
9
9
|
SSHKit.config.command_map[cmd.to_sym] = "sudo #{cmd}"
|