capistrano-exfel 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -1
- data/Gemfile +1 -1
- data/README.md +7 -17
- data/capistrano-exfel-0.4.0.gem +0 -0
- data/capistrano-exfel.gemspec +14 -14
- data/lib/capistrano/exfel/version.rb +1 -1
- data/lib/capistrano/recipes/apache/app_ssl.conf +6 -2
- data/lib/capistrano/tasks/apache.rake +16 -146
- data/lib/capistrano/tasks/app_home.rake +15 -25
- data/lib/capistrano/tasks/application.rake +1 -0
- data/lib/capistrano/tasks/database.rake +3 -3
- data/lib/capistrano/tasks/secrets.rake +3 -3
- data/lib/capistrano/tasks/util.rake +1 -1
- metadata +9 -11
- data/lib/capistrano/recipes/apache/00-passenger.conf +0 -6
- data/lib/capistrano/recipes/apache/httpd.conf +0 -74
- data/lib/capistrano/recipes/apache/ssl.conf +0 -49
- /data/lib/capistrano/exfel/{co7.rb → ubuntu22.rb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: db4bdb4541437adbee7068c17988232ed83871f17ca7131eaa64e2371aeabdc3
|
|
4
|
+
data.tar.gz: c58b66065fc1232c637548ac8e982fdf159aa7a8de870a6b966d7b8add01b971
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8da33a59375c6545637eb879a71cc69e7c2dbb3bb6de605a3928cfa1873a8fa3273a4f6935e22db33dca108532cdd7a03112939670461cc7e4f5a1679d75ca29
|
|
7
|
+
data.tar.gz: 212dfe77a050b4967fe7460bf92fd14c81dfd38ee966cae3483394428a85cc8940b6c1438cb957205b70b362cd904b0ea1d2709ac61b519c690ee32bba156abd
|
data/.rubocop.yml
CHANGED
|
@@ -22,8 +22,12 @@ Style/Lambda:
|
|
|
22
22
|
#
|
|
23
23
|
# Block has too many lines.
|
|
24
24
|
Metrics/BlockLength:
|
|
25
|
-
Max:
|
|
25
|
+
Max: 200 # Default 25
|
|
26
26
|
|
|
27
27
|
# Use meaningful heredoc delimiters.
|
|
28
28
|
Naming/HeredocDelimiterNaming:
|
|
29
29
|
Enabled: false
|
|
30
|
+
|
|
31
|
+
# This gem doesn't need to be dependent on a specific Ruby version
|
|
32
|
+
RequiredRubyVersion:
|
|
33
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Capistrano::Exfel
|
|
2
2
|
|
|
3
3
|
Deploys Ruby on Rails Applications in EXFEL VMs using Capistrano3 throw username/password authentication.
|
|
4
|
-
The standard EXFEL VMs
|
|
4
|
+
The standard EXFEL VMs for web applications is Ubuntu 22 with Apache web server.
|
|
5
5
|
Installation of Phusion Passenger and RVM are also required to this gem.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
@@ -9,9 +9,9 @@ Installation of Phusion Passenger and RVM are also required to this gem.
|
|
|
9
9
|
Add these lines to your application's Gemfile:
|
|
10
10
|
|
|
11
11
|
# Use Capistrano for deployment
|
|
12
|
-
gem 'capistrano', '3.
|
|
13
|
-
gem 'capistrano-exfel', '0.
|
|
14
|
-
gem 'capistrano-rails', '1.
|
|
12
|
+
gem 'capistrano', '3.18.1', require: false
|
|
13
|
+
gem 'capistrano-exfel', '0.5.0', require: false
|
|
14
|
+
gem 'capistrano-rails', '1.6.3', require: false
|
|
15
15
|
gem 'capistrano-rvm', '0.1.2', require: false
|
|
16
16
|
|
|
17
17
|
|
|
@@ -28,20 +28,10 @@ $ gem install capistrano-exfel
|
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
31
|
-
Add this line to your `Capfile` for
|
|
32
|
-
|
|
33
|
-
# Load Capistrano Exfel Scientific Linux 6 tasks
|
|
34
|
-
require 'capistrano/exfel/sl6'
|
|
35
|
-
|
|
36
|
-
Add this line to your `Capfile` for CentOS 7 machines:
|
|
37
|
-
|
|
38
|
-
# Load Capistrano Exfel CentOS tasks
|
|
39
|
-
require 'capistrano/exfel/co7'
|
|
40
|
-
|
|
41
|
-
Add this line to your `Capfile` for Ubuntu 14 machines:
|
|
31
|
+
Add this line to your `Capfile` for Ubuntu 22 machines:
|
|
42
32
|
|
|
43
33
|
# Load Ubuntu 14 tasks
|
|
44
|
-
require 'capistrano/exfel/
|
|
34
|
+
require 'capistrano/exfel/ubuntu22'
|
|
45
35
|
|
|
46
36
|
|
|
47
37
|
This gem will reuse `capistrano-rails` and `capistrano-rvm` tasks to build the following tasks:
|
|
@@ -117,7 +107,7 @@ set :repo_url, 'exfl_git_server:/my_app_repo_path' # 'git@example.com:me/my_repo
|
|
|
117
107
|
|
|
118
108
|
# RVM related information
|
|
119
109
|
# set :rvm_type, :system
|
|
120
|
-
set :rvm_ruby_version, '
|
|
110
|
+
set :rvm_ruby_version, '3.1.3' # If not specified will ask for it
|
|
121
111
|
# set :rvm_roles, [:app, :web]
|
|
122
112
|
```
|
|
123
113
|
|
|
Binary file
|
data/capistrano-exfel.gemspec
CHANGED
|
@@ -5,21 +5,21 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
5
5
|
require 'capistrano/exfel/version'
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
|
-
spec.name
|
|
9
|
-
spec.version
|
|
10
|
-
spec.authors
|
|
11
|
-
spec.email
|
|
12
|
-
spec.summary
|
|
13
|
-
spec.description
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
spec.homepage
|
|
17
|
-
spec.license
|
|
8
|
+
spec.name = 'capistrano-exfel'
|
|
9
|
+
spec.version = Capistrano::Exfel::VERSION
|
|
10
|
+
spec.authors = ['Luis Maia', 'Maurizio Manetti']
|
|
11
|
+
spec.email = %w[luisgoncalo.maia@gmail.com maurizio.manetti@xfel.eu]
|
|
12
|
+
spec.summary = 'Deploy Ruby on Rails 4, 5, 6 and 7 Applications in EXFEL Virtual Machines'
|
|
13
|
+
spec.description = 'Deployment of Ruby on Rails Applications in EXFEL Virtual Machines ' \
|
|
14
|
+
'(CentOS 7 + Apache + RVM + Phusion Passenger) ' \
|
|
15
|
+
'using Capistrano3 and LDAP'
|
|
16
|
+
spec.homepage = 'https://github.com/luismaia/capistrano-exfel'
|
|
17
|
+
spec.license = 'MIT'
|
|
18
18
|
|
|
19
|
-
spec.files
|
|
20
|
-
spec.executables
|
|
21
|
-
spec.test_files
|
|
22
|
-
spec.require_paths
|
|
19
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
20
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
21
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
22
|
+
spec.require_paths = ['lib']
|
|
23
23
|
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
25
25
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
RackBaseURI /<<APPLICATION_NAME>>
|
|
12
12
|
RailsEnv <<ENVIRONMENT>>
|
|
13
13
|
|
|
14
|
-
PassengerUser
|
|
14
|
+
PassengerUser www-data
|
|
15
15
|
# CentOS: nobody / Ubuntu/Debian: nogroup
|
|
16
|
-
PassengerGroup
|
|
16
|
+
PassengerGroup nogroup
|
|
17
17
|
|
|
18
18
|
# which ruby version to use
|
|
19
19
|
PassengerRuby <<RUBY_PATH>>
|
|
@@ -22,4 +22,8 @@
|
|
|
22
22
|
Options -Indexes +MultiViews +FollowSymLinks
|
|
23
23
|
AllowOverride None
|
|
24
24
|
Require all granted
|
|
25
|
+
|
|
26
|
+
order allow,deny
|
|
27
|
+
allow from all
|
|
28
|
+
|
|
25
29
|
</Directory>
|
|
@@ -6,46 +6,26 @@ namespace :apache do
|
|
|
6
6
|
desc 'Configure Apache (httpd) and restart it'
|
|
7
7
|
task :configure_and_start do
|
|
8
8
|
invoke 'apache:configure'
|
|
9
|
-
invoke 'apache:chkconfig_on' # This task should go to Puppet or installation script
|
|
10
|
-
invoke 'apache:replace_apache_defaults' # This task should go to Puppet or installation script
|
|
11
9
|
invoke 'apache:create_symbolic_link'
|
|
12
10
|
end
|
|
13
11
|
|
|
14
|
-
# This task should be moved into Puppet or the installation script
|
|
15
|
-
desc 'Configure Apache to start at bootup'
|
|
16
|
-
task :chkconfig_on do
|
|
17
|
-
on roles(:web) do
|
|
18
|
-
info 'In task apache:chkconfig_on'
|
|
19
|
-
|
|
20
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
21
|
-
|
|
22
|
-
debug '#' * 50
|
|
23
|
-
|
|
24
|
-
debug 'chkconfig httpd on'
|
|
25
|
-
execute "#{sudo_cmd} chkconfig httpd on"
|
|
26
|
-
|
|
27
|
-
info 'Configured Apache to start at bootup'
|
|
28
|
-
debug '#' * 50
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
12
|
desc 'Restart Apache (httpd) service'
|
|
33
13
|
task :restart do
|
|
34
14
|
on roles(:web) do
|
|
35
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
15
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
36
16
|
|
|
37
17
|
debug '#' * 50
|
|
38
18
|
|
|
39
|
-
debug '
|
|
40
|
-
execute "#{sudo_cmd}
|
|
19
|
+
debug 'systemctl stop apache2'
|
|
20
|
+
execute "#{sudo_cmd} systemctl stop apache2"
|
|
41
21
|
|
|
42
|
-
debug 'pkill -9
|
|
43
|
-
execute "#{sudo_cmd} pkill -9
|
|
22
|
+
debug 'pkill -9 apache2 || true'
|
|
23
|
+
execute "#{sudo_cmd} pkill -9 apache2 || true"
|
|
44
24
|
|
|
45
|
-
debug '
|
|
46
|
-
execute "#{sudo_cmd}
|
|
25
|
+
debug 'systemctl start apache2'
|
|
26
|
+
execute "#{sudo_cmd} systemctl start apache2"
|
|
47
27
|
|
|
48
|
-
info 'Restarted Apache (
|
|
28
|
+
info 'Restarted Apache (apache2) service'
|
|
49
29
|
debug '#' * 50
|
|
50
30
|
end
|
|
51
31
|
end
|
|
@@ -53,74 +33,13 @@ namespace :apache do
|
|
|
53
33
|
desc 'Configure Apache configuration files'
|
|
54
34
|
task :configure do
|
|
55
35
|
invoke 'apache:create_apache_shared_folder'
|
|
56
|
-
invoke 'apache:create_apache_sites_folder'
|
|
57
|
-
invoke 'apache:configure_apache_modules'
|
|
58
36
|
invoke 'apache:configure_app_ssl_conf_file'
|
|
59
37
|
end
|
|
60
38
|
|
|
61
|
-
# This task should be moved into Puppet or the installation script
|
|
62
|
-
desc 'Create Apache multi-site configuration folder'
|
|
63
|
-
task :create_apache_sites_folder do
|
|
64
|
-
on roles(:app) do
|
|
65
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
66
|
-
|
|
67
|
-
debug '#' * 50
|
|
68
|
-
debug 'Create Apache multi-site configuration folder'
|
|
69
|
-
|
|
70
|
-
debug 'mkdir -p /etc/httpd/sites.d'
|
|
71
|
-
execute "#{sudo_cmd} mkdir -p /etc/httpd/sites.d"
|
|
72
|
-
|
|
73
|
-
debug '#' * 50
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
# This task should be moved into Puppet or the installation script
|
|
78
|
-
desc 'Configure Apache modules'
|
|
79
|
-
task :configure_apache_modules do
|
|
80
|
-
on roles(:app) do
|
|
81
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
82
|
-
|
|
83
|
-
debug '#' * 50
|
|
84
|
-
debug 'Configure (HTTP) Apache Passenger module'
|
|
85
|
-
|
|
86
|
-
set :shared_passenger_file, '/etc/httpd/conf.modules.d/00-passenger.conf'
|
|
87
|
-
passenger_file = File.expand_path('../recipes/apache/00-passenger.conf', __dir__)
|
|
88
|
-
|
|
89
|
-
# Create a temporary copy of the passenger module file
|
|
90
|
-
set :tmp_passenger_file, '/tmp/00-passenger.conf'
|
|
91
|
-
|
|
92
|
-
upload! StringIO.new(File.read(passenger_file)), fetch(:tmp_passenger_file).to_s
|
|
93
|
-
|
|
94
|
-
passenger_root = get_command_output("/usr/local/rvm/bin/rvm #{fetch(:rvm_ruby_version)} do passenger-config --root")
|
|
95
|
-
ruby_path = "/#{passenger_root.split('/')[1..5].join('/')}/wrappers/ruby"
|
|
96
|
-
|
|
97
|
-
debug "sed -i 's|<<PASSENGER_ROOT>>|#{passenger_root}|g' #{fetch(:tmp_passenger_file)}"
|
|
98
|
-
execute "sed -i 's|<<PASSENGER_ROOT>>|#{passenger_root}|g' #{fetch(:tmp_passenger_file)}"
|
|
99
|
-
execute "sed -i 's|<<RUBY_PATH>>|#{ruby_path}|g' #{fetch(:tmp_passenger_file)}"
|
|
100
|
-
|
|
101
|
-
# Replace the passenger module file
|
|
102
|
-
execute "#{sudo_cmd} mv -f #{fetch(:tmp_passenger_file)} #{fetch(:shared_passenger_file)}"
|
|
103
|
-
execute "#{sudo_cmd} chown root.root #{fetch(:shared_passenger_file)}"
|
|
104
|
-
|
|
105
|
-
debug '#' * 50
|
|
106
|
-
debug 'Deactivate unnecessary Apache modules'
|
|
107
|
-
%w[00-dav.conf 00-lua.conf 00-proxy.conf 01-cgi.conf].each do |file|
|
|
108
|
-
if remote_file_exists?("/etc/httpd/conf.modules.d/#{file}")
|
|
109
|
-
# only perform backup of Apache modules files unless already done
|
|
110
|
-
unless remote_file_exists?("/etc/httpd/conf.modules.d/#{file}_bck")
|
|
111
|
-
execute "#{sudo_cmd} cp /etc/httpd/conf.modules.d/#{file} /etc/httpd/conf.modules.d/#{file}_bck"
|
|
112
|
-
end
|
|
113
|
-
execute "#{sudo_cmd} truncate -s 0 /etc/httpd/conf.modules.d/#{file}"
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
debug '#' * 50
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
|
|
120
39
|
desc 'Configure (HTTPS) Apache Application configuration files'
|
|
121
40
|
task :configure_app_ssl_conf_file do
|
|
122
41
|
on roles(:app), in: :sequence do
|
|
123
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
42
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
124
43
|
|
|
125
44
|
debug '#' * 50
|
|
126
45
|
debug 'Configure (HTTPS) Apache Application configuration files'
|
|
@@ -132,68 +51,19 @@ namespace :apache do
|
|
|
132
51
|
debug "chmod g+w #{fetch(:shared_apache_conf_ssl_file)}"
|
|
133
52
|
execute "chmod g+w #{fetch(:shared_apache_conf_ssl_file)}"
|
|
134
53
|
|
|
135
|
-
|
|
136
|
-
ruby_path = "/#{passenger_root.split('/')[1..5].join('/')}/wrappers/ruby"
|
|
54
|
+
ruby_path = get_command_output("/usr/local/rvm/bin/rvm #{fetch(:rvm_ruby_version)} do which ruby")
|
|
137
55
|
|
|
138
56
|
execute "sed -i 's/<<APPLICATION_NAME>>/#{fetch(:app_name_uri)}/g' #{fetch(:shared_apache_conf_ssl_file)}"
|
|
139
57
|
execute "sed -i 's/<<ENVIRONMENT>>/#{fetch(:environment)}/g' #{fetch(:shared_apache_conf_ssl_file)}"
|
|
140
58
|
execute "sed -i 's|<<RUBY_PATH>>|#{ruby_path}|g' #{fetch(:shared_apache_conf_ssl_file)}"
|
|
141
59
|
|
|
142
|
-
execute "#{sudo_cmd} ln -sfn #{fetch(:shared_apache_conf_ssl_file)} /etc/
|
|
60
|
+
execute "#{sudo_cmd} ln -sfn #{fetch(:shared_apache_conf_ssl_file)} /etc/apache2/sites-available/"
|
|
61
|
+
execute "#{sudo_cmd} a2ensite `basename #{fetch(:shared_apache_conf_ssl_file)} .conf`"
|
|
143
62
|
|
|
144
63
|
debug '#' * 50
|
|
145
64
|
end
|
|
146
65
|
end
|
|
147
66
|
|
|
148
|
-
# This task should be moved into Puppet or the installation script
|
|
149
|
-
desc 'Replace CentOS 7 default httpd.conf and ssl.conf file with our version'
|
|
150
|
-
task :replace_apache_defaults do
|
|
151
|
-
on roles(:web) do
|
|
152
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
153
|
-
|
|
154
|
-
debug '#' * 50
|
|
155
|
-
debug 'Update httpd.conf and ssl.conf'
|
|
156
|
-
|
|
157
|
-
set :httpd_conf_file, '/etc/httpd/conf/httpd.conf'
|
|
158
|
-
|
|
159
|
-
# Replace the original Apache configuration file
|
|
160
|
-
if remote_file_exists?('/etc/httpd/conf/httpd.conf_bck')
|
|
161
|
-
info 'Apache original configuration file already backed up at: /etc/httpd/conf/httpd.conf_bck'
|
|
162
|
-
else
|
|
163
|
-
execute "#{sudo_cmd} cp -f #{fetch(:httpd_conf_file)} /etc/httpd/conf/httpd.conf_bck"
|
|
164
|
-
info 'Apache original configuration file backed up at: /etc/httpd/conf/httpd.conf_bck'
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
# Create a temporary copy of the Apache configuration file
|
|
168
|
-
set :tmp_httpd_file, '/tmp/httpd.conf'
|
|
169
|
-
httpd_safe_file = File.expand_path('../recipes/apache/httpd.conf', __dir__)
|
|
170
|
-
|
|
171
|
-
upload! StringIO.new(File.read(httpd_safe_file)), fetch(:tmp_httpd_file).to_s
|
|
172
|
-
|
|
173
|
-
# Replace the original Apache configuration file
|
|
174
|
-
execute "#{sudo_cmd} mv -f #{fetch(:tmp_httpd_file)} #{fetch(:httpd_conf_file)}"
|
|
175
|
-
|
|
176
|
-
set :ssl_conf_file, '/etc/httpd/conf.d/ssl.conf'
|
|
177
|
-
|
|
178
|
-
# Replace the original Apache ssl configuration file
|
|
179
|
-
if remote_file_exists?('/etc/httpd/conf.d/ssl.conf_bck')
|
|
180
|
-
info 'Apache original ssl configuration file already backed up at: /etc/httpd/conf.d/ssl.conf_bck'
|
|
181
|
-
else
|
|
182
|
-
execute "#{sudo_cmd} cp -f #{fetch(:ssl_conf_file)} /etc/httpd/conf.d/ssl.conf_bck"
|
|
183
|
-
info 'Apache original ssl configuration file backed up at: /etc/httpd/conf.d/ssl.conf_bck'
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
# Create a temporary copy of the Apache ssl configuration file
|
|
187
|
-
set :tmp_ssl_file, '/tmp/ssl.conf'
|
|
188
|
-
ssl_safe_file = File.expand_path('../recipes/apache/ssl.conf', __dir__)
|
|
189
|
-
|
|
190
|
-
upload! StringIO.new(File.read(ssl_safe_file)), fetch(:tmp_ssl_file).to_s
|
|
191
|
-
|
|
192
|
-
# Replace the original Apache ssl configuration file
|
|
193
|
-
execute "#{sudo_cmd} mv -f #{fetch(:tmp_ssl_file)} #{fetch(:ssl_conf_file)}"
|
|
194
|
-
end
|
|
195
|
-
end
|
|
196
|
-
|
|
197
67
|
desc 'Check that the user has write permissions in the Deploy and in Apache DocumentRoot folders'
|
|
198
68
|
task :check_write_permissions do
|
|
199
69
|
invoke 'apache:check_write_permissions_on_deploy'
|
|
@@ -204,8 +74,8 @@ namespace :apache do
|
|
|
204
74
|
task :check_write_permissions_on_deploy do
|
|
205
75
|
on roles(:app), in: :sequence do |host|
|
|
206
76
|
debug '#' * 50
|
|
207
|
-
debug "Checking folder '#{fetch(:deploy_to)}' (where the application has to be deployed) "\
|
|
208
|
-
|
|
77
|
+
debug "Checking folder '#{fetch(:deploy_to)}' (where the application has to be deployed) " \
|
|
78
|
+
"for the right permissions on Host '#{host}'"
|
|
209
79
|
|
|
210
80
|
if test("[ -w #{fetch(:deploy_to)} ]")
|
|
211
81
|
info "#{fetch(:deploy_to)} is writable on #{host}"
|
|
@@ -236,7 +106,7 @@ namespace :apache do
|
|
|
236
106
|
desc 'Create Apache configuration files shared folder'
|
|
237
107
|
task :create_apache_shared_folder do
|
|
238
108
|
on roles(:app) do
|
|
239
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
109
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
240
110
|
|
|
241
111
|
debug '#' * 50
|
|
242
112
|
debug 'Create Apache configuration files shared folder'
|
|
@@ -254,7 +124,7 @@ namespace :apache do
|
|
|
254
124
|
desc 'Create symbolic link to application public folder in Apache DocumentRoot folder'
|
|
255
125
|
task :create_symbolic_link do
|
|
256
126
|
on roles(:web), in: :sequence do
|
|
257
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
127
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
258
128
|
|
|
259
129
|
info '#' * 50
|
|
260
130
|
info 'Creating application symbolic link'
|
|
@@ -11,7 +11,7 @@ namespace :app_home do
|
|
|
11
11
|
desc 'Create application deploy folders on server and give it the correct permissions'
|
|
12
12
|
task :create_deploy_folder do
|
|
13
13
|
on roles(:app), in: :sequence do
|
|
14
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
14
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
15
15
|
|
|
16
16
|
debug '#' * 50
|
|
17
17
|
|
|
@@ -31,7 +31,7 @@ namespace :app_home do
|
|
|
31
31
|
desc 'Create shared folder on server DEPLOY folder and give it the correct permissions'
|
|
32
32
|
task :create_shared_folder do
|
|
33
33
|
on roles(:app), in: :sequence do
|
|
34
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
34
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
35
35
|
|
|
36
36
|
debug '#' * 50
|
|
37
37
|
|
|
@@ -74,17 +74,17 @@ namespace :app_home do
|
|
|
74
74
|
task :correct_shared_permissions do
|
|
75
75
|
on roles(:app), in: :sequence do
|
|
76
76
|
within release_path do
|
|
77
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
77
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
78
78
|
|
|
79
79
|
debug '#' * 50
|
|
80
80
|
|
|
81
81
|
# Needs access to the folder due to the first write and log rotation
|
|
82
|
-
debug "chown -R
|
|
83
|
-
execute "#{sudo_cmd} chown -R
|
|
82
|
+
debug "chown -R #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{fetch(:shared_path)}/log"
|
|
83
|
+
execute "#{sudo_cmd} chown -R #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{fetch(:shared_path)}/log"
|
|
84
84
|
|
|
85
85
|
# Needs write permissions
|
|
86
|
-
debug "chown -R
|
|
87
|
-
execute "#{sudo_cmd} chown -R
|
|
86
|
+
debug "chown -R #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{fetch(:shared_path)}/tmp/"
|
|
87
|
+
execute "#{sudo_cmd} chown -R #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{fetch(:shared_path)}/tmp/"
|
|
88
88
|
|
|
89
89
|
# Since the cache is local to any App installation it's necessary to update permissions
|
|
90
90
|
app_cache_folder = release_path.join('tmp/cache')
|
|
@@ -93,9 +93,9 @@ namespace :app_home do
|
|
|
93
93
|
debug "mkdir -p #{app_cache_folder}"
|
|
94
94
|
execute "#{sudo_cmd} mkdir -p #{app_cache_folder}"
|
|
95
95
|
|
|
96
|
-
# Phusion Passenger (
|
|
97
|
-
debug "chown -R
|
|
98
|
-
execute "#{sudo_cmd} chown -R
|
|
96
|
+
# Phusion Passenger (respective user) needs write permissions to cache folder
|
|
97
|
+
debug "chown -R #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{app_cache_folder}"
|
|
98
|
+
execute "#{sudo_cmd} chown -R #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{app_cache_folder}"
|
|
99
99
|
|
|
100
100
|
# Give write permissions to groups
|
|
101
101
|
debug "chmod g+ws #{app_cache_folder}"
|
|
@@ -110,13 +110,13 @@ namespace :app_home do
|
|
|
110
110
|
task :correct_public_folder_permissions do
|
|
111
111
|
on roles(:app) do
|
|
112
112
|
within release_path do
|
|
113
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
113
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
114
114
|
|
|
115
115
|
debug '#' * 50
|
|
116
116
|
set :public_folder_path, "#{release_path}/public"
|
|
117
117
|
|
|
118
118
|
debug '#' * 50
|
|
119
|
-
chown_command = "chown -Rf
|
|
119
|
+
chown_command = "chown -Rf #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{fetch(:public_folder_path)}/*"
|
|
120
120
|
debug chown_command
|
|
121
121
|
execute "#{sudo_cmd} #{chown_command}"
|
|
122
122
|
|
|
@@ -147,7 +147,7 @@ namespace :app_home do
|
|
|
147
147
|
task :deploy_first_time_start_msg do
|
|
148
148
|
on roles(:msg) do
|
|
149
149
|
info '#' * 100
|
|
150
|
-
info '#' * 10
|
|
150
|
+
info "#{'#' * 10} => Start Application first time deployment..."
|
|
151
151
|
info '#' * 100
|
|
152
152
|
end
|
|
153
153
|
end
|
|
@@ -155,7 +155,7 @@ namespace :app_home do
|
|
|
155
155
|
task :deploy_start_msg do
|
|
156
156
|
on roles(:msg) do
|
|
157
157
|
info '#' * 100
|
|
158
|
-
info '#' * 10
|
|
158
|
+
info "#{'#' * 10} => Start Application re-deployment..."
|
|
159
159
|
info '#' * 100
|
|
160
160
|
end
|
|
161
161
|
end
|
|
@@ -163,21 +163,11 @@ namespace :app_home do
|
|
|
163
163
|
task :deploy_success_msg do
|
|
164
164
|
on roles(:msg) do
|
|
165
165
|
info '#' * 100
|
|
166
|
-
info '#' * 10
|
|
166
|
+
info "#{'#' * 10} => Application Successfully deployed..."
|
|
167
167
|
info '#' * 100
|
|
168
168
|
info '#' * 10 + " => visit: #{fetch(:app_domain)}#{fetch(:app_name_uri)}"
|
|
169
169
|
info '#' * 100
|
|
170
170
|
end
|
|
171
171
|
end
|
|
172
172
|
|
|
173
|
-
###
|
|
174
|
-
# This task doesn't look to be working:
|
|
175
|
-
# desc 'Restart application'
|
|
176
|
-
###
|
|
177
|
-
task :restart do
|
|
178
|
-
on roles(:app) do
|
|
179
|
-
info '#' * 10 + ' Touching restart.txt...'
|
|
180
|
-
execute :touch, release_path.join('tmp/restart.txt')
|
|
181
|
-
end
|
|
182
|
-
end
|
|
183
173
|
end
|
|
@@ -56,7 +56,7 @@ namespace :database do
|
|
|
56
56
|
# desc 'Correct database.yml file permissions before change the file'
|
|
57
57
|
task :set_permissions_pre_update do
|
|
58
58
|
on roles(:app) do
|
|
59
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
59
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
60
60
|
|
|
61
61
|
debug '#' * 50
|
|
62
62
|
|
|
@@ -71,12 +71,12 @@ namespace :database do
|
|
|
71
71
|
# desc 'Correct database.yml file permissions after change the file'
|
|
72
72
|
task :set_permissions_post_update do
|
|
73
73
|
on roles(:app) do
|
|
74
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
74
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
75
75
|
|
|
76
76
|
debug '#' * 50
|
|
77
77
|
|
|
78
78
|
# Update database.yml user and group owners
|
|
79
|
-
chown_command = "chown
|
|
79
|
+
chown_command = "chown #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{fetch(:database_file_path)}"
|
|
80
80
|
debug chown_command
|
|
81
81
|
execute "#{sudo_cmd} #{chown_command}"
|
|
82
82
|
|
|
@@ -75,7 +75,7 @@ namespace :secrets do
|
|
|
75
75
|
# desc 'Correct secrets.yml file permissions before change the file'
|
|
76
76
|
task :set_permissions_pre_update do
|
|
77
77
|
on roles(:app) do
|
|
78
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
78
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
79
79
|
|
|
80
80
|
debug '#' * 50
|
|
81
81
|
|
|
@@ -90,12 +90,12 @@ namespace :secrets do
|
|
|
90
90
|
# desc 'Correct secrets.yml file permissions after change the file'
|
|
91
91
|
task :set_permissions_post_update do
|
|
92
92
|
on roles(:app) do
|
|
93
|
-
sudo_cmd = "echo #{fetch(:password)} | sudo -S"
|
|
93
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
|
94
94
|
|
|
95
95
|
debug '#' * 50
|
|
96
96
|
|
|
97
97
|
# Update database.yml user and group owners
|
|
98
|
-
chown_command = "chown
|
|
98
|
+
chown_command = "chown #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{fetch(:secrets_file_path)}"
|
|
99
99
|
debug chown_command
|
|
100
100
|
execute "#{sudo_cmd} #{chown_command}"
|
|
101
101
|
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano-exfel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Luis Maia
|
|
8
8
|
- Maurizio Manetti
|
|
9
|
-
autorequire:
|
|
9
|
+
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2024-06-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -54,16 +54,14 @@ files:
|
|
|
54
54
|
- LICENSE.txt
|
|
55
55
|
- README.md
|
|
56
56
|
- Rakefile
|
|
57
|
+
- capistrano-exfel-0.4.0.gem
|
|
57
58
|
- capistrano-exfel.gemspec
|
|
58
59
|
- capistrano.graph
|
|
59
60
|
- capistrano.png
|
|
60
61
|
- lib/capistrano/exfel.rb
|
|
61
|
-
- lib/capistrano/exfel/
|
|
62
|
+
- lib/capistrano/exfel/ubuntu22.rb
|
|
62
63
|
- lib/capistrano/exfel/version.rb
|
|
63
|
-
- lib/capistrano/recipes/apache/00-passenger.conf
|
|
64
64
|
- lib/capistrano/recipes/apache/app_ssl.conf
|
|
65
|
-
- lib/capistrano/recipes/apache/httpd.conf
|
|
66
|
-
- lib/capistrano/recipes/apache/ssl.conf
|
|
67
65
|
- lib/capistrano/recipes/config/database_mysql.yml
|
|
68
66
|
- lib/capistrano/recipes/config/database_postgresql.yml
|
|
69
67
|
- lib/capistrano/recipes/config/database_sqlite.yml
|
|
@@ -79,7 +77,7 @@ homepage: https://github.com/luismaia/capistrano-exfel
|
|
|
79
77
|
licenses:
|
|
80
78
|
- MIT
|
|
81
79
|
metadata: {}
|
|
82
|
-
post_install_message:
|
|
80
|
+
post_install_message:
|
|
83
81
|
rdoc_options: []
|
|
84
82
|
require_paths:
|
|
85
83
|
- lib
|
|
@@ -94,8 +92,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
94
92
|
- !ruby/object:Gem::Version
|
|
95
93
|
version: '0'
|
|
96
94
|
requirements: []
|
|
97
|
-
rubygems_version: 3.
|
|
98
|
-
signing_key:
|
|
95
|
+
rubygems_version: 3.5.7
|
|
96
|
+
signing_key:
|
|
99
97
|
specification_version: 4
|
|
100
|
-
summary: Deploy Ruby on Rails 4 and
|
|
98
|
+
summary: Deploy Ruby on Rails 4, 5, 6 and 7 Applications in EXFEL Virtual Machines
|
|
101
99
|
test_files: []
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
ServerRoot "/etc/httpd"
|
|
3
|
-
Listen 80
|
|
4
|
-
|
|
5
|
-
Include conf.modules.d/*.conf
|
|
6
|
-
|
|
7
|
-
User apache
|
|
8
|
-
Group apache
|
|
9
|
-
|
|
10
|
-
ServerAdmin root@localhost
|
|
11
|
-
ServerSignature Off
|
|
12
|
-
ServerTokens Prod
|
|
13
|
-
|
|
14
|
-
<Directory />
|
|
15
|
-
AllowOverride none
|
|
16
|
-
Require all denied
|
|
17
|
-
</Directory>
|
|
18
|
-
|
|
19
|
-
DocumentRoot "/var/www/html"
|
|
20
|
-
|
|
21
|
-
<Directory "/var/www">
|
|
22
|
-
AllowOverride None
|
|
23
|
-
Require all granted
|
|
24
|
-
</Directory>
|
|
25
|
-
|
|
26
|
-
<Directory "/var/www/html">
|
|
27
|
-
Options Indexes FollowSymLinks
|
|
28
|
-
AllowOverride None
|
|
29
|
-
Require all granted
|
|
30
|
-
|
|
31
|
-
# Redirect all HTTP to https://%{SERVER_NAME}/, keeping the requested path
|
|
32
|
-
RewriteEngine On
|
|
33
|
-
RewriteCond %{HTTPS} !=on
|
|
34
|
-
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
|
|
35
|
-
|
|
36
|
-
</Directory>
|
|
37
|
-
|
|
38
|
-
<IfModule dir_module>
|
|
39
|
-
DirectoryIndex index.html
|
|
40
|
-
</IfModule>
|
|
41
|
-
|
|
42
|
-
<Files ".ht*">
|
|
43
|
-
Require all denied
|
|
44
|
-
</Files>
|
|
45
|
-
|
|
46
|
-
ErrorLog "logs/error_log"
|
|
47
|
-
|
|
48
|
-
LogLevel warn
|
|
49
|
-
|
|
50
|
-
<IfModule log_config_module>
|
|
51
|
-
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
|
52
|
-
LogFormat "%h %l %u %t \"%r\" %>s %b" common
|
|
53
|
-
<IfModule logio_module>
|
|
54
|
-
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
|
|
55
|
-
</IfModule>
|
|
56
|
-
CustomLog "logs/access_log" combined
|
|
57
|
-
</IfModule>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<IfModule mime_module>
|
|
61
|
-
TypesConfig /etc/mime.types
|
|
62
|
-
AddType application/x-compress .Z
|
|
63
|
-
AddType application/x-gzip .gz .tgz
|
|
64
|
-
</IfModule>
|
|
65
|
-
|
|
66
|
-
AddDefaultCharset UTF-8
|
|
67
|
-
|
|
68
|
-
<IfModule mime_magic_module>
|
|
69
|
-
MIMEMagicFile conf/magic
|
|
70
|
-
</IfModule>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
EnableSendfile on
|
|
74
|
-
IncludeOptional conf.d/*.conf
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
Listen 443 https
|
|
2
|
-
|
|
3
|
-
SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog
|
|
4
|
-
|
|
5
|
-
SSLSessionCache shmcb:/run/httpd/sslcache(512000)
|
|
6
|
-
SSLSessionCacheTimeout 300
|
|
7
|
-
|
|
8
|
-
SSLRandomSeed startup file:/dev/urandom 256
|
|
9
|
-
SSLRandomSeed connect builtin
|
|
10
|
-
|
|
11
|
-
SSLCryptoDevice builtin
|
|
12
|
-
|
|
13
|
-
##
|
|
14
|
-
## SSL Virtual Host Context
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
<VirtualHost _default_:443>
|
|
18
|
-
|
|
19
|
-
ErrorLog logs/ssl_error_log
|
|
20
|
-
LogLevel warn
|
|
21
|
-
|
|
22
|
-
SSLEngine on
|
|
23
|
-
|
|
24
|
-
SSLProtocol all -SSLv2 -SSLv3
|
|
25
|
-
|
|
26
|
-
SSLCipherSuite HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA
|
|
27
|
-
|
|
28
|
-
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
|
|
29
|
-
|
|
30
|
-
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
|
|
31
|
-
|
|
32
|
-
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
|
|
33
|
-
SSLOptions +StdEnvVars
|
|
34
|
-
</Files>
|
|
35
|
-
<Directory "/var/www/cgi-bin">
|
|
36
|
-
SSLOptions +StdEnvVars
|
|
37
|
-
</Directory>
|
|
38
|
-
|
|
39
|
-
BrowserMatch "MSIE [2-5]" \
|
|
40
|
-
nokeepalive ssl-unclean-shutdown \
|
|
41
|
-
downgrade-1.0 force-response-1.0
|
|
42
|
-
|
|
43
|
-
RemoteIPHeader X-Forwarded-For
|
|
44
|
-
LogFormat "%t - %a - %s - %{Host}i - \"%r\" \"%{Referer}i\" \"%{User-agent}i\" %D" xfel
|
|
45
|
-
CustomLog logs/ssl_access_log xfel
|
|
46
|
-
|
|
47
|
-
IncludeOptional sites.d/*.conf
|
|
48
|
-
|
|
49
|
-
</VirtualHost>
|
|
File without changes
|