fulmar 2.0.0 → 2.0.1

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
  SHA1:
3
- metadata.gz: e8d6270f2a2b407f32d9419cd4bb55c228138b8e
4
- data.tar.gz: 2c820de490c174e1c7a0df5db92434fe1a3f3302
3
+ metadata.gz: b109fec07e1c8f289643c435c31842bb97e844ee
4
+ data.tar.gz: 1464b61a64c4688257d3a8bf31a43a0c530d0c29
5
5
  SHA512:
6
- metadata.gz: 308c77aa59ef61e622a7988c5bbafb86b76694408d5d6b112e311813a9175c34260aff4954449f358e3722de481ff3570ac79c3e21d6c3ef904be72fbab9ada9
7
- data.tar.gz: ae114e84ce4907f2feefe402f1409cbbfe76497c3e47dc15dbe676964df877150bf22f14dd7c763963fe4be954e9997e571c32979a7457c7d067a0ceb7255966
6
+ metadata.gz: 3aa757adae168d75ca1aea2bb8db89469ff8efe355e4ec52a9e9f97aac505d2b8f4b7485ac311039022893f5a5d5562c2d006174cf6db2fd753ac15aa2692679
7
+ data.tar.gz: b1da4f12f9971c59c6d4bae2cd08ce234714ff9abfca5d3b1d01d15ea92b38b84d4dd634d3710a174d3c164ba4431e7b628bf1616e52d5136120bb4360361344
data/README.md CHANGED
@@ -14,6 +14,14 @@ compatible (i.e. database).
14
14
 
15
15
  It has (yet limited) support for MySQL / MariaDB and git.
16
16
 
17
+ ## Warning
18
+
19
+ Version 1.10.0 of Fulmar removes some features that we (CORE4) rarely used and which
20
+ caused the deployments to slow down the gems needed to be compiled against the
21
+ installed libraries. If you need support to query databases (more than just dumps)
22
+ or use dependencies, you will need to explicitly specify version `~> 1.9.0`.
23
+ Fulmar 2.0 will support these features via plugins.
24
+
17
25
  ## Prerequisites
18
26
 
19
27
  Fulmar 2.0 runs with Ruby >= 2.2.2. Plugins like [mariadb](https://github.com/CORE4/fulmar-plugin-mariadb) might have
@@ -50,7 +58,7 @@ several files.
50
58
  $ mkdir Fulmar
51
59
  $ touch Fulmar/project.config.yml
52
60
 
53
- You can now now test your configuration.
61
+ You can now test your configuration.
54
62
 
55
63
  $ fulmar test:config
56
64
 
@@ -23,7 +23,7 @@ module Fulmar
23
23
  hosts: {},
24
24
  }
25
25
 
26
- include Singleton
26
+ include ::Singleton
27
27
 
28
28
  attr_reader :environment, :target
29
29
  attr_accessor :load_user_config, :debug
@@ -99,7 +99,7 @@ module Fulmar
99
99
  def check_version(version)
100
100
  return if version.nil?
101
101
  unless Gem::Dependency.new('', version).match?('', Fulmar::VERSION)
102
- fail "Project requires a newer version of fulmar: #{version}"
102
+ fail "Project requires another version of fulmar: #{version}"
103
103
  end
104
104
  end
105
105
  end
@@ -3,4 +3,4 @@ include Fulmar::Domain::Service::Helper::CommonHelper
3
3
 
4
4
  Fulmar::Domain::Service::PluginService.instance.helpers.each do |helper|
5
5
  include helper
6
- end
6
+ end
@@ -1,46 +1,50 @@
1
1
  include Fulmar::Domain::Service::Helper::CommonHelper
2
2
 
3
- namespace :versions do
4
- @versioned_servers = {}
3
+ @versioned_servers = {}
5
4
 
6
- config.each do |env, target, config|
7
- @versioned_servers["#{env}:#{target}"] = config if config[:type].to_s == 'rsync_with_versions'
8
- end
5
+ config.each do |env, target, config|
6
+ @versioned_servers["#{env}:#{target}"] = config if config[:type].to_s == 'rsync_with_versions'
7
+ end
9
8
 
