danarchy_deploy 0.2.7 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.asdf_versions.json +5 -0
  3. data/.tool-versions +1 -0
  4. data/CHANGELOG.md +15 -0
  5. data/Gemfile.lock +9 -8
  6. data/bin/danarchy_deploy +0 -1
  7. data/danarchy_deploy.gemspec +4 -4
  8. data/lib/danarchy_deploy/applicator/ssl.rb +1 -1
  9. data/lib/danarchy_deploy/archiver.rb +1 -1
  10. data/lib/danarchy_deploy/groups.rb +0 -1
  11. data/lib/danarchy_deploy/services/init/openrc.rb +10 -6
  12. data/lib/danarchy_deploy/services/init.rb +28 -18
  13. data/lib/danarchy_deploy/services.rb +0 -1
  14. data/lib/danarchy_deploy/system/centos.rb +7 -0
  15. data/lib/danarchy_deploy/system/debian.rb +6 -0
  16. data/lib/danarchy_deploy/system/fstab.rb +15 -5
  17. data/lib/danarchy_deploy/system/gentoo.rb +84 -23
  18. data/lib/danarchy_deploy/system/opensuse.rb +6 -0
  19. data/lib/danarchy_deploy/system.rb +14 -9
  20. data/lib/danarchy_deploy/templater.rb +1 -2
  21. data/lib/danarchy_deploy/users.rb +50 -42
  22. data/lib/danarchy_deploy/version.rb +1 -1
  23. data/lib/danarchy_deploy.rb +63 -20
  24. data/templates/applications/nginx/domain.conf.erb +38 -0
  25. data/templates/applications/php/phpfpm.conf.erb +19 -0
  26. data/templates/applications/php/user.conf.erb +19 -0
  27. data/templates/applications/wordpress/mysql_user_privileges.sql.erb +2 -0
  28. data/templates/applications/wordpress/wp-config.php.erb +82 -0
  29. data/templates/asdf/asdf.sh.erb +52 -0
  30. data/templates/deploy_template.json +6 -7
  31. data/templates/distcc/distccd.erb +14 -0
  32. data/templates/distcc/hosts.erb +2 -0
  33. data/templates/portage/make.conf.erb +30 -0
  34. data/templates/portage/package.use/bindist +3 -0
  35. data/templates/portage/package.use/documentation +3 -0
  36. data/templates/services/memcached/memcached.erb +40 -0
  37. data/templates/services/mysql/my.cnf.erb +143 -0
  38. data/templates/services/mysql/root_my.cnf.erb +11 -0
  39. data/templates/services/mysql/user_db_grants.sql.erb +33 -0
  40. data/templates/services/mysql/user_db_grants.sql.erb_cleanupUsers +52 -0
  41. data/templates/services/nginx/nginx.conf.erb +48 -0
  42. data/templates/services/php/php-fpm.conf.erb +2 -0
  43. data/templates/services/postfix/localmail.initial_setup.sh +19 -0
  44. data/templates/services/postfix/localmail.main.cf.erb +41 -0
  45. data/templates/services/postfix/mailname.erb +1 -0
  46. data/templates/services/postfix/mailrelayhost_main.cf.erb +33 -0
  47. data/templates/services/postfix/main.cf.erb +28 -0
  48. data/templates/services/postfix/master.cf.erb +124 -0
  49. data/templates/services/postfix/mysql-virtual-alias-maps.cf.erb +5 -0
  50. data/templates/services/postfix/mysql-virtual-mailbox-domains.cf.erb +5 -0
  51. data/templates/services/postfix/mysql-virtual-mailbox-maps.cf.erb +5 -0
  52. data/templates/system/authorized_keys.erb +5 -0
  53. data/templates/system/crontab.erb +8 -0
  54. data/templates/system/dmcrypt.erb +17 -0
  55. data/templates/system/exports.erb +4 -0
  56. data/templates/system/fstab.erb +4 -0
  57. data/templates/system/sudoers.erb +5 -0
  58. metadata +44 -11
  59. data/.ruby-gemset +0 -1
  60. data/.ruby-version +0 -1
  61. /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] = user[:gid] ? user[:gid] : nil
