danarchy_deploy 0.2.6 → 0.2.8
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/.asdf_versions.json +5 -0
- data/.tool-versions +1 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +9 -8
- data/danarchy_deploy.gemspec +4 -4
- data/lib/danarchy_deploy/groups.rb +0 -1
- data/lib/danarchy_deploy/services/init/openrc.rb +10 -6
- data/lib/danarchy_deploy/services/init.rb +28 -18
- data/lib/danarchy_deploy/services.rb +0 -1
- data/lib/danarchy_deploy/system/centos.rb +7 -0
- data/lib/danarchy_deploy/system/debian.rb +6 -0
- data/lib/danarchy_deploy/system/gentoo.rb +83 -23
- data/lib/danarchy_deploy/system/opensuse.rb +6 -0
- data/lib/danarchy_deploy/system.rb +22 -10
- data/lib/danarchy_deploy/templater.rb +26 -9
- data/lib/danarchy_deploy/users.rb +50 -42
- data/lib/danarchy_deploy/version.rb +1 -1
- data/lib/danarchy_deploy.rb +61 -19
- data/templates/applications/nginx/domain.conf.erb +38 -0
- data/templates/applications/php/phpfpm.conf.erb +19 -0
- data/templates/applications/php/user.conf.erb +19 -0
- data/templates/applications/wordpress/mysql_user_privileges.sql.erb +2 -0
- data/templates/applications/wordpress/wp-config.php.erb +82 -0
- data/templates/asdf/asdf.sh.erb +52 -0
- data/templates/deploy_template.json +76 -50
- data/templates/distcc/distccd.erb +14 -0
- data/templates/distcc/hosts.erb +2 -0
- data/templates/portage/make.conf.erb +30 -0
- data/templates/portage/package.use/bindist +3 -0
- data/templates/portage/package.use/documentation +3 -0
- data/templates/services/memcached/memcached.erb +40 -0
- data/templates/services/mysql/my.cnf.erb +143 -0
- data/templates/services/mysql/root_my.cnf.erb +11 -0
- data/templates/services/mysql/user_db_grants.sql.erb +33 -0
- data/templates/services/mysql/user_db_grants.sql.erb_cleanupUsers +52 -0
- data/templates/services/nginx/nginx.conf.erb +48 -0
- data/templates/services/php/php-fpm.conf.erb +2 -0
- data/templates/services/postfix/localmail.initial_setup.sh +19 -0
- data/templates/services/postfix/localmail.main.cf.erb +41 -0
- data/templates/services/postfix/mailname.erb +1 -0
- data/templates/services/postfix/mailrelayhost_main.cf.erb +33 -0
- data/templates/services/postfix/main.cf.erb +28 -0
- data/templates/services/postfix/master.cf.erb +124 -0
- data/templates/services/postfix/mysql-virtual-alias-maps.cf.erb +5 -0
- data/templates/services/postfix/mysql-virtual-mailbox-domains.cf.erb +5 -0
- data/templates/services/postfix/mysql-virtual-mailbox-maps.cf.erb +5 -0
- data/templates/system/authorized_keys.erb +5 -0
- data/templates/system/crontab.erb +8 -0
- data/templates/system/dmcrypt.erb +17 -0
- data/templates/system/exports.erb +4 -0
- data/templates/system/fstab.erb +4 -0
- data/templates/system/sudoers.erb +5 -0
- metadata +44 -11
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- /data/bin/{setup → setup-dd} +0 -0
@@ -8,6 +8,7 @@ module DanarchyDeploy
|
|
8
8
|
|
9
9
|
deployment[:users].each do |username, user|
|
10
10
|
user[:username] = username.to_s
|
11
|
+
user[:home] ||= '/home/' + username.to_s
|
11
12
|
puts "\n > Checking if user '#{user[:username]}' already exists."
|
12
13
|
usercheck_result = usercheck(user, options)
|
13
14
|
|
@@ -15,8 +16,8 @@ module DanarchyDeploy
|
|
15
16
|
puts " - User: #{user[:username]} already exists!"
|
16
17
|
else
|
17
18
|
group = { groupname: user[:username] }
|
18
|
-
group[:gid]
|
19
|
-
group[:system] = user[:system]
|
19
|
+
group[:gid] = user[:gid] || nil
|
20
|
+
group[:system] = user[:system] || nil
|
20
21
|
|
21
22
|
groupcheck_result = DanarchyDeploy::Groups.groupcheck(group, options)
|
22
23
|
if !groupcheck_result[:stdout] && group[:gid]
|
@@ -40,12 +41,12 @@ module DanarchyDeploy
|
|
40
41
|
|
41
42
|
if user[:authorized_keys]
|
42
43
|
puts "\n > Checking on #{user[:authorized_keys].count} authorized_keys for user: #{user[:username]}"
|
43
|
-
authorized_keys(user)
|
44
|
+
authorized_keys(user, options)
|
44
45
|
end
|
45
46
|
|
46
47
|
if user[:sudoer]
|
47
48
|
puts "\n > Checking sudo rules for user: #{user[:username]}"
|
48
|
-
sudoer(user)
|
49
|
+
sudoer(user, options)
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
@@ -63,13 +64,13 @@ module DanarchyDeploy
|
|
63
64
|
private
|
64
65
|
def self.useradd(user, options)
|
65
66
|
useradd_cmd = "useradd #{user[:username]} "
|
66
|
-
useradd_cmd += "--home-dir #{user[:home]} "
|
67
|
-
useradd_cmd += "--create-home "
|
68
|
-
useradd_cmd += "--uid #{user[:uid]} "
|
69
|
-
useradd_cmd += "--gid #{user[:gid]} "
|
67
|
+
useradd_cmd += "--home-dir #{user[:home]} " if user[:home]
|
68
|
+
useradd_cmd += "--create-home " if ! Dir.exist?(user[:home])
|
69
|
+
useradd_cmd += "--uid #{user[:uid]} " if user[:uid]
|
70
|
+
useradd_cmd += "--gid #{user[:gid]} " if user[:gid]
|
70
71
|
useradd_cmd += "--groups #{user[:groups].join(',')} " if user[:groups]
|
71
|
-
useradd_cmd += "--shell /sbin/nologin "
|
72
|
-
useradd_cmd += "--system "
|
72
|
+
useradd_cmd += "--shell /sbin/nologin " if user[:nologin]
|
73
|
+
useradd_cmd += "--system " if user[:system]
|
73
74
|
DanarchyDeploy::Helpers.run_command(useradd_cmd, options)
|
74
75
|
end
|
75
76
|
|
@@ -111,40 +112,47 @@ module DanarchyDeploy
|
|
111
112
|
DanarchyDeploy::Helpers.run_command(removegroup_cmd, options)
|
112
113
|
end
|
113
114
|
|
114
|
-
def self.authorized_keys(user)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
115
|
+
def self.authorized_keys(user, options)
|
116
|
+
templates = [
|
117
|
+
{
|
118
|
+
source: 'builtin::system/authorized_keys.erb',
|
119
|
+
target: user[:home] + '/.ssh/authorized_keys',
|
120
|
+
dir_perms: {
|
121
|
+
owner: user[:username],
|
122
|
+
group: user[:username],
|
123
|
+
mode: '0700'
|
124
|
+
},
|
125
|
+
file_perms: {
|
126
|
+
owner: user[:username],
|
127
|
+
group: user[:username],
|
128
|
+
mode: '0644'
|
129
|
+
},
|
130
|
+
variables: {
|
131
|
+
authorized_keys: user[:authorized_keys]
|
132
|
+
}
|
133
|
+
}
|
134
|
+
]
|
135
|
+
|
136
|
+
DanarchyDeploy::Templater.new(templates, options)
|
134
137
|
end
|
135
138
|
|
136
|
-
def self.sudoer(user)
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
139
|
+
def self.sudoer(user, options)
|
140
|
+
templates = [
|
141
|
+
{
|
142
|
+
source: 'builtin::system/sudoers.erb',
|
143
|
+
target: '/etc/sudoers.d/danarchy_deploy-' + user[:username],
|
144
|
+
file_perms: {
|
145
|
+
owner: 'root',
|
146
|
+
group: 'root',
|
147
|
+
mode: '0440'
|
148
|
+
},
|
149
|
+
variables: {
|
150
|
+
rules: user[:sudoer]
|
151
|
+
}
|
152
|
+
}
|
153
|
+
]
|
154
|
+
|
155
|
+
DanarchyDeploy::Templater.new(templates, options)
|
148
156
|
end
|
149
157
|
end
|
150
158
|
end
|
data/lib/danarchy_deploy.rb
CHANGED
@@ -43,13 +43,15 @@ module DanarchyDeploy
|
|
43
43
|
def self.new(deployment, options)
|
44
44
|
puts "\n" + self.name
|
45
45
|
|
46
|
-
|
46
|
+
@working_dir = File.dirname(options[:deploy_file]) + '/'
|
47
47
|
connector = { hostname: deployment[:hostname],
|
48
48
|
ipv4: deployment[:ipv4],
|
49
49
|
ssh_user: deployment[:ssh_user],
|
50
50
|
ssh_key: deployment[:ssh_key] }
|
51
51
|
|
52
|
+
pretend = options[:pretend] ; options[:pretend] = false
|
52
53
|
remote_mkdir(connector, options)
|
54
|
+
# asdf_install(connector, options)
|
53
55
|
|
54
56
|
if options[:dev_gem]
|
55
57
|
puts "\nDev Gem mode: Building and pushing gem..."
|
@@ -63,6 +65,8 @@ module DanarchyDeploy
|
|
63
65
|
gem_binary = _locate_gem_binary(connector, options) # this should run before any install; check version too
|
64
66
|
push_templates(connector, options)
|
65
67
|
push_deployment(connector, options)
|
68
|
+
|
69
|
+
options[:pretend] = pretend
|
66
70
|
deploy_result = remote_LocalDeploy(connector, gem_binary, options)
|
67
71
|
|
68
72
|
abort("\n ! Deployment failed to complete!") if !deploy_result
|
@@ -71,15 +75,15 @@ module DanarchyDeploy
|
|
71
75
|
# remote_cleanup(connector, options) if !options[:pretend]
|
72
76
|
|
73
77
|
puts "\nRemote deployment complete!"
|
74
|
-
|
75
|
-
|
76
|
-
|
78
|
+
options[:deploy_file].end_with?('.json') ?
|
79
|
+
JSON.parse(File.read(options[:deploy_file]), symbolize_names: true) :
|
80
|
+
YAML.load_file(options[:deploy_file]) if options[:deploy_file].end_with?('.yaml')
|
77
81
|
end
|
78
82
|
|
79
83
|
private
|
80
84
|
def self.remote_mkdir(connector, options)
|
81
|
-
puts "\n > Creating directory: #{
|
82
|
-
mkdir_cmd = _ssh_command(connector, "test -d #{
|
85
|
+
puts "\n > Creating directory: #{@working_dir}"
|
86
|
+
mkdir_cmd = _ssh_command(connector, "test -d #{@working_dir} && echo 'Directory exists!' || sudo mkdir -vp #{@working_dir}")
|
83
87
|
mkdir_result = DanarchyDeploy::Helpers.run_command(mkdir_cmd, options)
|
84
88
|
|
85
89
|
if mkdir_result[:stderr] && ! mkdir_result[:stdout]
|
@@ -100,12 +104,48 @@ module DanarchyDeploy
|
|
100
104
|
end
|
101
105
|
end
|
102
106
|
|
107
|
+
# def self.asdf_install(connector, options)
|
108
|
+
# versions = JSON.parse(
|
109
|
+
# File.read(File.expand_path('../', __dir__) + '/.asdf_versions.json'),
|
110
|
+
# symbolize_names: true)
|
111
|
+
|
112
|
+
# template = {
|
113
|
+
# target: '/tmp/asdf.sh_' + Random.hex(6),
|
114
|
+
# source: 'builtin::asdf/asdf.sh.erb',
|
115
|
+
# variables: versions
|
116
|
+
# }
|
117
|
+
|
118
|
+
# DanarchyDeploy::Templater.new([template], options)
|
119
|
+
# push_cmd = _scp_push(connector, template[:target], '/tmp')
|
120
|
+
# push_result = DanarchyDeploy::Helpers.run_command(push_cmd, options)
|
121
|
+
|
122
|
+
# if push_result[:stderr]
|
123
|
+
# abort(' ! Asdf push failed!')
|
124
|
+
# else
|
125
|
+
# puts ' |+ Asdf pushed!'
|
126
|
+
# asdf_chown_cmd = _ssh_command(
|
127
|
+
# connector,
|
128
|
+
# "sudo mv -v #{template[:target]} /etc/profile.d/asdf.sh && " +
|
129
|
+
# 'sudo chown -c root:root /etc/profile.d/asdf.sh')
|
130
|
+
# asdf_chown_result = DanarchyDeploy::Helpers.run_command(asdf_chown_cmd, options)
|
131
|
+
# File.delete(template[:target])
|
132
|
+
# end
|
133
|
+
|
134
|
+
# asdf_current_cmd = _ssh_command(connector, 'sudo -i asdf current')
|
135
|
+
# asdf_current_result = DanarchyDeploy::Helpers.run_command(asdf_current_cmd, options)
|
136
|
+
|
137
|
+
# puts asdf_current_result[:stderr] if asdf_current_result[:stderr]
|
138
|
+
# puts asdf_current_result[:stdout]
|
139
|
+
# end
|
140
|
+
|
103
141
|
def self.gem_install(connector, options)
|
104
142
|
puts "\n > Installing danarchy_deploy on #{connector[:hostname]}"
|
105
|
-
install_cmd
|
143
|
+
install_cmd = _ssh_command(connector, 'sudo -i gem install -f danarchy_deploy')
|
106
144
|
install_result = DanarchyDeploy::Helpers.run_command(install_cmd, options)
|
107
145
|
|
108
|
-
if install_result[:stderr]
|
146
|
+
if install_result[:stderr] =~ /WARN/i
|
147
|
+
puts ' ! ' + install_result[:stderr]
|
148
|
+
elsif install_result[:stderr]
|
109
149
|
abort(' ! Gem install failed!')
|
110
150
|
else
|
111
151
|
puts " |+ Gem installed!"
|
@@ -134,7 +174,7 @@ module DanarchyDeploy
|
|
134
174
|
|
135
175
|
def self.dev_gem_install(connector, gem, options)
|
136
176
|
puts "\n > Pushing gem: #{gem} to #{connector[:hostname]}"
|
137
|
-
push_cmd
|
177
|
+
push_cmd = _scp_push(connector, gem, options[:deploy_dir])
|
138
178
|
push_result = DanarchyDeploy::Helpers.run_command(push_cmd, options)
|
139
179
|
|
140
180
|
if push_result[:stderr]
|
@@ -144,10 +184,12 @@ module DanarchyDeploy
|
|
144
184
|
end
|
145
185
|
|
146
186
|
puts "\n > Installing gem: #{gem} on #{connector[:hostname]}"
|
147
|
-
install_cmd
|
187
|
+
install_cmd = _ssh_command(connector, "sudo -i gem install --bindir /usr/local/bin -f #{options[:deploy_dir]}/#{File.basename(gem)}")
|
148
188
|
install_result = DanarchyDeploy::Helpers.run_command(install_cmd, options)
|
149
189
|
|
150
|
-
if install_result[:stderr]
|
190
|
+
if install_result[:stderr] =~ /WARN/i
|
191
|
+
puts ' ! ' + install_result[:stderr]
|
192
|
+
elsif install_result[:stderr]
|
151
193
|
abort(' ! Gem install failed!')
|
152
194
|
else
|
153
195
|
puts ' |+ Gem installed!'
|
@@ -155,39 +197,39 @@ module DanarchyDeploy
|
|
155
197
|
end
|
156
198
|
|
157
199
|
def self.gem_clean(connector, options)
|
158
|
-
clean_cmd = _ssh_command(connector, 'sudo gem clean danarchy_deploy 2&>/dev/null')
|
200
|
+
clean_cmd = _ssh_command(connector, 'sudo -i gem clean danarchy_deploy 2&>/dev/null')
|
159
201
|
system(clean_cmd)
|
160
202
|
end
|
161
203
|
|
162
204
|
def self.push_templates(connector, options)
|
163
205
|
template_dir = options[:deploy_dir] + '/templates'
|
164
206
|
puts "\n > Pushing templates: #{template_dir}"
|
165
|
-
push_cmd
|
207
|
+
push_cmd = _rsync_push(connector, template_dir, template_dir)
|
166
208
|
push_result = DanarchyDeploy::Helpers.run_command(push_cmd, options)
|
167
209
|
|
168
210
|
if push_result[:stderr]
|
169
211
|
abort(' ! Templates push failed!')
|
170
212
|
else
|
171
|
-
puts " |+ Templates pushed to '#{
|
213
|
+
puts " |+ Templates pushed to '#{template_dir}'!"
|
172
214
|
end
|
173
215
|
end
|
174
216
|
|
175
217
|
def self.push_deployment(connector, options)
|
176
218
|
puts "\n > Pushing deployment: #{options[:deploy_file]}"
|
177
|
-
push_cmd
|
219
|
+
push_cmd = _rsync_push(connector, @working_dir, @working_dir)
|
178
220
|
push_result = DanarchyDeploy::Helpers.run_command(push_cmd, options)
|
179
221
|
|
180
222
|
if push_result[:stderr]
|
181
223
|
abort(' ! Deployment push failed!')
|
182
224
|
else
|
183
|
-
puts " |+ Deployment pushed to '#{
|
225
|
+
puts " |+ Deployment pushed to '#{@working_dir}'!"
|
184
226
|
end
|
185
227
|
end
|
186
228
|
|
187
229
|
def self.remote_LocalDeploy(connector, gem_binary, options)
|
188
230
|
puts "\n > Running LocalDeploy on #{connector[:hostname]}.\n\n"
|
189
231
|
|
190
|
-
deploy_cmd = "sudo #{gem_binary} local "
|
232
|
+
deploy_cmd = "sudo -i #{gem_binary} local "
|
191
233
|
deploy_cmd += '--first-run ' if options[:first_run]
|
192
234
|
deploy_cmd += '--ssh-verbose ' if options[:ssh_verbose]
|
193
235
|
deploy_cmd += '--vars-verbose ' if options[:vars_verbose]
|
@@ -214,7 +256,7 @@ module DanarchyDeploy
|
|
214
256
|
|
215
257
|
def self.remote_cleanup(connector, options)
|
216
258
|
puts "\n > Cleaning up: #{options[:deploy_dir]}"
|
217
|
-
cleanup_cmd
|
259
|
+
cleanup_cmd = _ssh_command(connector, "sudo rm -rfv #{@working_dir}")
|
218
260
|
cleanup_result = DanarchyDeploy::Helpers.run_command(cleanup_cmd, options)
|
219
261
|
|
220
262
|
if cleanup_result[:stderr]
|
@@ -225,7 +267,7 @@ module DanarchyDeploy
|
|
225
267
|
end
|
226
268
|
|
227
269
|
def self._locate_gem_binary(connector, options)
|
228
|
-
locate_cmd
|
270
|
+
locate_cmd = _ssh_command(connector, 'sudo -i which danarchy_deploy')
|
229
271
|
locate_result = DanarchyDeploy::Helpers.run_command(locate_cmd, options)
|
230
272
|
|
231
273
|
if locate_result[:stderr]
|
@@ -0,0 +1,38 @@
|
|
1
|
+
server {
|
2
|
+
server_name www.<%= @variables[:domain] %>;
|
3
|
+
listen 80;
|
4
|
+
return 301 http://<%= @variables[:domain] %>/$request_uri;
|
5
|
+
}
|
6
|
+
|
7
|
+
server {
|
8
|
+
server_name <%= @variables[:domain] %>;
|
9
|
+
listen 80;
|
10
|
+
|
11
|
+
server_tokens off;
|
12
|
+
add_header X-Content-Type-Options nosniff;
|
13
|
+
add_header X-XSS-Protection "1; mode=block";
|
14
|
+
add_header X-Frame-Options "SAMEORIGIN";
|
15
|
+
|
16
|
+
access_log /home/<%= @variables[:username] %>/nginx/logs/<%= @variables[:domain] %>/access_log main;
|
17
|
+
error_log /home/<%= @variables[:username] %>/nginx/logs/<%= @variables[:domain] %>/error_log info;
|
18
|
+
|
19
|
+
root /home/<%= @variables[:username] %>/<%= @variables[:domain] %>;
|
20
|
+
index index.php;
|
21
|
+
|
22
|
+
location / {
|
23
|
+
try_files $uri $uri/ /index.php?q=$uri&$args;
|
24
|
+
|
25
|
+
}
|
26
|
+
|
27
|
+
location ~ \.php$ {
|
28
|
+
try_files $uri =404;
|
29
|
+
include /etc/nginx/fastcgi_params;
|
30
|
+
fastcgi_buffers 16 16k;
|
31
|
+
fastcgi_buffer_size 32k;
|
32
|
+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
33
|
+
fastcgi_pass unix:/var/run/php-fpm-<%= @variables[:domain].gsub('.','_') %>.sock;
|
34
|
+
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
|
35
|
+
fastcgi_index index.php;
|
36
|
+
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
[<%= @variables[:pool] %>]
|
2
|
+
user = <%= @variables[:username] %>
|
3
|
+
group = <%= @variables[:username] %>
|
4
|
+
|
5
|
+
listen = /var/run/php-fpm-<%= @variables[:pool] %>.sock
|
6
|
+
<% if @variables[:web_user] %>
|
7
|
+
listen.owner = <%= @variables[:web_user] %>
|
8
|
+
listen.group = <%= @variables[:web_user] %>
|
9
|
+
<% end %>
|
10
|
+
pm = dynamic
|
11
|
+
pm.max_children = 4
|
12
|
+
pm.start_servers = 1
|
13
|
+
pm.min_spare_servers = 1
|
14
|
+
pm.max_spare_servers = 2
|
15
|
+
|
16
|
+
env[TMP] = <%= @variables[:tmp] %>
|
17
|
+
env[TMPDIR] = <%= @variables[:tmp] %>
|
18
|
+
env[TEMP] = <%= @variables[:tmp] %>
|
19
|
+
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
@@ -0,0 +1,19 @@
|
|
1
|
+
[<%= @variables[:username] %>]
|
2
|
+
user = <%= @variables[:username] %>
|
3
|
+
group = <%= @variables[:username] %>
|
4
|
+
|
5
|
+
listen = /var/run/php7-fpm-<%= @variables[:username] %>.sock
|
6
|
+
<% if @variables[:web_user] %>
|
7
|
+
listen.owner = <%= @variables[:web_user] %>
|
8
|
+
listen.group = <%= @variables[:web_user] %>
|
9
|
+
<% end %>
|
10
|
+
pm = dynamic
|
11
|
+
pm.max_children = 4
|
12
|
+
pm.start_servers = 1
|
13
|
+
pm.min_spare_servers = 1
|
14
|
+
pm.max_spare_servers = 2
|
15
|
+
|
16
|
+
env[TMP] = <%= @variables[:tmp] %>
|
17
|
+
env[TMPDIR] = <%= @variables[:tmp] %>
|
18
|
+
env[TEMP] = <%= @variables[:tmp] %>
|
19
|
+
env[PATH] = /usr/local/bin:/usr/bin:/bin
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* The base configuration for WordPress
|
4
|
+
*
|
5
|
+
* The wp-config.php creation script uses this file during the
|
6
|
+
* installation. You don't have to use the web site, you can
|
7
|
+
* copy this file to "wp-config.php" and fill in the values.
|
8
|
+
*
|
9
|
+
* This file contains the following configurations:
|
10
|
+
*
|
11
|
+
* * MySQL settings
|
12
|
+
* * Secret keys
|
13
|
+
* * Database table prefix
|
14
|
+
* * ABSPATH
|
15
|
+
*
|
16
|
+
* @link https://codex.wordpress.org/Editing_wp-config.php
|
17
|
+
*
|
18
|
+
* @package WordPress
|
19
|
+
*/
|
20
|
+
|
21
|
+
// ** MySQL settings - You can get this info from your web host ** //
|
22
|
+
/** The name of the database for WordPress */
|
23
|
+
define('DB_NAME', '<%= @variables[:db_name] %>');
|
24
|
+
|
25
|
+
/** MySQL database username */
|
26
|
+
define('DB_USER', '<%= @variables[:db_user] %>');
|
27
|
+
|
28
|
+
/** MySQL database password */
|
29
|
+
define('DB_PASSWORD', '<%= DanarchyDeploy::Helpers.decode_base64(@variables[:db_pass]) %>');
|
30
|
+
|
31
|
+
/** MySQL hostname */
|
32
|
+
define('DB_HOST', '<%= @variables[:db_host] %>');
|
33
|
+
|
34
|
+
/** Database Charset to use in creating database tables. */
|
35
|
+
define('DB_CHARSET', 'utf8');
|
36
|
+
|
37
|
+
/** The Database Collate type. Don't change this if in doubt. */
|
38
|
+
define('DB_COLLATE', '');
|
39
|
+
|
40
|
+
/**#@+
|
41
|
+
* Authentication Unique Keys and Salts.
|
42
|
+
*
|
43
|
+
* Change these to different unique phrases!
|
44
|
+
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
|
45
|
+
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
|
46
|
+
*
|
47
|
+
* @since 2.6.0
|
48
|
+
*/
|
49
|
+
<%= @variables[:salts] %>
|
50
|
+
|
51
|
+
/**#@-*/
|
52
|
+
|
53
|
+
/**
|
54
|
+
* WordPress Database Table prefix.
|
55
|
+
*
|
56
|
+
* You can have multiple installations in one database if you give each
|
57
|
+
* a unique prefix. Only numbers, letters, and underscores please!
|
58
|
+
*/
|
59
|
+
$table_prefix = '<%= @variables[:table_prefix] ? @variables[:table_prefix] : "wp_" %>';
|
60
|
+
|
61
|
+
/**
|
62
|
+
* For developers: WordPress debugging mode.
|
63
|
+
*
|
64
|
+
* Change this to true to enable the display of notices during development.
|
65
|
+
* It is strongly recommended that plugin and theme developers use WP_DEBUG
|
66
|
+
* in their development environments.
|
67
|
+
*
|
68
|
+
* For information on other constants that can be used for debugging,
|
69
|
+
* visit the Codex.
|
70
|
+
*
|
71
|
+
* @link https://codex.wordpress.org/Debugging_in_WordPress
|
72
|
+
*/
|
73
|
+
define('WP_DEBUG', false);
|
74
|
+
|
75
|
+
/* That's all, stop editing! Happy blogging. */
|
76
|
+
|
77
|
+
/** Absolute path to the WordPress directory. */
|
78
|
+
if ( !defined('ABSPATH') )
|
79
|
+
define('ABSPATH', dirname(__FILE__) . '/');
|
80
|
+
|
81
|
+
/** Sets up WordPress vars and included files. */
|
82
|
+
require_once(ABSPATH . 'wp-settings.php');
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# Deployed by danarchy_deploy
|
3
|
+
# manages system-wide asdf; still allows for local ~/.asdf
|
4
|
+
|
5
|
+
function _run_now() {
|
6
|
+
tmp_file=/tmp/asdf_next_run.tmp
|
7
|
+
next_run=$(cat ${tmp_file} 2>/dev/null || echo 0)
|
8
|
+
|
9
|
+
if [[ $(date '+%s') -gt ${next_run} ]]; then
|
10
|
+
echo 'true'
|
11
|
+
else
|
12
|
+
echo 'false'
|
13
|
+
fi
|
14
|
+
}
|
15
|
+
|
16
|
+
function _load_asdf() {
|
17
|
+
path=${1}
|
18
|
+
export ASDF_DATA_DIR=${path}
|
19
|
+
source ${path}/asdf.sh
|
20
|
+
source ${path}/completions/asdf.bash
|
21
|
+
}
|
22
|
+
|
23
|
+
if [[ ${UID} == 0 && $(_run_now) == 'true' ]]; then
|
24
|
+
if [[ ! -d /opt/asdf ]]; then
|
25
|
+
git clone https://github.com/asdf-vm/asdf.git /opt/asdf
|
26
|
+
fi
|
27
|
+
|
28
|
+
asdf update >/dev/null 2>&1
|
29
|
+
_load_asdf /opt/asdf
|
30
|
+
|
31
|
+
<%- @variables.each do |lang, versions| -%>
|
32
|
+
asdf plugin add <%= lang -%>
|
33
|
+
|
34
|
+
<%- versions.each do |version| -%>
|
35
|
+
asdf install <%= lang -%> <%= version -%>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
asdf global <%= lang %> <%= versions.first -%>
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
date -d '1 hour' '+%s' > /tmp/asdf_next_run.tmp
|
42
|
+
asdf current
|
43
|
+
fi
|
44
|
+
|
45
|
+
if [[ -d ${HOME}/.asdf ]]; then
|
46
|
+
_load_asdf ${HOME}/.asdf
|
47
|
+
elif [[ -d /opt/asdf ]]; then
|
48
|
+
_load_asdf /opt/asdf
|
49
|
+
fi
|
50
|
+
|
51
|
+
unset -f _run_now
|
52
|
+
unset -f _load_asdf
|