danarchy_deploy 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f00a848b7b3326a27f07e661d2a0f79593cd8bb4140664e7fd86de1429a428a5
4
- data.tar.gz: 91d62fdeff9560e8178bfe00b214c15740d53f785003f33a38d10c22878e5be5
3
+ metadata.gz: d4665ec27120f6fda4337da5a2b2cb465511534cef96b47c2a11791076012f64
4
+ data.tar.gz: e12104840e0273bf38d37a0465752ebc5bacc53d2d0f4a5b5783a936f5810afb
5
5
  SHA512:
6
- metadata.gz: afb687e9d4df549f12bb3d14d6acf235020d288617ceba418eee50d7806da84d002491b1beb62056484a71e047aa91cac02b40d60afe7b8a073980550dc52af9
7
- data.tar.gz: 8db9fa38eaedc05cc48074a690176764be983cdf9b18538773ee63d55de1c039a835f3c962df23d6970b725a0299cee9ea81f3aaee0e02c3244451caf46d6552
6
+ metadata.gz: 4bc766ba4a3e8f6e0e691dd1904029f9c08cd6b040146214ae31fb0c18b3a779bae3258b033b1b50205f70c02ebfdbc1fcdd5756ae5ef7b727ce8225397cb4b4
7
+ data.tar.gz: 7b22f9218392944730cec707bbf62cf9cc9c696fd411eccf02e6d7ceff54748b141c76b2b3de6750867287e9221a17f0be08be524a29c58e14b38b6741da4036
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ danarchy_deploy
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.7.2
data/CHANGELOG.md ADDED
@@ -0,0 +1,48 @@
1
+ patch_0.2.6
2
+ - DanarchyDeploy: gem install --bindir
3
+ - DanarchyDeploy: return from each class if not defined in a deployment
4
+ - Services::MySQL: Check for defaults_file instead of /etc/my.cnf, SecureRandom.hex for passwords
5
+ - Services::Init: clean up output and if statement
6
+ - Add RVM .ruby-version .ruby-gemset
7
+ - Rename danarchy_deploy-console to console-dd
8
+ - Add CHANGELOG.md
9
+
10
+ patch_0.2.5
11
+ - Adds Fstab system service
12
+ - Adds Dmcrypt/LVM system service
13
+ - Enforce MongoDB security/limits.d/mongodb.conf if it doesn't exist
14
+ - Clarify some CLI output
15
+ - Ignore first SSH known_hosts error in RemoteDeploy.remote_mkdir
16
+
17
+ patch_0.2.4
18
+ - mongodb limits newlines
19
+
20
+ patch_0.2.2
21
+ - Fix MongoDB so it correctly applies security limits file count
22
+
23
+ release_0.2.0
24
+ - Adds Applicator #wordpress #nginx #phpfpm #ssl
25
+ - Adds Services #init #mongodb #mysql
26
+ - Adds System #centos #debian #gentoo #openssue
27
+
28
+ patch_0.1.6
29
+ - User/Groups commands should use sudo
30
+
31
+ patch_0.1.5
32
+ - Don't upload to couchdb if using a .json/.yaml template
33
+
34
+ patch_0.1.4
35
+ - sudoers.d/ file root owned
36
+
37
+ patch_0.1.3
38
+ - prevents packages from being an empty array
39
+
40
+ patch_0.1.2
41
+ - chown/chmod on ~/.ssh contents
42
+ - fix JSON parse error
43
+
44
+ release_0.1.1
45
+ - Re-order archive extraction and template creation so that written templates aren't overwritten by archive data.
46
+ - Fixes user sudoers.d file creation; a+ append instead of r+ read-write (expects file to exist already).
47
+ - Cleans up package handling for Gentoo and also changes --usepkg to --buildpkg if hostname begins with 'image' or 'template' for binary creation during image builds.
48
+
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- danarchy_deploy (0.2.5)
4
+ danarchy_deploy (0.2.6)
5
5
  danarchy_couchdb (~> 0.1)
6
6
  mongo (~> 2.17)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- bson (4.14.0)
11
+ bson (4.14.1)
12
12
  danarchy_couchdb (0.1.3)
13
13
  mongo (2.17.0)
14
14
  bson (>= 4.8.2, < 5.0.0)
@@ -23,4 +23,4 @@ DEPENDENCIES
23
23
  rake (~> 13.0)
24
24
 
25
25
  BUNDLED WITH
26
- 2.3.3
26
+ 2.3.9
File without changes
data/bin/danarchy_deploy CHANGED
@@ -95,7 +95,7 @@ end
95
95
  if location == 'remote'
96
96
  deployment = DanarchyDeploy::RemoteDeploy.new(deployment, options)
97
97
  elsif location == 'local'