19
- group[:system] = user[:system] ? user[:system] : nil
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]} " if user[:home]
67
- useradd_cmd += "--create-home " if !Dir.exist?(user[:home])
68
- useradd_cmd += "--uid #{user[:uid]} " if user[:uid]
69
- useradd_cmd += "--gid #{user[:gid]} " if 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 " if user[:nologin]
72
- useradd_cmd += "--system " if user[: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
- ssh_path = user[:home] + '/.ssh'
116
- authkeys = ssh_path + '/authorized_keys'
117
-
118
- Dir.exist?(ssh_path) || Dir.mkdir(ssh_path, 0700)
119
- File.chown(user[:uid], user[:gid], ssh_path)
120
- File.open(authkeys, 'a+') do |f|
121
- contents = f.read
122
- user[:authorized_keys].each do |authkey|
123
- if contents.include?(authkey)
124
- puts " - Key already in place: #{authkey}"
125
- else
126
- puts " + Adding authorized_key: #{authkey}"
127
- f.puts authkey
128
- end
129
- end
130
-
131
- f.chown(user[:uid], user[:gid])
132
- f.close
133
- end
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
- sudoer_file = '/etc/sudoers.d/danarchy_deploy-' + user[:username]
138
- File.open(sudoer_file, 'a+') do |f|
139
- if !f.read.include?(user[:sudoer])
140
- puts " |+ Added: '#{user[:sudoer]}'"
141
- f.puts user[:sudoer]
142
- else
143
- puts ' - No change needed'
144
- end
145
-
146
- f.close
147
- end
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
@@ -1,3 +1,3 @@
1
1
  module DanarchyDeploy
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -9,6 +9,7 @@ module DanarchyDeploy
9
9
  require_relative 'danarchy_deploy/templater'
10
10
  require_relative 'danarchy_deploy/users'
11
11
  require_relative 'danarchy_deploy/version'
12
+ require 'time'
12
13
 
13
14
  class LocalDeploy
14
15
  def self.new(deployment, options)
@@ -26,7 +27,7 @@ module DanarchyDeploy
26
27
  deployment = DanarchyDeploy::Users.new(deployment, options)
27
28
  deployment = DanarchyDeploy::Services::Init.new(deployment, options)
28
29
 
29
- deployment[:last_deploy] = DateTime.now.strftime("%Y/%m/%d %H:%M:%S")
30
+ deployment[:last_deploy] = Time.now.strftime("%Y/%m/%d %H:%M:%S")
30
31
  puts "\nFinished Local Deployment at #{deployment[:last_deploy]}!"
31
32
 
32
33
  if options[:deploy_file].end_with?('.json')
@@ -43,13 +44,15 @@ module DanarchyDeploy
43
44
  def self.new(deployment, options)
44
45
  puts "\n" + self.name
45
46
 
46
- options[:working_dir] = options[:deploy_dir] + '/' + deployment[:hostname]
47
+ @working_dir = File.dirname(options[:deploy_file]) + '/'
47
48
  connector = { hostname: deployment[:hostname],
48
49
  ipv4: deployment[:ipv4],
49
50
  ssh_user: deployment[:ssh_user],
50
51
  ssh_key: deployment[:ssh_key] }
51
52
 
53
+ pretend = options[:pretend] ; options[:pretend] = false
52
54
  remote_mkdir(connector, options)
55
+ # asdf_install(connector, options)
53
56
 
54
57
  if options[:dev_gem]
55
58
  puts "\nDev Gem mode: Building and pushing gem..."
@@ -63,6 +66,8 @@ module DanarchyDeploy
63
66
  gem_binary = _locate_gem_binary(connector, options) # this should run before any install; check version too
64
67
  push_templates(connector, options)
65
68
  push_deployment(connector, options)
69
+
70
+ options[:pretend] = pretend
66
71
  deploy_result = remote_LocalDeploy(connector, gem_binary, options)
67
72
 
68
73
  abort("\n ! Deployment failed to complete!") if !deploy_result
@@ -71,15 +76,15 @@ module DanarchyDeploy
71
76
  # remote_cleanup(connector, options) if !options[:pretend]
72
77
 
73
78
  puts "\nRemote deployment complete!"
74
- deployment = JSON.parse(File.read(options[:deploy_file]), symbolize_names: true) if options[:deploy_file].end_with?('.json')
75
- deployment = YAML.load_file(options[:deploy_file]) if options[:deploy_file].end_with?('.yaml')
76
- deployment
79
+ options[:deploy_file].end_with?('.json') ?
80
+ JSON.parse(File.read(options[:deploy_file]), symbolize_names: true) :
81
+ YAML.load_file(options[:deploy_file]) if options[:deploy_file].end_with?('.yaml')
77
82
  end
78
83
 
79
84
  private
80
85
  def self.remote_mkdir(connector, options)
81
- puts "\n > Creating directory: #{options[:working_dir]}"
82
- mkdir_cmd = _ssh_command(connector, "test -d #{options[:working_dir]} && echo 'Directory exists!' || sudo mkdir -vp #{options[:working_dir]}")
86
+ puts "\n > Creating directory: #{@working_dir}"
87
+ mkdir_cmd = _ssh_command(connector, "test -d #{@working_dir} && echo 'Directory exists!' || sudo mkdir -vp #{@working_dir}")
83
88
  mkdir_result = DanarchyDeploy::Helpers.run_command(mkdir_cmd, options)
84
89
 
85
90
  if mkdir_result[:stderr] && ! mkdir_result[:stdout]
@@ -100,12 +105,48 @@ module DanarchyDeploy
100
105
  end
101
106
  end
102
107
 
108
+ # def self.asdf_install(connector, options)
109
+ # versions = JSON.parse(
110
+ # File.read(File.expand_path('../', __dir__) + '/.asdf_versions.json'),
111
+ # symbolize_names: true)
112
+
113
+ # template = {
114
+ # target: '/tmp/asdf.sh_' + Random.hex(6),
115
+ # source: 'builtin::asdf/asdf.sh.erb',
116
+ # variables: versions
117
+ # }
118
+
119
+ # DanarchyDeploy::Templater.new([template], options)
120
+ # push_cmd = _scp_push(connector, template[:target], '/tmp')
121
+ # push_result = DanarchyDeploy::Helpers.run_command(push_cmd, options)
122
+
123
+ # if push_result[:stderr]
124
+ # abort(' ! Asdf push failed!')
125
+ # else
126
+ # puts ' |+ Asdf pushed!'
127
+ # asdf_chown_cmd = _ssh_command(
128
+ # connector,
129
+ # "sudo mv -v #{template[:target]} /etc/profile.d/asdf.sh && " +
130
+ # 'sudo chown -c root:root /etc/profile.d/asdf.sh')
131
+ # asdf_chown_result = DanarchyDeploy::Helpers.run_command(asdf_chown_cmd, options)
132
+ # File.delete(template[:target])
133
+ # end
134
+
135
+ # asdf_current_cmd = _ssh_command(connector, 'sudo -i asdf current')
136
+ # asdf_current_result = DanarchyDeploy::Helpers.run_command(asdf_current_cmd, options)
137
+
138
+ # puts asdf_current_result[:stderr] if asdf_current_result[:stderr]
139
+ # puts asdf_current_result[:stdout]
140
+ # end
141
+
103
142
  def self.gem_install(connector, options)
104
143
  puts "\n > Installing danarchy_deploy on #{connector[:hostname]}"
105
- install_cmd = _ssh_command(connector, 'sudo gem install -f danarchy_deploy')
144
+ install_cmd = _ssh_command(connector, 'sudo -i gem install -f danarchy_deploy')
106
145
  install_result = DanarchyDeploy::Helpers.run_command(install_cmd, options)
107
146
 
108
- if install_result[:stderr]
147
+ if install_result[:stderr] =~ /WARN/i
148
+ puts ' ! ' + install_result[:stderr]
149
+ elsif install_result[:stderr]
109
150
  abort(' ! Gem install failed!')
110
151
  else
111
152
  puts " |+ Gem installed!"
@@ -134,7 +175,7 @@ module DanarchyDeploy
134
175
 
135
176
  def self.dev_gem_install(connector, gem, options)
136
177
  puts "\n > Pushing gem: #{gem} to #{connector[:hostname]}"
137
- push_cmd = _scp_push(connector, gem, options[:deploy_dir])
178
+ push_cmd = _scp_push(connector, gem, options[:deploy_dir])
138
179
  push_result = DanarchyDeploy::Helpers.run_command(push_cmd, options)
139
180
 
140
181
  if push_result[:stderr]
@@ -144,10 +185,12 @@ module DanarchyDeploy
144
185
  end
145
186
 
146
187
  puts "\n > Installing gem: #{gem} on #{connector[:hostname]}"
147
- install_cmd = _ssh_command(connector, "sudo gem install --bindir /usr/local/bin -f #{options[:deploy_dir]}/#{File.basename(gem)}")
188
+ install_cmd = _ssh_command(connector, "sudo -i gem install --bindir /usr/local/bin -f #{options[:deploy_dir]}/#{File.basename(gem)}")
148
189
  install_result = DanarchyDeploy::Helpers.run_command(install_cmd, options)
149
190
 
150
- if install_result[:stderr]
191
+ if install_result[:stderr] =~ /WARN/i
192
+ puts ' ! ' + install_result[:stderr]
193
+ elsif install_result[:stderr]
151
194
  abort(' ! Gem install failed!')
152
195
  else
153
196
  puts ' |+ Gem installed!'
@@ -155,39 +198,39 @@ module DanarchyDeploy
155
198
  end
156
199
 
157
200
  def self.gem_clean(connector, options)
158
- clean_cmd = _ssh_command(connector, 'sudo gem clean danarchy_deploy 2&>/dev/null')
201
+ clean_cmd = _ssh_command(connector, 'sudo -i gem clean danarchy_deploy 2&>/dev/null')
159
202
  system(clean_cmd)
160
203
  end
161
204
 
162
205
  def self.push_templates(connector, options)
163
206
  template_dir = options[:deploy_dir] + '/templates'
164
207
  puts "\n > Pushing templates: #{template_dir}"
165
- push_cmd = _rsync_push(connector, template_dir, template_dir)
208
+ push_cmd = _rsync_push(connector, template_dir, template_dir)
166
209
  push_result = DanarchyDeploy::Helpers.run_command(push_cmd, options)
167
210
 
168
211
  if push_result[:stderr]
169
212
  abort(' ! Templates push failed!')
170
213
  else
171
- puts " |+ Templates pushed to '#{options[:working_dir]}'!"
214
+ puts " |+ Templates pushed to '#{template_dir}'!"
172
215
  end
173
216
  end
174
217
 
175
218
  def self.push_deployment(connector, options)
176
219
  puts "\n > Pushing deployment: #{options[:deploy_file]}"
177
- push_cmd = _rsync_push(connector, options[:working_dir], options[:working_dir])
220
+ push_cmd = _rsync_push(connector, @working_dir, @working_dir)
178
221
  push_result = DanarchyDeploy::Helpers.run_command(push_cmd, options)
179
222
 
180
223
  if push_result[:stderr]
181
224
  abort(' ! Deployment push failed!')
182
225
  else
183
- puts " |+ Deployment pushed to '#{options[:working_dir]}'!"
226
+ puts " |+ Deployment pushed to '#{@working_dir}'!"
184
227
  end
185
228
  end
186
229
 
187
230
  def self.remote_LocalDeploy(connector, gem_binary, options)
188
231
  puts "\n > Running LocalDeploy on #{connector[:hostname]}.\n\n"
189
232
 
190
- deploy_cmd = "sudo #{gem_binary} local "
233
+ deploy_cmd = "sudo -i #{gem_binary} local "
191
234
  deploy_cmd += '--first-run ' if options[:first_run]
192
235
  deploy_cmd += '--ssh-verbose ' if options[:ssh_verbose]
193
236
  deploy_cmd += '--vars-verbose ' if options[:vars_verbose]
@@ -214,7 +257,7 @@ module DanarchyDeploy
214
257
 
215
258
  def self.remote_cleanup(connector, options)
216
259
  puts "\n > Cleaning up: #{options[:deploy_dir]}"
217
- cleanup_cmd = _ssh_command(connector, "sudo rm -rfv #{options[:working_dir]}")
260
+ cleanup_cmd = _ssh_command(connector, "sudo rm -rfv #{@working_dir}")
218
261
  cleanup_result = DanarchyDeploy::Helpers.run_command(cleanup_cmd, options)
219
262
 
220
263
  if cleanup_result[:stderr]
@@ -225,7 +268,7 @@ module DanarchyDeploy
225
268
  end
226
269
 
227
270
  def self._locate_gem_binary(connector, options)
228
- locate_cmd = _ssh_command(connector, 'sudo which danarchy_deploy')
271
+ locate_cmd = _ssh_command(connector, 'sudo -i which danarchy_deploy')
229
272
  locate_result = DanarchyDeploy::Helpers.run_command(locate_cmd, options)
230
273
 
231
274
  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,2 @@
1
+ GRANT ALL PRIVILEGES ON `<%= @variables[:db_name] %>`.`*` TO `<%= @variables[:db_user] %>`@`<%= @variables[:db_host] %>` IDENTIFIED BY `<%= @variables[:db_pass] %>`;
2
+ FLUSH PRIVILEGES;
@@ -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
@@ -9,7 +9,7 @@
9
9
  "package2"
10
10
  ],