10
- unless @versioned_servers.empty?
9
+ unless @versioned_servers.empty?
11
10
 
12
- @versioned_servers.each_key do |env|
13
- target_count = @versioned_servers.keys.reduce(0) { |a, e| e.split(':').first == env.split(':').first ? a + 1 : a }
11
+ @versioned_servers.each_key do |env|
12
+ target_count = @versioned_servers.keys.reduce(0) { |a, e| e.split(':').first == env.split(':').first ? a + 1 : a }
14
13
 
15
- task_environment = (target_count > 1 ? env : env.split(':').first)
14
+ task_environment = (target_count > 1 ? env : env.split(':').first)
16
15
 
17
- namespace :list do
16
+ namespace :list do
17
+ namespace :versions do
18
18
  # Count of there are multiple targets within the environment
19
19
  # if not, we can omit the target name in the task and shorten it a bit
20
20
  # This should apply for almost all cases.
21
21
 
22
22
  desc "List available versions for environment/target \"#{env}\""
23
23
  task task_environment do
24
- config.environment = env.split(':').first
25
- config.target = env.split(':').last
24
+ config.environment = env.split(':').first.to_sym
25
+ config.target = env.split(':').last.to_sym
26
26
  file_sync.list_releases(false).each { |item| puts item }
27
27
  end
28
28
  end
29
+ end
29
30
 
30
- namespace :clean do
31
+ namespace :clean do
32
+ namespace :versions do
31
33
  desc "Delete obsolete versions for target \"#{env}\""
32
34
  task task_environment do
33
- config.environment = env.split(':').first
34
- config.target = env.split(':').last
35
+ config.environment = env.split(':').first.to_sym
36
+ config.target = env.split(':').last.to_sym
35
37
  file_sync.cleanup
36
38
  end
37
39
  end
40
+ end
38
41
 
39
- namespace :revert do
42
+ namespace :revert do
43
+ namespace :versions do
40
44
  desc "Revert to the previous version for \"#{env}\""
41
45
  task task_environment do
42
- config.environment = env.split(':').first
43
- config.target = env.split(':').last
46
+ config.environment = env.split(':').first.to_sym
47
+ config.target = env.split(':').last.to_sym
44
48
  error 'Cannot revert to previous version.' unless file_sync.revert
45
49
  end
46
50
  end
@@ -24,7 +24,7 @@ module Fulmar
24
24
  exclude_file: nil,
25
25
  chown: nil,
26
26
  chmod: nil,
27
- delete: true
27
+ delete: true
28
28
  },
29
29
  symlinks: {},
30
30
  limit_releases: 5,
@@ -56,7 +56,10 @@ module Fulmar
56
56
  def transfer
57
57
  prepare unless @prepared
58
58
 
59
- create_paths && @local_shell.run(rsync_command) && copy_temp_to_release && add_shared
59
+ fail 'Deployment failed when trying to prepare remote directories for sync.' unless create_paths
60
+ fail 'Deployment failed. Cannot sync files.' unless @local_shell.run(rsync_command)
61
+ fail 'Deployment failed when trying to move file from temporary upload dir.' unless copy_temp_to_release
62
+ fail 'Deployment failed when creating symlinks for shared folders' unless add_shared
60
63
  end
61
64
 
62
65
  # Publishes the current release (i.e. sets the 'current' symlink)
@@ -153,7 +156,7 @@ module Fulmar
153
156
  # Builds the rsync command
154
157
  # @return [String] the command
155
158
  def rsync_command
156
- options = ['-rl']
159
+ options = %w(-rl --delete-excluded)
157
160
  options << rsync_excludes if rsync_excludes
158
161
  options << "--exclude-from='#{@config[:rsync][:exclude_file]}'" if @config[:rsync][:exclude_file]
159
162
  options << "--chown='#{@config[:rsync][:chown]}'" if @config[:rsync][:chown]