98
- abort('Exiting! Local deployment be run with sudo!') if Process.uid != 0
98
+ abort('Exiting! Local deployment must be run with sudo!') if Process.uid != 0
99
99
  puts "Deploying #{deployment[:hostname]} locally to #{`hostname`.chomp}."
100
100
 
101
101
  if !options[:pretend]
@@ -2,6 +2,7 @@
2
2
  module DanarchyDeploy
3
3
  class Groups
4
4
  def self.new(deployment, options)
5
+ return deployment if ! deployment[:groups]
5
6
  puts "\n" + self.name
6
7
  (groupadd_result, groupdel_result) = nil
7
8
 
@@ -5,6 +5,7 @@ module DanarchyDeploy
5
5
  module Services
6
6
  class Init
7
7
  def self.new(deployment, options)
8
+ return deployment if ! deployment[:services]
8
9
  puts "\n" + self.name
9
10
 
10
11
  deployment[:services].each do |service, params|
@@ -35,16 +36,16 @@ module DanarchyDeploy
35
36
 
36
37
  init_result = init.send(action)
37
38
 
38
- if init_result[:stderr]
39
- if init_result[:stderr].include?('unknown function')
39
+ if stderr = init_result[:stderr]
40
+ if stderr.include?('unknown function')
40
41
  puts " ! Action: #{action} not available for service: #{service}.\n" +
41
42
  " ! A restart may be needed! Otherwise, remove this action from the deployment.\n" +
42
43
  " ! Not taking any action here.\n"
43
44
  else
44
- abort(" ! Action: #{service} #{action} failed!")
45
+ abort(" ! Action: #{action} #{service} failed!")
45
46
  end
46
47
  else
47
- puts " |+ Action: #{service} #{action} succeeded."
48
+ puts " |+ Action: #{action} #{service} succeeded."
48
49
  end
49
50
  end
50
51
  end
@@ -13,7 +13,7 @@ module DanarchyDeploy
13
13
  Mongo::Logger.logger.level = Logger::FATAL
14
14
  mongodb_conf, updated_conf = self.load_mongodb_conf
15
15
  host_port = mongodb_conf['net']['bindIp'].split(',').first + ':' + mongodb_conf['net']['port'].to_s
16
- admin_user, new_admin = self.load_admin_user
16
+ admin_user, new_admin = self.load_admin_user
17
17
 
18
18
  if new_admin == true
19
19
  client = Mongo::Client.new(['127.0.0.1'], database: 'admin')
@@ -49,13 +49,13 @@ module DanarchyDeploy
49
49
  end
50
50
 
51
51
  def self.generate_root_mycnf(mysql, options)
52
- return if File.exist?(mysql[:default_file])
53
- puts " |+ Generating #{mysql[:default_file]} file."
54
- password = SecureRandom.base64(14)
52
+ return if File.exist?(mysql[:defaults_file])
53
+ puts " |+ Generating #{mysql[:defaults_file]} file."
54
+ password = SecureRandom.hex(24)
55
55
  source = options[:deploy_dir] +
56
56
  '/templates/services/mysql/root_my.cnf.erb'
57
57
 