11
11
  "system": {
12
- "update": "all || system || packages || none",
12
+ "update": "true || all || system || selected || none || false",
13
13
  "fstab": {
14
14
  "source": "builtin::system/fstab_gentoo_client.erb",
15
15
  "mounts": [
@@ -36,14 +36,13 @@
36
36
  }
37
37
  ]
38
38
  },
39
- "users": [
40
- {
41
- "username": "username",
39
+ "users": {
40
+ "username": {
42
41
  "home": "/home/username",
43
42
  "uid": int,
44
43
  "gid": int,
45
- "sudoer": "username ALL = NOPASSWD: ALL",
46
- "ssh-authorized_keys": [
44
+ "sudoer": ["username ALL=(ALL) NOPASSWD:ALL"],
45
+ "authorized_keys": [
47
46
  "ssh-ed25519 it0C5o6GHC8lxqctpexakfdA5o7LeSe+QbMhIl+GYtZ2OCMFliLsODDrrazR+u2y user@hostname",
48
47
  "ssh-rsa K0APeEvotGunpBrl/LvSAG/gLUldCnOrL60v47QYjuqoGJmM3Fk8V29+8jZPp9Dl user@hostname"
49
48
  ],
@@ -61,7 +60,7 @@
61
60
  }
62
61
  ]
63
62
  }
64
- ],
63
+ },
65
64
  "groups": [
66
65
  {
67
66
  "groupname": "groupname",
@@ -0,0 +1,14 @@
1
+ # Deployed by dAnarchy_deploy: /etc/conf.d/distccd: config file for /etc/init.d/distccd
2
+
3
+ # this is the distccd executable
4
+ DISTCCD_EXEC="/usr/bin/distccd"
5
+
6
+ # this is where distccd will store its pid file
7
+ DISTCCD_PIDFILE="/var/run/distccd/distccd.pid"
8
+
9
+ <%= @variables[:opts] ? 'DISTCCD_OPTS=' + "\"#{@variables[:opts]}\"" : 'DISTCCD_OPTS=""' %>
10
+ <%= @variables[:port] ? 'DISTCCD_OPTS=' + "\"${DISTCCD_OPTS} --port #{@variables[:port]}\"" : 'DISTCCD_OPTS="${DISTCCD_OPTS} --port 3632"' %>
11
+ <%= @variables[:loglevel] ? 'DISTCCD_OPTS=' + "\"${DISTCCD_OPTS} --log-level #{@variables[:loglevel]}\"" : 'DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical"' %>
12
+ <%= @variables[:allow] ? 'DISTCCD_OPTS=' + "\"${DISTCCD_OPTS} --allow #{@variables[:allow]}\"" : '' %>
13
+ <%= @variables[:listen] ? 'DISTCCD_OPTS=' + "\"${DISTCCD_OPTS} --listen #{@variables[:listen]}\"" : '' %>
14
+ <%= @variables[:nice] ? 'DISTCCD_OPTS=' + "\"${DISTCCD_OPTS} -N #{@variables[:nice]}\"" : '' %>
@@ -0,0 +1,2 @@
1
+ # Deployed by dAnarchy_deploy: /etc/distcc/hosts
2
+ <%= @variables[:hosts] ? "#{@variables[:hosts]}" : 'localhost' -%>
@@ -0,0 +1,30 @@
1
+ # Deployed by dAnarchy_deploy: /etc/portage/make.conf
2
+ COMMON_FLAGS="-march=<%= `gcc -march=native -Q --help=target | grep march`.split[1] %> -O2 -pipe"
3
+ CFLAGS="${COMMON_FLAGS}"
4
+ CXXFLAGS="${COMMON_FLAGS}"
5
+ FCFLAGS="${COMMON_FLAGS}"
6
+ FFLAGS="${COMMON_FLAGS}"
7
+
8
+ MAKEOPTS="-j<%= `nproc`.to_i * 2 + 1 %> -l<%= `nproc`.to_i %>"
9
+ CPU_FLAGS_X86="<%= `cpuid2cpuflags`.split(': ').last.chomp %>"
10
+
11
+ <% if !@variables -%>
12
+ USE="bindist logrotate"
13
+ INPUT_DEVICES="evdev keyboard"
14
+ <% else -%>
15
+ <%= @variables[:use] ? 'USE=' + "\"bindist logrotate #{@variables[:use]}\"\n" : "USE=\"bindist logrotate\"\n" -%>
16
+ <%= @variables[:grub] ? 'GRUB_PLATFORMS=' + "\"#{@variables[:grub]}\"\n" : '' -%>
17
+ <%= @variables[:ruby] ? 'RUBY_TARGETS=' + "\"#{@variables[:ruby]}\"\n" : '' -%>
18
+ <%= @variables[:php] ? 'PHP_TARGETS=' + "\"#{@variables[:php]}\"\n" : '' -%>
19
+ <%= @variables[:features] ? 'FEATURES=' + "\"#{@variables[:features]}\"\n" : '' -%>
20
+ <%= @variables[:videocards] ? 'VIDEO_CARDS=' + "\"#{@variables[:videocards]}\"\n" : '' -%>
21
+ <%= @variables[:input] ? 'INPUT_DEVICES=' + "\"#{@variables[:input]}\"\n" : "INPUT_DEVICES=\"evdev keyboard\"\n" -%>
22
+ <% end -%>
23
+
24
+ # This sets the language of build output to English.
25
+ # Please keep this setting intact when reporting bugs.
26
+ LC_MESSAGES=C
27
+
28
+ PORTDIR="/var/db/repos/gentoo"
29
+ DISTDIR="/var/cache/distfiles"
30
+ PKGDIR="/var/cache/binpkgs"
@@ -0,0 +1,3 @@
1
+ # Allow EC algorithms in OpenSSL/OpenSSH (patents blocked with bindist)
2
+ dev-libs/openssl -bindist
3
+ net-misc/openssh -bindist
@@ -0,0 +1,3 @@
1
+ dev-lang/perl doc
2
+ dev-lang/python doc
3
+ dev-lang/ruby doc