capistrano-exfel 0.5.1 → 0.6.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/Gemfile +1 -1
- data/README.md +24 -10
- data/capistrano-exfel.gemspec +4 -3
- data/lib/capistrano/exfel/ubuntu22.rb +1 -1
- data/lib/capistrano/exfel/version.rb +1 -1
- data/lib/capistrano/recipes/config/.env.example +1 -0
- data/lib/capistrano/recipes/config/local.yml +16 -0
- data/lib/capistrano/tasks/application.rake +3 -3
- data/lib/capistrano/tasks/config.rake +117 -0
- metadata +10 -13
- data/capistrano-exfel.gem +0 -0
- data/lib/capistrano/recipes/config/secrets_example.yml +0 -115
- data/lib/capistrano/tasks/secrets.rake +0 -109
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b925c2c72a60f707c57e1a66498d002e195efb763b236d3abd78a9758bbc55e1
|
4
|
+
data.tar.gz: 177b21eaae35e49cecd409d30689297424e8fa4bca973258a6920076a2d996fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 137afb3c169d97bc7379291d1b35dd1cef430ef5c6bd7c8e3cd99d727d1022b006a1537ebdbf2f3bdeced227df99d1f36b1faac22a11f264958e19f5ed2315bf
|
7
|
+
data.tar.gz: 169da8972bcbde299fa4d6e66feb483e5d4b3e550ab7a769b6d913f411aa8501368065b8ac8e8474d74ee2935f4d77a1d57ee384aee3197092f9f2f9da955fba
|
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 EuXFEL VMs using Capistrano3 throw username/password authentication.
|
4
|
-
The standard EuXFEL VMs for web applications is Ubuntu 22 with Apache web server.
|
4
|
+
The standard EuXFEL VMs for web applications is Ubuntu 22.04 with Apache web server.
|
5
5
|
Installation of Phusion Passenger and RVM are also required to this gem.
|
6
6
|
|
7
7
|
## Installation
|
@@ -28,9 +28,9 @@ $ gem install capistrano-exfel
|
|
28
28
|
|
29
29
|
## Usage
|
30
30
|
|
31
|
-
Add this line to your `Capfile` for Ubuntu 22 machines:
|
31
|
+
Add this line to your `Capfile` for Ubuntu 22.04 machines:
|
32
32
|
|
33
|
-
# Load Ubuntu
|
33
|
+
# Load Ubuntu 22.04 tasks
|
34
34
|
require 'capistrano/exfel/ubuntu22'
|
35
35
|
|
36
36
|
This gem will reuse `capistrano-rails` and `capistrano-rvm` tasks to build the following tasks:
|
@@ -92,22 +92,36 @@ set :repo_url, 'exfl_git_server:/my_app_repo_path' # 'git@example.com:me/my_repo
|
|
92
92
|
# Default value for :format is :pretty
|
93
93
|
# set :format, :pretty
|
94
94
|
|
95
|
-
# Default value for :log_level is :
|
96
|
-
# set :log_level, :
|
95
|
+
# Default value for :log_level is :info
|
96
|
+
# set :log_level, :debug
|
97
97
|
|
98
98
|
# Default value for :linked_files is []
|
99
|
-
# set :linked_files, %w(config/database.yml
|
99
|
+
# set :linked_files, %w(config/database.yml)
|
100
100
|
|
101
|
-
#
|
102
|
-
|
101
|
+
# Define value for linked_dirs
|
102
|
+
append :linked_dirs, 'log', 'files',
|
103
|
+
'tmp/pids', 'tmp/cache', 'tmp/sockets',
|
104
|
+
'vendor/bundle', '.bundle',
|
105
|
+
'public/system', 'public/uploads'
|
106
|
+
# append :linked_files, 'config/database.yml', 'config/secrets.yml'
|
103
107
|
|
104
108
|
# Default value for keep_releases is 5
|
105
109
|
# set :keep_releases, 5
|
106
110
|
|
107
111
|
# RVM related information
|
108
|
-
|
109
|
-
set :rvm_ruby_version, '3.
|
112
|
+
set :rvm_type, :system
|
113
|
+
set :rvm_ruby_version, '3.3.0' # If not specified will ask for it
|
110
114
|
# set :rvm_roles, [:app, :web]
|
115
|
+
# set :rvm_custom_path, '~/.myveryownrvm' # only needed if not detected
|
116
|
+
|
117
|
+
# Default value for default_env is {}
|
118
|
+
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
|
119
|
+
# set :default_env, { rvm_bin_path: '/usr/local/rvm/bin'}
|
120
|
+
|
121
|
+
# Defaults to nil (no asset cleanup is performed)
|
122
|
+
# If you use Rails 4+ and you'd like to clean up old assets after each deploy,
|
123
|
+
# set this to the number of versions to keep
|
124
|
+
set :keep_assets, 5
|
111
125
|
```
|
112
126
|
|
113
127
|
As an example, to configure GIT plugin, add the following to the Capfile:
|
data/capistrano-exfel.gemspec
CHANGED
@@ -9,10 +9,9 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.version = Capistrano::Exfel::VERSION
|
10
10
|
spec.authors = ['Luis Maia', 'Maurizio Manetti']
|
11
11
|
spec.email = %w[luisgoncalo.maia@gmail.com maurizio.manetti@xfel.eu]
|
12
|
-
spec.summary = 'Deploy Ruby on Rails 4, 5, 6 and
|
12
|
+
spec.summary = 'Deploy Ruby on Rails 4, 5, 6, 7 and 8 Applications in EuXFEL Virtual Machines'
|
13
13
|
spec.description = 'Deployment of Ruby on Rails Applications in EuXFEL Virtual Machines ' \
|
14
|
-
'(Ubuntu 22.04 + Apache + RVM + Phusion Passenger) '
|
15
|
-
'using Capistrano3 and LDAP'
|
14
|
+
'(Ubuntu 22.04 + Apache + RVM + Phusion Passenger) '
|
16
15
|
spec.homepage = 'https://github.com/luismaia/capistrano-exfel'
|
17
16
|
spec.license = 'MIT'
|
18
17
|
|
@@ -20,6 +19,8 @@ Gem::Specification.new do |spec|
|
|
20
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
21
|
spec.require_paths = ['lib']
|
22
|
+
spec.platform = 'ruby'
|
23
|
+
spec.required_ruby_version = '>= 3.0'
|
23
24
|
|
24
25
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
25
26
|
spec.add_development_dependency 'rake', '~> 13.0'
|
@@ -17,5 +17,5 @@ load File.expand_path('../tasks/app_home.rake', __dir__)
|
|
17
17
|
load File.expand_path('../tasks/assets.rake', __dir__)
|
18
18
|
load File.expand_path('../tasks/application.rake', __dir__)
|
19
19
|
load File.expand_path('../tasks/database.rake', __dir__)
|
20
|
-
load File.expand_path('../tasks/
|
20
|
+
load File.expand_path('../tasks/config.rake', __dir__)
|
21
21
|
load File.expand_path('../tasks/util.rake', __dir__)
|
@@ -0,0 +1 @@
|
|
1
|
+
SECRET_KEY_BASE=___secret_that_must_be_replaced_after_deploy___
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# local configuration to override config.yml
|
2
|
+
|
3
|
+
development:
|
4
|
+
|
5
|
+
# put here any override or subkey addition for development environment
|
6
|
+
# e.g. for local development
|
7
|
+
|
8
|
+
test:
|
9
|
+
|
10
|
+
# put here any override or subkey addition for test environment
|
11
|
+
# e.g. for running rspec locally
|
12
|
+
|
13
|
+
production:
|
14
|
+
|
15
|
+
# put here any override or subkey addition for production environment
|
16
|
+
# e.g. for running production locally or in stage deployment
|
@@ -10,7 +10,7 @@ namespace :application do
|
|
10
10
|
invoke 'app_home:deploy_first_time_start_msg'
|
11
11
|
invoke 'app_home:create_all'
|
12
12
|
invoke 'database:configure_mysql'
|
13
|
-
invoke '
|
13
|
+
invoke 'config:configure'
|
14
14
|
invoke 'apache:configure_and_start'
|
15
15
|
invoke 'apache:check_write_permissions'
|
16
16
|
invoke :deploy
|
@@ -25,7 +25,7 @@ namespace :application do
|
|
25
25
|
# This is advisable to kill users cookies after the upgrade.
|
26
26
|
# The consequence is that users will be logged out automatically from the Application after the upgrade.
|
27
27
|
# This is important to avoid errors with old validity_token in forms
|
28
|
-
invoke '
|
28
|
+
invoke 'config:update_app_secret'
|
29
29
|
invoke :deploy
|
30
30
|
invoke 'app_home:correct_shared_permissions'
|
31
31
|
invoke 'application:restart'
|
@@ -137,7 +137,7 @@ namespace :load do
|
|
137
137
|
set :pty, -> { true }
|
138
138
|
|
139
139
|
# Default value for :linked_files is []
|
140
|
-
set :linked_files, -> { %w[config/database.yml config/
|
140
|
+
set :linked_files, -> { %w[config/database.yml config/local.yml .env] }
|
141
141
|
|
142
142
|
# Default value for linked_dirs is []
|
143
143
|
set :linked_dirs, -> { %w[log tmp/pids tmp/sockets vendor/bundle public/system] }
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :config do
|
4
|
+
desc 'Create .env and local in shared path'
|
5
|
+
task :configure do
|
6
|
+
set :env_file_path, "#{fetch(:shared_path)}/.env"
|
7
|
+
set :local_file_path, "#{fetch(:shared_path)}/config/local.yml"
|
8
|
+
|
9
|
+
invoke 'config:set_permissions_pre_update'
|
10
|
+
invoke 'config:set_config_files'
|
11
|
+
invoke 'config:replace_token'
|
12
|
+
invoke 'config:set_permissions_post_update'
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Update Application secret in file .env'
|
16
|
+
task :update_app_secret do
|
17
|
+
set :env_file_path, "#{fetch(:shared_path)}/.env"
|
18
|
+
set :local_file_path, "#{fetch(:shared_path)}/config/local.yml"
|
19
|
+
|
20
|
+
invoke 'config:set_permissions_pre_update'
|
21
|
+
invoke 'config:replace_token'
|
22
|
+
invoke 'config:set_permissions_post_update'
|
23
|
+
end
|
24
|
+
|
25
|
+
# desc 'Set (create or replace) .env and local.yml in the shared path'
|
26
|
+
task :set_config_files do
|
27
|
+
on roles(:app), in: :sequence do
|
28
|
+
debug '#' * 50
|
29
|
+
debug 'Create and configure .env and local.yml file'
|
30
|
+
env_file_path = fetch(:env_file_path).to_s
|
31
|
+
local_file_path = fetch(:local_file_path).to_s
|
32
|
+
|
33
|
+
set :env_original_file_path, File.expand_path('../recipes/config/.env.example', __dir__)
|
34
|
+
set :local_original_file_path, File.expand_path('../recipes/config/local.yml', __dir__)
|
35
|
+
|
36
|
+
unless remote_file_exists?(env_file_path)
|
37
|
+
upload! StringIO.new(File.read(fetch(:env_original_file_path).to_s)), fetch(:env_file_path).to_s
|
38
|
+
end
|
39
|
+
unless remote_file_exists?(local_file_path)
|
40
|
+
upload! StringIO.new(File.read(fetch(:local_original_file_path).to_s)), fetch(:local_file_path).to_s
|
41
|
+
end
|
42
|
+
|
43
|
+
debug '#' * 50
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# desc 'Replace the secure secret key in your .env'
|
48
|
+
task :replace_token do
|
49
|
+
on roles(:app), in: :sequence do
|
50
|
+
debug '#' * 50
|
51
|
+
|
52
|
+
pattern = 'SECRET_KEY_BASE=.*'
|
53
|
+
new_secret = "SECRET_KEY_BASE=#{fetch(:secrets_key_base)}"
|
54
|
+
env_file_path = fetch(:env_file_path).to_s
|
55
|
+
|
56
|
+
if remote_file_exists?(env_file_path)
|
57
|
+
num_occurrences = get_num_occurrences_in_file(env_file_path, pattern)
|
58
|
+
|
59
|
+
if num_occurrences.zero?
|
60
|
+
error "no secret token found in #{env_file_path}"
|
61
|
+
exit 1
|
62
|
+
end
|
63
|
+
else
|
64
|
+
error "file #{env_file_path} not found"
|
65
|
+
exit 1
|
66
|
+
end
|
67
|
+
|
68
|
+
command = "sed -i -e \"s/#{pattern}/#{new_secret}/g\" #{env_file_path}"
|
69
|
+
debug command
|
70
|
+
execute command
|
71
|
+
|
72
|
+
debug 'Secret token successfully replaced'
|
73
|
+
debug '#' * 50
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# desc 'Correct .env file permissions before change the file'
|
78
|
+
task :set_permissions_pre_update do
|
79
|
+
on roles(:app) do
|
80
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
81
|
+
|
82
|
+
debug '#' * 50
|
83
|
+
|
84
|
+
chmod_command = "chmod -f 777 #{fetch(:env_file_path)} || true"
|
85
|
+
debug chmod_command
|
86
|
+
execute "#{sudo_cmd} #{chmod_command}"
|
87
|
+
|
88
|
+
debug '#' * 50
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# desc 'Correct .env file permissions after change the file and local.yml file permissions'
|
93
|
+
task :set_permissions_post_update do
|
94
|
+
on roles(:app) do
|
95
|
+
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
96
|
+
|
97
|
+
debug '#' * 50
|
98
|
+
|
99
|
+
# Update .env and local.yml user and group owners
|
100
|
+
chown_command_env = "chown #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{fetch(:env_file_path)}"
|
101
|
+
chown_command_local = "chown #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{fetch(:local_file_path)}"
|
102
|
+
debug chown_command_env
|
103
|
+
execute "#{sudo_cmd} #{chown_command_env}"
|
104
|
+
debug chown_command_local
|
105
|
+
execute "#{sudo_cmd} #{chown_command_local}"
|
106
|
+
|
107
|
+
chmod_command_env = "chmod 440 #{fetch(:env_file_path)}"
|
108
|
+
chmod_command_local = "chmod 440 #{fetch(:local_file_path)}"
|
109
|
+
debug chmod_command_env
|
110
|
+
execute "#{sudo_cmd} #{chmod_command_env}"
|
111
|
+
debug chmod_command_local
|
112
|
+
execute "#{sudo_cmd} #{chmod_command_local}"
|
113
|
+
|
114
|
+
debug '#' * 50
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-exfel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis Maia
|
8
8
|
- Maurizio Manetti
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-01-31 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
@@ -39,8 +38,8 @@ dependencies:
|
|
39
38
|
- - "~>"
|
40
39
|
- !ruby/object:Gem::Version
|
41
40
|
version: '13.0'
|
42
|
-
description: Deployment of Ruby on Rails Applications in EuXFEL Virtual Machines
|
43
|
-
22.04 + Apache + RVM + Phusion Passenger)
|
41
|
+
description: 'Deployment of Ruby on Rails Applications in EuXFEL Virtual Machines
|
42
|
+
(Ubuntu 22.04 + Apache + RVM + Phusion Passenger) '
|
44
43
|
email:
|
45
44
|
- luisgoncalo.maia@gmail.com
|
46
45
|
- maurizio.manetti@xfel.eu
|
@@ -54,7 +53,6 @@ files:
|
|
54
53
|
- LICENSE.txt
|
55
54
|
- README.md
|
56
55
|
- Rakefile
|
57
|
-
- capistrano-exfel.gem
|
58
56
|
- capistrano-exfel.gemspec
|
59
57
|
- capistrano.graph
|
60
58
|
- capistrano.png
|
@@ -62,22 +60,22 @@ files:
|
|
62
60
|
- lib/capistrano/exfel/ubuntu22.rb
|
63
61
|
- lib/capistrano/exfel/version.rb
|
64
62
|
- lib/capistrano/recipes/apache/app_ssl.conf
|
63
|
+
- lib/capistrano/recipes/config/.env.example
|
65
64
|
- lib/capistrano/recipes/config/database_mysql.yml
|
66
65
|
- lib/capistrano/recipes/config/database_postgresql.yml
|
67
66
|
- lib/capistrano/recipes/config/database_sqlite.yml
|
68
|
-
- lib/capistrano/recipes/config/
|
67
|
+
- lib/capistrano/recipes/config/local.yml
|
69
68
|
- lib/capistrano/tasks/apache.rake
|
70
69
|
- lib/capistrano/tasks/app_home.rake
|
71
70
|
- lib/capistrano/tasks/application.rake
|
72
71
|
- lib/capistrano/tasks/assets.rake
|
72
|
+
- lib/capistrano/tasks/config.rake
|
73
73
|
- lib/capistrano/tasks/database.rake
|
74
|
-
- lib/capistrano/tasks/secrets.rake
|
75
74
|
- lib/capistrano/tasks/util.rake
|
76
75
|
homepage: https://github.com/luismaia/capistrano-exfel
|
77
76
|
licenses:
|
78
77
|
- MIT
|
79
78
|
metadata: {}
|
80
|
-
post_install_message:
|
81
79
|
rdoc_options: []
|
82
80
|
require_paths:
|
83
81
|
- lib
|
@@ -85,15 +83,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
83
|
requirements:
|
86
84
|
- - ">="
|
87
85
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0'
|
86
|
+
version: '3.0'
|
89
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
88
|
requirements:
|
91
89
|
- - ">="
|
92
90
|
- !ruby/object:Gem::Version
|
93
91
|
version: '0'
|
94
92
|
requirements: []
|
95
|
-
rubygems_version: 3.
|
96
|
-
signing_key:
|
93
|
+
rubygems_version: 3.6.1
|
97
94
|
specification_version: 4
|
98
|
-
summary: Deploy Ruby on Rails 4, 5, 6 and
|
95
|
+
summary: Deploy Ruby on Rails 4, 5, 6, 7 and 8 Applications in EuXFEL Virtual Machines
|
99
96
|
test_files: []
|
data/capistrano-exfel.gem
DELETED
Binary file
|
@@ -1,115 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rake secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure the secrets in this file are kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
|
13
|
-
defaults: &defaults
|
14
|
-
# Application secret_key_base (run 'rake secret' to generate a new secret)
|
15
|
-
secret_key_base: '___secret_that_must_be_replaced_after_deploy___'
|
16
|
-
|
17
|
-
# Application name
|
18
|
-
app_name: '<<APP_NAME>>'
|
19
|
-
|
20
|
-
# Domain where the application is available including the http(s) protocol (e.g. <<APP_DOMAIN>>)
|
21
|
-
# Note that the final '/' character is mandatory
|
22
|
-
# Examples:
|
23
|
-
# * 'http://localhost:3000/' - The application is available under 'localhost'
|
24
|
-
# * 'https://example.com/' - The application is available under a server RackBaseURI
|
25
|
-
site_domain: '<<APP_DOMAIN>>'
|
26
|
-
|
27
|
-
# Sub domain where the application is available (e.g. my_app)
|
28
|
-
# Examples:
|
29
|
-
# * "" - The application is available under '/' (the server root)
|
30
|
-
# * '/my_app' - The application is available under '/my_app'
|
31
|
-
app_sub_domain_uri: '/<<APP_NAME_URI>>' # guarantee that the leading slash is there if value isn't an empty String
|
32
|
-
|
33
|
-
# Sub domain to be applied to the Router
|
34
|
-
# Examples:
|
35
|
-
# * "" - The application URI routing is done via HTTP Server (e.g. Apache or NGINX)
|
36
|
-
# * 'my_app' - The application URI routing must be done via code
|
37
|
-
routes_base_uri: ""
|
38
|
-
|
39
|
-
# Application full url to be used as config.action_mailer.default_url_options (e.g. https://example.com/my_app)
|
40
|
-
app_full_url: '<<APP_FULL_URL>>'
|
41
|
-
|
42
|
-
# Google Analytics code
|
43
|
-
google_analytics_code: 'UA-XXXXXXXX-Y'
|
44
|
-
|
45
|
-
# # EMAIL CONFIGURATION
|
46
|
-
# #
|
47
|
-
# # email_configuration = {
|
48
|
-
# # address: 'smtp.gmail.com',
|
49
|
-
# # port: 587,
|
50
|
-
# # user_name: 'email@gmail.com',
|
51
|
-
# # password: 'password',
|
52
|
-
# # authentication: 'plain',
|
53
|
-
# # enable_starttls_auto: true
|
54
|
-
# # }
|
55
|
-
# #
|
56
|
-
# email_delivery_method: :smtp
|
57
|
-
# email_smtp_settings_address: 'smtp.gmail.com'
|
58
|
-
# email_smtp_settings_port: 587
|
59
|
-
# email_smtp_settings_user_name: 'email@gmail.com'
|
60
|
-
# email_smtp_settings_password: 'password'
|
61
|
-
# email_smtp_settings_authentication: 'plain'
|
62
|
-
|
63
|
-
# # email_configuration:
|
64
|
-
# # delivery_method: :smtp
|
65
|
-
# # smtp_settings:
|
66
|
-
# # address: 'smtp.example.com'
|
67
|
-
# # port: 25
|
68
|
-
# #
|
69
|
-
email_delivery_method: :smtp
|
70
|
-
email_smtp_settings_address: 'smtp.example.com'
|
71
|
-
email_smtp_settings_port: 25
|
72
|
-
|
73
|
-
# OMNIAUTH
|
74
|
-
#
|
75
|
-
# The option will only be visible and work if the provider:
|
76
|
-
# 1) Is present in array 'active_providers'
|
77
|
-
# 2) It's API and SECRET (or TITLE) is not Blank
|
78
|
-
#
|
79
|
-
# active_providers: ['kerberos', 'twitter', 'google_oauth2', 'linkedin', 'facebook', 'github']
|
80
|
-
active_providers: ['ldap']
|
81
|
-
#
|
82
|
-
twitter_app_id: ""
|
83
|
-
twitter_app_secret: ""
|
84
|
-
google_app_id: ""
|
85
|
-
google_app_secret: ""
|
86
|
-
linkedin_app_id: ""
|
87
|
-
linkedin_app_secret: ""
|
88
|
-
facebook_app_id: ""
|
89
|
-
facebook_app_secret: ""
|
90
|
-
github_app_id: ""
|
91
|
-
github_app_secret: ""
|
92
|
-
kerberos_title: 'XFEL'
|
93
|
-
ldap_title: 'European-XFEL (LDAP)'
|
94
|
-
ldap:
|
95
|
-
host: 'it-ldap-slave.desy.de'
|
96
|
-
port: 1636
|
97
|
-
users_base_dn: 'ou=people,ou=RGY,o=DESY,c=DE'
|
98
|
-
groups_base_dn: 'ou=group,ou=RGY,o=DESY,c=DE'
|
99
|
-
user_id: 'uid'
|
100
|
-
ssl: true
|
101
|
-
encryption: # This configuration is only taken into account if 'ssl' is true!
|
102
|
-
method: :simple_tls # Default if nil: simple_tls
|
103
|
-
tls_options: '' # Default if nil: nil
|
104
|
-
|
105
|
-
#
|
106
|
-
development:
|
107
|
-
<<: *defaults
|
108
|
-
|
109
|
-
#
|
110
|
-
test:
|
111
|
-
<<: *defaults
|
112
|
-
|
113
|
-
#
|
114
|
-
production:
|
115
|
-
<<: *defaults
|
@@ -1,109 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
namespace :secrets do
|
4
|
-
desc 'Create secrets.yml in shared path'
|
5
|
-
task :configure do
|
6
|
-
set :secrets_file_path, "#{fetch(:shared_path)}/config/secrets.yml"
|
7
|
-
|
8
|
-
invoke 'secrets:set_permissions_pre_update'
|
9
|
-
invoke 'secrets:set_secrets_file'
|
10
|
-
invoke 'secrets:replace_token'
|
11
|
-
invoke 'secrets:set_permissions_post_update'
|
12
|
-
end
|
13
|
-
|
14
|
-
desc 'Update Application secret in file secrets.yml'
|
15
|
-
task :update_app_secret do
|
16
|
-
set :secrets_file_path, "#{fetch(:shared_path)}/config/secrets.yml"
|
17
|
-
|
18
|
-
invoke 'secrets:set_permissions_pre_update'
|
19
|
-
invoke 'secrets:replace_token'
|
20
|
-
invoke 'secrets:set_permissions_post_update'
|
21
|
-
end
|
22
|
-
|
23
|
-
# desc 'Set (create or replace) secrets.yml in the shared path'
|
24
|
-
task :set_secrets_file do
|
25
|
-
on roles(:app), in: :sequence do
|
26
|
-
debug '#' * 50
|
27
|
-
debug 'Create and configure secrets.yml file'
|
28
|
-
secrets_file_path = fetch(:secrets_file_path).to_s
|
29
|
-
|
30
|
-
set :secrets_original_file_path, File.expand_path('../recipes/config/secrets_example.yml', __dir__)
|
31
|
-
|
32
|
-
unless remote_file_exists?(secrets_file_path)
|
33
|
-
upload! StringIO.new(File.read(fetch(:secrets_original_file_path).to_s)), fetch(:secrets_file_path).to_s
|
34
|
-
end
|
35
|
-
|
36
|
-
execute "sed -i 's|<<APP_NAME>>|#{fetch(:app_name)}|g' #{fetch(:secrets_file_path)}"
|
37
|
-
execute "sed -i 's|<<APP_DOMAIN>>|#{fetch(:app_domain)}|g' #{fetch(:secrets_file_path)}"
|
38
|
-
execute "sed -i 's|<<APP_NAME_URI>>|#{fetch(:app_name_uri)}|g' #{fetch(:secrets_file_path)}"
|
39
|
-
execute "sed -i 's|<<APP_FULL_URL>>|#{fetch(:app_full_url)}|g' #{fetch(:secrets_file_path)}"
|
40
|
-
|
41
|
-
debug '#' * 50
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# desc 'Replace the secure secret key in your secrets.yml'
|
46
|
-
task :replace_token do
|
47
|
-
on roles(:app), in: :sequence do
|
48
|
-
debug '#' * 50
|
49
|
-
|
50
|
-
pattern = 'secret_key_base:.*'
|
51
|
-
new_secret = "secret_key_base: '#{fetch(:secrets_key_base)}'"
|
52
|
-
secrets_file_path = fetch(:secrets_file_path).to_s
|
53
|
-
|
54
|
-
if remote_file_exists?(secrets_file_path)
|
55
|
-
num_occurrences = get_num_occurrences_in_file(secrets_file_path, pattern)
|
56
|
-
|
57
|
-
if num_occurrences.zero?
|
58
|
-
error "no secret token found in #{secrets_file_path}"
|
59
|
-
exit 1
|
60
|
-
end
|
61
|
-
else
|
62
|
-
error "file #{secrets_file_path} not found"
|
63
|
-
exit 1
|
64
|
-
end
|
65
|
-
|
66
|
-
command = "sed -i -e \"s/#{pattern}/#{new_secret}/g\" #{secrets_file_path}"
|
67
|
-
debug command
|
68
|
-
execute command
|
69
|
-
|
70
|
-
debug 'Secret token successfully replaced'
|
71
|
-
debug '#' * 50
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
# desc 'Correct secrets.yml file permissions before change the file'
|
76
|
-
task :set_permissions_pre_update do
|
77
|
-
on roles(:app) do
|
78
|
-
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
79
|
-
|
80
|
-
debug '#' * 50
|
81
|
-
|
82
|
-
chmod_command = "chmod -f 777 #{fetch(:secrets_file_path)} || true"
|
83
|
-
debug chmod_command
|
84
|
-
execute "#{sudo_cmd} #{chmod_command}"
|
85
|
-
|
86
|
-
debug '#' * 50
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
# desc 'Correct secrets.yml file permissions after change the file'
|
91
|
-
task :set_permissions_post_update do
|
92
|
-
on roles(:app) do
|
93
|
-
sudo_cmd = "echo '#{fetch(:password)}' | sudo -S"
|
94
|
-
|
95
|
-
debug '#' * 50
|
96
|
-
|
97
|
-
# Update database.yml user and group owners
|
98
|
-
chown_command = "chown #{fetch(:app_user_owner)}.#{fetch(:app_group_owner)} #{fetch(:secrets_file_path)}"
|
99
|
-
debug chown_command
|
100
|
-
execute "#{sudo_cmd} #{chown_command}"
|
101
|
-
|
102
|
-
chmod_command = "chmod 440 #{fetch(:secrets_file_path)}"
|
103
|
-
debug chmod_command
|
104
|
-
execute "#{sudo_cmd} #{chmod_command}"
|
105
|
-
|
106
|
-
debug '#' * 50
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|