fulmar 1.5.0 → 1.5.1
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/lib/fulmar/{service → domain/service}/helper/common_helper.rb +0 -0
- data/lib/fulmar/{service → domain/service}/helper/database_helper.rb +0 -0
- data/lib/fulmar/{service → domain/service}/helper/dependencies_helper.rb +0 -0
- data/lib/fulmar/{service → domain/service}/helper/flow_helper.rb +0 -0
- data/lib/fulmar/domain/service/helper/vhost_helper.rb +21 -0
- data/lib/fulmar/domain/task/base.rake +8 -3
- data/lib/fulmar/domain/task/optional/vhost.rb +74 -0
- data/lib/fulmar/infrastructure/service/copy_service.rb +2 -2
- data/lib/fulmar/infrastructure/service/git_service.rb +1 -1
- data/lib/fulmar/task_manager.rb +0 -2
- data/lib/fulmar/version.rb +1 -1
- metadata +8 -7
- data/lib/fulmar/domain/task/vhost.rake +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bebeb9c011e4edea9e286d3c043eda55450a8b0
|
4
|
+
data.tar.gz: ba575c2d25770c7bc6cba9a8c15f109ee0882e53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50d1eda6ab45889dfb9339c150e341ab7da250fc3d9537c5ccddb21e2e9336348cc85fd0c7bf7e5c79edee432dbe120804066aca15c4333f26f64a8abbde1fae
|
7
|
+
data.tar.gz: ace82db763333502091badee3701645ee686fefa59987dc2b87a84f3a431e316faf4e979155bd1297ca193e18386935723c8884896d84822da0314023b097749
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Fulmar
|
2
|
+
module Domain
|
3
|
+
module Service
|
4
|
+
module Helper
|
5
|
+
# Provides access helper to the database service from within a task
|
6
|
+
module VhostHelper
|
7
|
+
def vhost_name
|
8
|
+
branch = git.current_branch
|
9
|
+
match = branch.match(/f\d+_([a-zA-Z0-9]+)/)
|
10
|
+
if match
|
11
|
+
match[1]
|
12
|
+
else
|
13
|
+
error "Cannot deploy branch '#{branch}'"
|
14
|
+
fail 'Branch must match specification for feature branches (f1234_name)'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,16 +1,21 @@
|
|
1
|
+
require 'fulmar/domain/service/helper/common_helper'
|
1
2
|
include Fulmar::Domain::Service::Helper::CommonHelper
|
2
3
|
|
3
4
|
if configuration.feature? :database
|
4
|
-
require 'fulmar/service/helper/database_helper'
|
5
|
+
require 'fulmar/domain/service/helper/database_helper'
|
5
6
|
include Fulmar::Domain::Service::Helper::DatabaseHelper
|
6
7
|
end
|
7
8
|
|
8
9
|
if configuration.feature? :flow
|
9
|
-
require 'fulmar/service/helper/flow_helper'
|
10
|
+
require 'fulmar/domain/service/helper/flow_helper'
|
10
11
|
include Fulmar::Domain::Service::Helper::FlowHelper
|
11
12
|
end
|
12
13
|
|
13
14
|
if full_configuration[:dependencies].any?
|
14
|
-
require 'fulmar/service/helper/dependencies_helper'
|
15
|
+
require 'fulmar/domain/service/helper/dependencies_helper'
|
15
16
|
include Fulmar::Domain::Service::Helper::DependenciesHelper
|
17
|
+
end
|
18
|
+
|
19
|
+
if configuration.feature?(:vhost) && configuration.any? { |data| !data[:vhost_template].blank? }
|
20
|
+
require 'fulmar/domain/task/optional/vhost'
|
16
21
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'fulmar/domain/service/helper/vhost_helper'
|
2
|
+
include Fulmar::Domain::Service::Helper::VhostHelper
|
3
|
+
|
4
|
+
VHOST_DEFAULT_CONFIG = {
|
5
|
+
webserver: 'nginx',
|
6
|
+
sites_enabled_dir: '../sites-enabled',
|
7
|
+
|
8
|
+
}
|
9
|
+
|
10
|
+
vhost_count = 0
|
11
|
+
configuration.each { |_env, _target, data| vhost_count += 1 unless data[:vhost_template].blank? }
|
12
|
+
|
13
|
+
namespace :vhost do
|
14
|
+
configuration.each do |env, target, data|
|
15
|
+
next if data[:vhost_template].blank?
|
16
|
+
|
17
|
+
desc "Create a vhost for #{env}"
|
18
|
+
task (vhost_count > 1 ? "create:#{env}" : 'create') do
|
19
|
+
configuration.environment = env
|
20
|
+
configuration.target = target
|
21
|
+
configuration.merge(VHOST_DEFAULT_CONFIG)
|
22
|
+
|
23
|
+
# Store remote_path for recovery
|
24
|
+
remote_path = configuration[:remote_path]
|
25
|
+
|
26
|
+
# Set some default variables:
|
27
|
+
configuration[:sites_available_dir] ||= "/etc/#{configuration[:webserver]}/sites-available"
|
28
|
+
configuration[:remote_path] = configuration[:sites_available_dir]
|
29
|
+
configuration[:vhost_name] = vhost_name
|
30
|
+
|
31
|
+
render_templates
|
32
|
+
rendered_vhost_config = File.dirname(configuration[:local_path] + '/' + configuration[:vhost_template]) + \
|
33
|
+
'/' + File.basename(configuration[:vhost_template], '.erb')
|
34
|
+
config_file_name = "#{File.dirname(rendered_vhost_config)}/auto_vhost_#{configuration[:vhost_name]}.conf"
|
35
|
+
FileUtils.mv rendered_vhost_config, config_file_name
|
36
|
+
upload config_file_name
|
37
|
+
config_remote_path = configuration[:sites_available_dir] + '/' + File.basename(config_file_name)
|
38
|
+
remote_shell.run [
|
39
|
+
"rm -f #{configuration[:sites_enabled_dir]}/#{File.basename(config_file_name)}", # remove any existing link
|
40
|
+
"ln -s #{config_remote_path} #{configuration[:sites_enabled_dir]}/#{File.basename(config_file_name)}",
|
41
|
+
"service #{configuration[:webserver]} reload"
|
42
|
+
]
|
43
|
+
|
44
|
+
# recover remote path
|
45
|
+
configuration[:remote_path] = remote_path
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "List existing vhosts for #{env}"
|
49
|
+
task (vhost_count > 1 ? "list:#{env}" : 'list') do
|
50
|
+
configuration.environment = env
|
51
|
+
configuration.target = target
|
52
|
+
|
53
|
+
remote_shell.run 'ls -1'
|
54
|
+
remote_shell.last_output.each do |line|
|
55
|
+
match = line.match(/auto_vhost_(.*)\.conf/)
|
56
|
+
if match
|
57
|
+
name = match[1]
|
58
|
+
puts "- #{name}, delete via 'fulmar vhost:delete[#{name}]'"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "Delete a vhost for #{env}"
|
64
|
+
task (vhost_count > 1 ? "delete:#{env}" : 'delete'), [:name] do |_t, argv|
|
65
|
+
configuration.environment = env
|
66
|
+
configuration.target = target
|
67
|
+
|
68
|
+
remote_shell.run [
|
69
|
+
"rm auto_vhost_#{argv[:name]}.conf",
|
70
|
+
"service #{configuration[:webserver] || 'nginx'} reload"
|
71
|
+
]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -9,7 +9,7 @@ module Fulmar
|
|
9
9
|
# @param [String] remote_host SSH hostname
|
10
10
|
# @param [String] remote_dir remote directory
|
11
11
|
def self.upload(shell, local_file, remote_host, remote_dir)
|
12
|
-
if shell.run "scp #{local_file} #{remote_host}:#{remote_dir.chomp('/')}/"
|
12
|
+
if shell.run "scp -r #{local_file} #{remote_host}:#{remote_dir.chomp('/')}/"
|
13
13
|
"#{remote_dir.chomp('/')}/#{File.basename(local_file)}"
|
14
14
|
end
|
15
15
|
end
|
@@ -20,7 +20,7 @@ module Fulmar
|
|
20
20
|
# @param [String] remote_file remote directory
|
21
21
|
# @param [String] local_dir local filename, should be absolute
|
22
22
|
def self.download(shell, remote_host, remote_file, local_dir = '.')
|
23
|
-
if shell.run "scp #{remote_host}:#{remote_file} #{local_dir.chomp('/')}/"
|
23
|
+
if shell.run "scp -r #{remote_host}:#{remote_file} #{local_dir.chomp('/')}/"
|
24
24
|
"#{local_dir.chomp('/')}/#{File.basename(remote_file)}"
|
25
25
|
end
|
26
26
|
end
|
@@ -29,7 +29,7 @@ module Fulmar
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
@git = Rugged::Repository.new(@config[:local_path]) # :log => Logger.new(STDOUT)
|
32
|
+
@git = Rugged::Repository.new(@config[:git_path].blank? ? @config[:local_path] : @config[:git_path]) # :log => Logger.new(STDOUT)
|
33
33
|
end
|
34
34
|
|
35
35
|
def branches
|
data/lib/fulmar/task_manager.rb
CHANGED
@@ -8,8 +8,6 @@ require 'fulmar/domain/service/initialization_service'
|
|
8
8
|
require 'fulmar/domain/service/application_service'
|
9
9
|
require 'fulmar/domain/service/configuration_service'
|
10
10
|
require 'fulmar/domain/service/config_rendering_service'
|
11
|
-
|
12
|
-
require 'fulmar/service/helper/common_helper'
|
13
11
|
require 'fulmar/domain/service/file_sync_service'
|
14
12
|
|
15
13
|
require 'fulmar/infrastructure/service/composer_service'
|
data/lib/fulmar/version.rb
CHANGED
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: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Siegl
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -142,13 +142,18 @@ files:
|
|
142
142
|
- lib/fulmar/domain/service/configuration_service.rb
|
143
143
|
- lib/fulmar/domain/service/dependency_service.rb
|
144
144
|
- lib/fulmar/domain/service/file_sync_service.rb
|
145
|
+
- lib/fulmar/domain/service/helper/common_helper.rb
|
146
|
+
- lib/fulmar/domain/service/helper/database_helper.rb
|
147
|
+
- lib/fulmar/domain/service/helper/dependencies_helper.rb
|
148
|
+
- lib/fulmar/domain/service/helper/flow_helper.rb
|
149
|
+
- lib/fulmar/domain/service/helper/vhost_helper.rb
|
145
150
|
- lib/fulmar/domain/service/initialization_service.rb
|
146
151
|
- lib/fulmar/domain/task/base.rake
|
147
152
|
- lib/fulmar/domain/task/console.rake
|
148
153
|
- lib/fulmar/domain/task/database_sync.rake
|
149
154
|
- lib/fulmar/domain/task/environment.rake
|
155
|
+
- lib/fulmar/domain/task/optional/vhost.rb
|
150
156
|
- lib/fulmar/domain/task/versions.rake
|
151
|
-
- lib/fulmar/domain/task/vhost.rake
|
152
157
|
- lib/fulmar/infrastructure/service/composer_service.rb
|
153
158
|
- lib/fulmar/infrastructure/service/copy_service.rb
|
154
159
|
- lib/fulmar/infrastructure/service/database/database_service.rb
|
@@ -161,10 +166,6 @@ files:
|
|
161
166
|
- lib/fulmar/infrastructure/service/transfer/tar.rb
|
162
167
|
- lib/fulmar/infrastructure/service/tunnel_service.rb
|
163
168
|
- lib/fulmar/service/bootstrap_service.rb
|
164
|
-
- lib/fulmar/service/helper/common_helper.rb
|
165
|
-
- lib/fulmar/service/helper/database_helper.rb
|
166
|
-
- lib/fulmar/service/helper/dependencies_helper.rb
|
167
|
-
- lib/fulmar/service/helper/flow_helper.rb
|
168
169
|
- lib/fulmar/service/helper_service.rb
|
169
170
|
- lib/fulmar/service/logger_service.rb
|
170
171
|
- lib/fulmar/task_manager.rb
|
@@ -1,55 +0,0 @@
|
|
1
|
-
if configuration.any? { |data| data[:type] == 'vhost' }
|
2
|
-
namespace :vhost do
|
3
|
-
configuration.each do |env, target, data|
|
4
|
-
next if data[:type] != 'vhost'
|
5
|
-
|
6
|
-
desc "Create a vhost for #{env}"
|
7
|
-
task :create do
|
8
|
-
configuration.environment = env
|
9
|
-
configuration.target = target
|
10
|
-
branch = git.current_branch
|
11
|
-
match = branch.match(/f\d+_([a-zA-Z0-9]+)/)
|
12
|
-
unless match
|
13
|
-
STDERR.puts "Cannot deploy branch '#{branch}'"
|
14
|
-
return
|
15
|
-
end
|
16
|
-
configuration[:branch_name] = branch
|
17
|
-
configuration[:vhost_name] = match[1]
|
18
|
-
render_templates
|
19
|
-
upload configuration[:vhost_template]
|
20
|
-
sites_enabled_dir = configuration[:sites_enabled_dir] || '../sites_enabled'
|
21
|
-
remote_shell.run [
|
22
|
-
"ln -s #{configuration[:vhost_template]} #{sites_enabled_dir}/#{configuration[:vhost_template]}",
|
23
|
-
"service #{configuration[:webserver] || 'nginx'} reload"
|
24
|
-
]
|
25
|
-
end
|
26
|
-
|
27
|
-
desc "List existing vhosts for #{env}"
|
28
|
-
task :list do
|
29
|
-
configuration.environment = env
|
30
|
-
configuration.target = target
|
31
|
-
|
32
|
-
remote_shell.run 'ls -1'
|
33
|
-
remote_shell.last_output.each do |line|
|
34
|
-
match = line.match(/auto_vhost_(.*)\.conf/)
|
35
|
-
if match
|
36
|
-
name = match[1]
|
37
|
-
puts "- #{name}, delete via 'fulmar vhost:delete[#{name}]'"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
desc "Delete a vhost for #{env}"
|
43
|
-
task :delete, [:name] do |_t, argv|
|
44
|
-
configuration.environment = env
|
45
|
-
configuration.target = target
|
46
|
-
|
47
|
-
remote_shell.run [
|
48
|
-
"rm auto_vhost_#{argv[:name]}.conf",
|
49
|
-
"service #{configuration[:webserver] || 'nginx'} reload"
|
50
|
-
]
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|