@@ -166,7 +169,7 @@ module Fulmar
166
169
  # Copies the data from the sync temp to the actual release directory
167
170
  # @return [true, false] success
168
171
  def copy_temp_to_release
169
- @remote_shell.run "cp -pr #{@config[:temp_dir]} #{release_dir}"
172
+ @remote_shell.run "cp -pR #{@config[:temp_dir]} #{release_dir}"
170
173
  end
171
174
 
172
175
  # Set the symlink to the given release or the return value of release_dir() otherwise
@@ -187,24 +190,23 @@ module Fulmar
187
190
  # @return [true, false] success
188
191
  def add_shared
189
192
  commands = [] # Collect all remote commands first, then execute them in one step to avoid reconnecting very often
190
- @config[:shared].each do |dir|
191
- commands << "mkdir -p \"#{release_dir}/#{dir}\""
193
+ @config[:shared].each do |path|
194
+ commands << "mkdir -p \"#{release_dir}/#{File.dirname(path)}\""
192
195
 
193
- unless remote_dir_exists?("#{@config[:shared_dir]}/#{dir}")
194
- commands << "mkdir -p \"#{@config[:shared_dir]}/#{File.dirname(dir)}\""
195
- commands << "cp -pr \"#{release_dir}/#{dir}\" \"#{@config[:shared_dir]}/#{File.dirname(dir)}\""
196
+ unless remote_path_exists?("#{@config[:shared_dir]}/#{path}")
197
+ commands << "mkdir -p \"#{@config[:shared_dir]}/#{path}\""
196
198
  end
197
199
 
198
- commands << "rm -fr \"#{release_dir}/#{dir}\""
199
- commands << "mkdir -p \"#{release_dir}/#{File.dirname(dir)}\""
200
- commands << "ln -s \"#{@config[:remote_path]}/#{@config[:shared_dir]}/#{dir}\" \"#{release_dir}/#{dir}\""
200
+ commands << "rm -fr \"#{release_dir}/#{path}\""
201
+ commands << "mkdir -p \"#{release_dir}/#{File.dirname(path)}\""
202
+ commands << "ln -s \"#{@config[:remote_path]}/#{@config[:shared_dir]}/#{path}\" \"#{release_dir}/#{path}\""
201
203
  end
202
204
 
203
205
  @remote_shell.run commands if commands.length > 0
204
206
  end
205
207
 
206
- def remote_dir_exists?(dir)
207
- @remote_shell.run "test -d \"#{dir}\""
208
+ def remote_path_exists?(dir)
209
+ @remote_shell.run "test -e \"#{dir}\""
208
210
  end
209
211
  end
210
212
  end
@@ -1,4 +1,4 @@
1
1
  # Provides a global version number
2
2
  module Fulmar
3
- VERSION = '2.0.0'
3
+ VERSION = '2.0.1'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fulmar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Siegl
@@ -112,7 +112,6 @@ files:
112
112
  - lib/fulmar/domain/model/project.rb
113
113
  - lib/fulmar/domain/service/config_test_service.rb
114
114
  - lib/fulmar/domain/service/config_tests/hosts.rb
115
- - lib/fulmar/domain/service/config_tests/mariadb.rb
116
115
  - lib/fulmar/domain/service/config_tests/paths.rb
117
116
  - lib/fulmar/domain/service/config_tests/project.rb
118
117
  - lib/fulmar/domain/service/configuration_service.rb
@@ -1,19 +0,0 @@
1
- # Move this file into the plugin
2
-
3
- target_test 'mariadb is loaded' do |config|
4
- if config[:type] == :mariadb && !config.plugins.include?(:mariadb)
5
- next {
6
- severity: :warning,
7
- message: 'config uses mysql/mariadb but your config is missing the maria plugin'
8
- }
9
- end
10
- end
11
-
12
- target_test 'database name exists' do |config|
13
- if config.plugins.include?(:mariadb) && config[:maria] && config[:maria][:database].blank?
14
- next {
15
- severity: :error,
16
- message: 'config is missing a database name in maria:database'
17
- }
18
- end
19
- end