58
- templates = [{ target: mysql[:default_file],
58
+ templates = [{ target: mysql[:defaults_file],
59
59
  source: source,
60
60
  variables: {
61
61
  host: 'localhost',
@@ -11,7 +11,7 @@ module DanarchyDeploy
11
11
  mysql = self.set_parameters(mysql)
12
12
  self.generate_my_cnf(mysql, options)
13
13
 
14
- if File.exist?(mysql[:my_cnf]) && Dir.exist?(mysql[:datadir] + '/mysql')
14
+ if File.exist?(mysql[:defaults_file]) && Dir.exist?(mysql[:datadir])
15
15
  puts " |+ Using existing MySQL service."
16
16
  else
17
17
  MySQL::NewServer.new(os, mysql, options)
@@ -24,8 +24,8 @@ module DanarchyDeploy
24
24
  end
25
25
 
26
26
  def self.set_parameters(mysql)
27
- mysql[:default_file] = mysql[:default_file] ?
28
- mysql[:default_file] :
27
+ mysql[:defaults_file] = mysql[:defaults_file] ?
28
+ mysql[:defaults_file] :
29
29
  '/root/.my.cnf'
30
30
  mysql[:my_cnf] = mysql[:my_cnf] ?
31
31
  mysql[:my_cnf] :
@@ -6,6 +6,7 @@ require_relative 'services/mysql'
6
6
  module DanarchyDeploy
7
7
  module Services
8
8
  def self.new(deployment, options)
9
+ return deployment if ! deployment[:services]
9
10
  puts "\n" + self.name
10
11
 
11
12
  deployment[:services].each do |service, params|
@@ -6,10 +6,14 @@ module DanarchyDeploy
6
6
  return false if cryptsetup.nil?
7
7
  puts "\n" + self.name
8
8
 
9
- # expects object: { "cryptsetup": { "source": "/danarchy/deploy/templates/system/cryptsetup.erb", (optional)
10
- # "volumes": { "vg_name:vg0:/dev/vdb": { "target": "dm-vg0-mongodb",
11
- # "source": "/dev/mapper/vg0-mongodb",
12
- # "key": "/root/vdb_mongodb.key" } } } }
9
+ # expects object: {
10
+ # "cryptsetup": {
11
+ # "source": "/danarchy/deploy/templates/system/cryptsetup.erb", (optional)
12
+ # "volumes": {
13
+ # "vg_name:vg0:/dev/vdb": {
14
+ # "target": "dm-vg0-mongodb",
15
+ # "source": "/dev/mapper/vg0-mongodb",
16
+ # "key": "/root/vdb_mongodb.key" } } } }
13
17
 
14
18
  if os == 'gentoo'
15
19
  DanarchyDeploy::Services::Init.init_manager(os, 'lvmetad', 'enable', options)
@@ -10,6 +10,12 @@ module DanarchyDeploy
10
10
  mount_all(options)
11
11
  end
12
12
 
13
+ def self.mount_all(options)
14
+ puts "\n > Mounting Filesystems"
15
+ mount_result = DanarchyDeploy::Helpers.run_command('mount -a', options)
16
+ abort(' ! Failed to mount filesystems!') if mount_result[:stderr]
17
+ end
18
+
13
19
  private
14
20
  def self.set_config(fstab, options)
15
21
  target = '/etc/fstab'
@@ -49,12 +55,6 @@ module DanarchyDeploy
49
55
  !Dir.exist?(mount[:mountpoint])
50
56
  end
51
57
  end
52
-
53
- def self.mount_all(options)
54
- puts "\n > Mounting Filesystems"
55
- mount_result = DanarchyDeploy::Helpers.run_command('mount -a', options)
56
- abort(' ! Failed to mount filesystems!') if mount_result[:stderr]
57
- end
58
58
  end
59
59
  end
60
60
  end
@@ -10,6 +10,7 @@ module DanarchyDeploy
10
10
  module System
11
11
  def self.new(deployment, options)
12
12
  abort('Operating System not defined! Exiting!') if !deployment[:os]
13
+ return deployment if ! deployment[:system]
13
14
  puts "\n" + self.name
14
15
 
15
16
  installer, updater, cleaner = prep_operating_system(deployment, options)
@@ -32,8 +33,6 @@ module DanarchyDeploy
32
33
  puts cleanup_result[:stdout] if cleanup_result[:stdout]
33
34
  end
34
35
 
35
- DanarchyDeploy::System::Cryptsetup.new(deployment[:os], deployment[:system][:cryptsetup], options)
36
- DanarchyDeploy::System::Fstab.new(deployment[:os], deployment[:system][:fstab], options)
37
36
  deployment
38
37
  end
39
38
 
@@ -52,6 +51,14 @@ module DanarchyDeploy
52
51
  puts "\n > Configuring system templates for #{deployment[:os]}"
53
52
  DanarchyDeploy::Templater.new(deployment[:system][:templates], options)
54
53
  end
54
+
55
+ DanarchyDeploy::System::Cryptsetup.new(deployment[:os], deployment[:system][:cryptsetup], options)
56
+
57
+ if deployment[:system][:fstab]
58
+ DanarchyDeploy::System::Fstab.new(deployment[:os], deployment[:system][:fstab], options)
59
+ else
60
+ DanarchyDeploy::System::Fstab.mount_all(options)
61
+ end
55
62
  end
56
63
 
57
64
  if os.downcase == 'gentoo'
@@ -61,8 +68,8 @@ module DanarchyDeploy
61
68
  elsif os.downcase == 'opensuse'
62
69
  puts 'OpenSUSE is not fully supported yet!'
63
70
  (installer, updater, cleaner) = DanarchyDeploy::System::OpenSUSE.new(deployment, options)
64
- elsif %w[centos redhat].include?(os.downcase)
65
- puts 'CentOS/RedHat is not fully supported yet!'
71
+ elsif %w[fedora centos redhat].include?(os.downcase)
72
+ puts 'Fedora/CentOS/RedHat is not fully supported yet!'
66
73
  (installer, updater, cleaner) = DanarchyDeploy::System::CentOS.new(deployment, options)
67
74
  end
68
75
 
@@ -2,6 +2,7 @@
2
2
  module DanarchyDeploy
3
3
  class Users
4
4
  def self.new(deployment, options)
5
+ return deployment if ! deployment[:users]
5
6
  puts "\n" + self.name
6
7
  (useradd_result, userdel_result, archives_result) = nil
7
8
 
@@ -56,7 +57,6 @@ module DanarchyDeploy
56
57
  user.delete(:username)
57
58
  end
58
59
 
59
- # [useradd_result, userdel_result]
60
60
  deployment
61
61
  end
62
62
 
@@ -1,3 +1,3 @@
1
1
  module DanarchyDeploy
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -21,10 +21,10 @@ module DanarchyDeploy
21
21
  printf("%12s %0s\n", 'Packages:', deployment[:packages].join(', ')) if deployment[:packages]
22
22
 
23
23
  deployment = DanarchyDeploy::System.new(deployment, options)
24
- deployment = DanarchyDeploy::Services.new(deployment, options) if deployment[:services]
25
- deployment = DanarchyDeploy::Groups.new(deployment, options) if deployment[:groups]
26
- deployment = DanarchyDeploy::Users.new(deployment, options) if deployment[:users]
27
- deployment = DanarchyDeploy::Services::Init.new(deployment, options) if deployment[:services]
24
+ deployment = DanarchyDeploy::Services.new(deployment, options)
25
+ deployment = DanarchyDeploy::Groups.new(deployment, options)
26
+ deployment = DanarchyDeploy::Users.new(deployment, options)
27
+ deployment = DanarchyDeploy::Services::Init.new(deployment, options)
28
28
 
29
29
  deployment[:last_deploy] = DateTime.now.strftime("%Y/%m/%d %H:%M:%S")
30
30
  puts "\nFinished Local Deployment at #{deployment[:last_deploy]}!"
@@ -61,7 +61,7 @@ module DanarchyDeploy
61
61
 
62
62
  gem_clean(connector, options)
63
63
  gem_binary = _locate_gem_binary(connector, options) # this should run before any install; check version too
64
- push_temmplates(connector, options)
64
+ push_templates(connector, options)
65
65
  push_deployment(connector, options)
66
66
  deploy_result = remote_LocalDeploy(connector, gem_binary, options)
67
67
 
@@ -144,7 +144,7 @@ module DanarchyDeploy
144
144
  end
145
145
 
146
146
  puts "\n > Installing gem: #{gem} on #{connector[:hostname]}"
147
- install_cmd = _ssh_command(connector, "sudo gem install -f #{options[:deploy_dir]}/#{File.basename(gem)}")
147
+ install_cmd = _ssh_command(connector, "sudo gem install --bindir /usr/local/bin -f #{options[:deploy_dir]}/#{File.basename(gem)}")
148
148
  install_result = DanarchyDeploy::Helpers.run_command(install_cmd, options)
149
149
 
150
150
  if install_result[:stderr]
@@ -159,7 +159,7 @@ module DanarchyDeploy
159
159
  system(clean_cmd)
160
160
  end
161
161
 
162
- def self.push_temmplates(connector, options)
162
+ def self.push_templates(connector, options)
163
163
  template_dir = options[:deploy_dir] + '/templates'
164
164
  puts "\n > Pushing templates: #{template_dir}"
165
165
  push_cmd = _rsync_push(connector, template_dir, template_dir)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danarchy_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan James
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-20 00:00:00.000000000 Z
11
+ date: 2022-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danarchy_couchdb
@@ -71,22 +71,25 @@ description: DanarchyDeploy intends to simplify Gentoo Linux (and other distro)
71
71
  email:
72
72
  - dan@danarchy.me
73
73
  executables:
74
+ - console-dd
74
75
  - danarchy_deploy
75
- - danarchy_deploy-console
76
76
  - setup
77
77
  extensions: []
78
78
  extra_rdoc_files: []
79
79
  files:
80
80
  - ".gitignore"
81
81
  - ".rspec"
82
+ - ".ruby-gemset"
83
+ - ".ruby-version"
82
84
  - ".travis.yml"
85
+ - CHANGELOG.md
83
86
  - Gemfile
84
87
  - Gemfile.lock
85
88
  - LICENSE.txt
86
89
  - README.md
87
90
  - Rakefile
91
+ - bin/console-dd
88
92
  - bin/danarchy_deploy
89
- - bin/danarchy_deploy-console
90
93
  - bin/setup
91
94
  - danarchy_deploy.gemspec
92
95
  - lib/danarchy_deploy.rb
@@ -144,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
147
  - !ruby/object:Gem::Version
145
148
  version: '0'
146
149
  requirements: []
147
- rubygems_version: 3.2.33
150
+ rubygems_version: 3.1.4
148
151
  signing_key:
149
152
  specification_version: 4
150
153
  summary: Pushes deployments locally or remotely based on a JSON/YAML/CouchDB template.