ya_queen_role_fontana 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +6 -0
- data/lib/ya_queen_role_fontana/apisrv.rb +47 -0
- data/lib/ya_queen_role_fontana/asset.rb +47 -0
- data/lib/ya_queen_role_fontana/config.rb +15 -0
- data/lib/ya_queen_role_fontana/configsrv_production.rb +33 -0
- data/lib/ya_queen_role_fontana/configsrv_sandbox.rb +45 -0
- data/lib/ya_queen_role_fontana/gotool_production.rb +43 -0
- data/lib/ya_queen_role_fontana/gotool_sandbox.rb +57 -0
- data/lib/ya_queen_role_fontana/manage.rb +77 -0
- data/lib/ya_queen_role_fontana/mongo.rb +32 -0
- data/lib/ya_queen_role_fontana/tengine.rb +35 -0
- data/lib/ya_queen_role_fontana/title_app_production.rb +21 -0
- data/lib/ya_queen_role_fontana/title_app_sandbox.rb +39 -0
- data/lib/ya_queen_role_fontana/version.rb +3 -0
- data/lib/ya_queen_role_fontana.rb +32 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/ya_queen_role_fontana_spec.rb +11 -0
- data/ya_queen_role_fontana.gemspec +26 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8ac2476336ec6ba5a9235a2ab41e768122633fbd
|
4
|
+
data.tar.gz: 23c4082cbf027b542d072818a0512d2a9d279feb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6751b22a7078104521317ea430a452eed2b3191edb8e2ad349adc5a650b4f176f3c2b1458d3e87a04d7fb418bb22d57171b260cc762ae64554de7cd48ed4365a
|
7
|
+
data.tar.gz: 11648f486316a850fd7590404bd9a896b1402c3bdfdf86cdcbbb68473d85d354332b1c100ce7d817166ff800fa67ef344abfd8cf41b58cb12f09b746b4ccb447
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 akima
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# YaQueenRoleFontana
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'ya_queen_role_fontana'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install ya_queen_role_fontana
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "ya_queen_role_fontana"
|
3
|
+
|
4
|
+
require "ya_queen"
|
5
|
+
|
6
|
+
module YaQueenRoleFontana
|
7
|
+
class Apisrv < YaQueen::Base
|
8
|
+
|
9
|
+
def implement_each_task(host, options)
|
10
|
+
role :web, host
|
11
|
+
role :app, host
|
12
|
+
role :apisrv, host
|
13
|
+
## deploy:assets:precompile をさせない
|
14
|
+
## assets_role を空にするだけでは no matching servers でエラーになる。HOSTFILTERをつけることで no matching servers でも先に進めるようになる。
|
15
|
+
set :assets_role, []
|
16
|
+
ENV['HOSTFILTER'] = ENV.has_key?('HOSTFILTER') ? ENV['HOSTFILTER'] + ",#{host}" : host
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def implement_common_task
|
21
|
+
set :user, config['user']
|
22
|
+
set :deploy_to, config['deploy_to']
|
23
|
+
set :gemfile_name, "ApiServer"
|
24
|
+
set :bundle_dir, "./vendor/bundle"
|
25
|
+
set :bundle_without, [:development, :test, :deploy]
|
26
|
+
set :scm, :none
|
27
|
+
set :repository, File.expand_path("../../", File.dirname(__FILE__))
|
28
|
+
|
29
|
+
set :workspaces, config["workspaces"]
|
30
|
+
set :workspaces_scm , config["workspaces"]["scm"]
|
31
|
+
set :workspaces_runtime, config["workspaces"]["runtime"]
|
32
|
+
|
33
|
+
if config.has_key?('newrelic')
|
34
|
+
set :newrelic_license_key, config['newrelic']['license_key'] unless exists?(:newrelic_license_key)
|
35
|
+
set :newrelic_agent_enabled, config['newrelic']['agent_enabled'] unless exists?(:newrelic_agent_enabled)
|
36
|
+
set :newrelic_app_name, config['newrelic']['app_name'] unless exists?(:newrelic_app_name)
|
37
|
+
end
|
38
|
+
|
39
|
+
# mongoid.yml のテンプレート
|
40
|
+
# .erb以外が設定されている場合は、config/mongoid.ymlとしてこのファイル(の中身)をアップロードします。
|
41
|
+
set :mongoid_yml_template, "config/mongoid.yml"
|
42
|
+
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "ya_queen_role_fontana"
|
3
|
+
|
4
|
+
require "ya_queen"
|
5
|
+
|
6
|
+
module YaQueenRoleFontana
|
7
|
+
class Asset < YaQueen::Base
|
8
|
+
|
9
|
+
def implement_each_task(host, options)
|
10
|
+
role :web, host
|
11
|
+
role :asset, host
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def implement_common_task
|
16
|
+
set :user, config['user']
|
17
|
+
set :deploy_to, config['deploy_to']
|
18
|
+
|
19
|
+
# デプロイと言っても通常のdeployの仕組みは使わないので、この辺の設定は不要
|
20
|
+
# set :scm, :none
|
21
|
+
# set :repository, File.expand_path("../../", File.dirname(__FILE__))
|
22
|
+
|
23
|
+
unless defined?(::Rails)
|
24
|
+
|
25
|
+
m = Module.new do
|
26
|
+
def self.root
|
27
|
+
unless @root
|
28
|
+
@root = Object.new
|
29
|
+
def @root.join(path)
|
30
|
+
File.join(File.expand_path("../../..", __FILE__), path)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
@root
|
34
|
+
end
|
35
|
+
end
|
36
|
+
Object.const_set(:Rails, m)
|
37
|
+
end
|
38
|
+
|
39
|
+
path = Rails.root.join("config/asset_drivers.yml.erb").to_s
|
40
|
+
asset_drivers_config = YAML.load(ERB.new(File.read( path )).result)
|
41
|
+
set :deploy_from, asset_drivers_config["file"]["file_path"]
|
42
|
+
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "ya_queen_role_fontana"
|
2
|
+
|
3
|
+
require "ya_queen"
|
4
|
+
|
5
|
+
module YaQueenRoleFontana
|
6
|
+
class Config < YaQueen::Config
|
7
|
+
|
8
|
+
def role(name, options = {})
|
9
|
+
if options && (class_name = options.delete(:class_name))
|
10
|
+
options[:class] = YaQueenRoleFontana.const_get(class_name.to_sym)
|
11
|
+
end
|
12
|
+
define_server_tasks(name, options)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "ya_queen_role_fontana"
|
3
|
+
|
4
|
+
require "ya_queen"
|
5
|
+
|
6
|
+
module YaQueenRoleFontana
|
7
|
+
class ConfigsrvProduction < YaQueen::Base
|
8
|
+
|
9
|
+
def implement_common_task
|
10
|
+
set :user, config['user']
|
11
|
+
## :deploy_to は初期値として { "/u/apps/#{application}" } が入っているので、
|
12
|
+
## -s deploy_to 指定時はオプションの値、省略時は deploy_config (yaml) の値、
|
13
|
+
## という指定方法ができない。-s で指定する場合は -s override_deploy_to で指定することにする
|
14
|
+
set :deploy_to, fetch(:override_deploy_to, config['deploy_to'])
|
15
|
+
|
16
|
+
# Configサーバ
|
17
|
+
set :config_server_path, fetch(:config_server_path, config['path'])
|
18
|
+
set :config_server_repository, fetch(:config_server_repository, config['repository'])
|
19
|
+
set :config_server_branch, fetch(:config_server_branch, config['branch'])
|
20
|
+
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def implement_each_task(host, options)
|
25
|
+
role :web, host
|
26
|
+
role :app, host
|
27
|
+
role :configsrv, host
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "ya_queen_role_fontana"
|
3
|
+
|
4
|
+
require "ya_queen"
|
5
|
+
|
6
|
+
module YaQueenRoleFontana
|
7
|
+
class ConfigsrvSandbox < YaQueen::Base
|
8
|
+
|
9
|
+
def implement_common_task
|
10
|
+
set :user, config['user']
|
11
|
+
set :scm, :git
|
12
|
+
set :scm_verbose, true
|
13
|
+
if repo = config["repository"]
|
14
|
+
set :repository, repo
|
15
|
+
end
|
16
|
+
# set :branch, "app_releases"
|
17
|
+
|
18
|
+
# deploy
|
19
|
+
set :deploy_via, :copy
|
20
|
+
## :deploy_to は初期値として { "/u/apps/#{application}" } が入っているので、
|
21
|
+
## -s deploy_to 指定時はオプションの値、省略時は deploy_config (yaml) の値、
|
22
|
+
## という指定方法ができない。-s で指定する場合は -s override_deploy_to で指定することにする
|
23
|
+
set :deploy_to, fetch(:override_deploy_to, config['deploy_to'])
|
24
|
+
set :deploy_env, "production"
|
25
|
+
set :rails_env, "production"
|
26
|
+
|
27
|
+
# Configサーバ
|
28
|
+
set :config_server_path, fetch(:config_server_path, config['path'])
|
29
|
+
set :config_server_repository, fetch(:config_server_repository, config['repository'])
|
30
|
+
set :config_server_branch, fetch(:config_server_branch, config['branch'])
|
31
|
+
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
def implement_each_task(host, options)
|
36
|
+
domain = fetch(:domain, host)
|
37
|
+
role :web, domain
|
38
|
+
role :app, domain
|
39
|
+
role :db , domain, :primary => true
|
40
|
+
role :gotool, domain
|
41
|
+
super
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "ya_queen_role_fontana"
|
3
|
+
|
4
|
+
require "ya_queen"
|
5
|
+
|
6
|
+
module YaQueenRoleFontana
|
7
|
+
class GotoolProduction < YaQueen::Base
|
8
|
+
|
9
|
+
def implement_each_task(host, options)
|
10
|
+
role :web, host
|
11
|
+
role :app, host, :delayed_job => false
|
12
|
+
role :db, host, :primary => true if config['servers'][host]['primary_db']
|
13
|
+
role :gotool, host
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def implement_common_task
|
18
|
+
set :user, config['user']
|
19
|
+
set :deploy_to, config['deploy_to']
|
20
|
+
set :gemfile_name, "GOTool"
|
21
|
+
set :bundle_dir, "./vendor/bundle"
|
22
|
+
set :scm, :none
|
23
|
+
set :repository, File.expand_path("../../", File.dirname(__FILE__))
|
24
|
+
|
25
|
+
set :workspaces, config["workspaces"]
|
26
|
+
set :workspaces_scm , config["workspaces"]["scm"]
|
27
|
+
set :workspaces_runtime, config["workspaces"]["runtime"]
|
28
|
+
|
29
|
+
if config.has_key?('newrelic')
|
30
|
+
set :newrelic_license_key, config['newrelic']['license_key'] unless exists?(:newrelic_license_key)
|
31
|
+
set :newrelic_agent_enabled, config['newrelic']['agent_enabled'] unless exists?(:newrelic_agent_enabled)
|
32
|
+
set :newrelic_app_name, config['newrelic']['app_name'] unless exists?(:newrelic_app_name)
|
33
|
+
end
|
34
|
+
|
35
|
+
# mongoid.yml のテンプレート
|
36
|
+
# .erb以外が設定されている場合は、config/mongoid.ymlとしてこのファイル(の中身)をアップロードします。
|
37
|
+
set :mongoid_yml_template, "config/mongoid.yml"
|
38
|
+
|
39
|
+
super
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "ya_queen_role_fontana"
|
3
|
+
|
4
|
+
require "ya_queen"
|
5
|
+
|
6
|
+
module YaQueenRoleFontana
|
7
|
+
class GotoolSandbox < YaQueen::Base
|
8
|
+
|
9
|
+
def implement_common_task
|
10
|
+
set :user, config['user']
|
11
|
+
set :scm, :git
|
12
|
+
set :scm_verbose, true
|
13
|
+
set :repository, "git@github.com:tengine/fontana.git"
|
14
|
+
set :default_branch, "master"
|
15
|
+
|
16
|
+
set :branch do
|
17
|
+
tag = Capistrano::CLI.ui.ask "branch or tag : [#{default_branch}] "
|
18
|
+
tag = default_branch if tag.empty?
|
19
|
+
tag
|
20
|
+
end
|
21
|
+
|
22
|
+
# deploy
|
23
|
+
set :deploy_via, :copy
|
24
|
+
## :deploy_to は初期値として { "/u/apps/#{application}" } が入っているので、
|
25
|
+
## -s deploy_to 指定時はオプションの値、省略時は deploy_config (yaml) の値、
|
26
|
+
## という指定方法ができない。-s で指定する場合は -s override_deploy_to で指定することにする
|
27
|
+
set :deploy_to, fetch(:override_deploy_to, config['deploy_to'])
|
28
|
+
set :deploy_env, "production"
|
29
|
+
set :rails_env, "production"
|
30
|
+
|
31
|
+
# workspaces
|
32
|
+
# DEPRECATED use :workspaces instead of these
|
33
|
+
set :workspaces_scm , config["workspaces"]["scm"]
|
34
|
+
set :workspaces_runtime, config["workspaces"]["runtime"]
|
35
|
+
set :workspaces, config["workspaces"]
|
36
|
+
|
37
|
+
## newrelic
|
38
|
+
if config.has_key?('newrelic')
|
39
|
+
set :newrelic_license_key, config['newrelic']['license_key'] unless exists?(:newrelic_license_key)
|
40
|
+
set :newrelic_agent_enabled, config['newrelic']['agent_enabled'] unless exists?(:newrelic_agent_enabled)
|
41
|
+
set :newrelic_app_name, config['newrelic']['app_name'] unless exists?(:newrelic_app_name)
|
42
|
+
end
|
43
|
+
|
44
|
+
super
|
45
|
+
end
|
46
|
+
|
47
|
+
def implement_each_task(host, options)
|
48
|
+
domain = fetch(:domain, host)
|
49
|
+
role :web, domain
|
50
|
+
role :app, domain
|
51
|
+
role :db , domain, :primary => true
|
52
|
+
role :gotool, domain
|
53
|
+
super
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "ya_queen_role_fontana"
|
3
|
+
|
4
|
+
require "ya_queen"
|
5
|
+
|
6
|
+
module YaQueenRoleFontana
|
7
|
+
class Manage < YaQueen::Base
|
8
|
+
|
9
|
+
def define_role_task
|
10
|
+
define_manage_apisrv_task
|
11
|
+
define_manage_gotool_task
|
12
|
+
end
|
13
|
+
|
14
|
+
def define_manage_apisrv_task
|
15
|
+
t = self
|
16
|
+
config = self.config
|
17
|
+
## [ローカルPC->管理用サーバ] ローカルPCから、管理用サーバに ApiSrv としてデプロイするためのタスク
|
18
|
+
task :"@manage/apisrv" do
|
19
|
+
set :deploy_to, config['apisrv']['deploy_to']
|
20
|
+
set :gemfile_name, "ApiServer"
|
21
|
+
## deploy:assets:precompile をさせない
|
22
|
+
## assets_role を空にするだけでは no matching servers でエラーになる。HOSTFILTERをつけることで no matching servers でも先に進めるようになる。
|
23
|
+
set :assets_role, []
|
24
|
+
ENV['HOSTFILTER'] = config['server']
|
25
|
+
## manage/apisrv 以外と混ざらないようにする
|
26
|
+
t.set_deploy_target current_task.name
|
27
|
+
end
|
28
|
+
after :"@manage/apisrv", :"@manage/common"
|
29
|
+
end
|
30
|
+
|
31
|
+
def define_manage_gotool_task
|
32
|
+
t = self
|
33
|
+
config = self.config
|
34
|
+
## [ローカルPC->管理用サーバ] ローカルPCから、管理用サーバに GOTool としてデプロイするためのタスク
|
35
|
+
task :"@manage/gotool" do
|
36
|
+
set :deploy_to, config['gotool']['deploy_to']
|
37
|
+
set :gemfile_name, "GOTool"
|
38
|
+
## manage/apisrv 以外と混ざらないようにする
|
39
|
+
t.set_deploy_target current_task.name
|
40
|
+
end
|
41
|
+
after :"@manage/gotool", :"@manage/common"
|
42
|
+
end
|
43
|
+
|
44
|
+
def define_each_tasks
|
45
|
+
# do nothing
|
46
|
+
end
|
47
|
+
|
48
|
+
def define_common_task
|
49
|
+
t = self
|
50
|
+
config = self.config
|
51
|
+
task :"@manage/common" do
|
52
|
+
set :user, config['user']
|
53
|
+
set :scm, :git
|
54
|
+
# set :scm_verbose, true
|
55
|
+
set :repository, "git@github.com:tengine/fontana.git"
|
56
|
+
|
57
|
+
set :default_branch, "master"
|
58
|
+
set :branch do
|
59
|
+
tag = Capistrano::CLI.ui.ask "branch or tag : [#{default_branch}] "
|
60
|
+
tag = default_branch if tag.empty?
|
61
|
+
tag
|
62
|
+
end
|
63
|
+
|
64
|
+
role :web, config['server']
|
65
|
+
role :app, config['server']
|
66
|
+
#role :db , config['server'], :primary => true
|
67
|
+
role :management, config['server']
|
68
|
+
|
69
|
+
# mongoid.yml のテンプレート
|
70
|
+
# .erbが設定されている場合は、config/mongoid.ymlをこのテンプレートから生成します。
|
71
|
+
set :mongoid_yml_template, "config/mongoid.yml.production.erb"
|
72
|
+
set :tengine_servers, t.root['tengine']['servers']
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "ya_queen_role_fontana"
|
3
|
+
|
4
|
+
require "ya_queen"
|
5
|
+
|
6
|
+
module YaQueenRoleFontana
|
7
|
+
class Mongo < YaQueen::Base
|
8
|
+
|
9
|
+
def implement_role_task
|
10
|
+
set :user, config['user']
|
11
|
+
set :mongo_servers, config['servers']
|
12
|
+
|
13
|
+
set :replicasets, config['replicasets']
|
14
|
+
set :replicaset_names, replicasets.keys
|
15
|
+
|
16
|
+
(replicasets || {}).each.with_index do |(name, rs), idx|
|
17
|
+
role :"#{name}_primary", rs["primary"]
|
18
|
+
end
|
19
|
+
|
20
|
+
if sharding = config['sharding']
|
21
|
+
set :sharding, sharding
|
22
|
+
role :sharding_workspace_host, sharding['workspace_host']
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def implement_each_task(host, options)
|
27
|
+
role :mongo, host
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "ya_queen_role_fontana"
|
3
|
+
|
4
|
+
require "ya_queen"
|
5
|
+
|
6
|
+
module YaQueenRoleFontana
|
7
|
+
class Tengine < YaQueen::Base
|
8
|
+
|
9
|
+
def implement_role_task
|
10
|
+
set :user, config['user']
|
11
|
+
set :tengine_servers, config['servers']
|
12
|
+
|
13
|
+
if replicasets = config['replicasets']
|
14
|
+
set :replicasets, replicasets
|
15
|
+
set :replicaset_names, replicasets.keys
|
16
|
+
|
17
|
+
(replicasets || {}).each.with_index do |(name, rs), idx|
|
18
|
+
role :"#{name}_primary", rs["primary"]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if sharding = config['sharding']
|
23
|
+
set :sharding, sharding
|
24
|
+
role :sharding_workspace_host, sharding['workspace_host']
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def implement_each_task(host, options)
|
29
|
+
role :tengine, host
|
30
|
+
role :mongo, host
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "ya_queen_role_fontana"
|
2
|
+
|
3
|
+
require "ya_queen"
|
4
|
+
|
5
|
+
module YaQueenRoleFontana
|
6
|
+
class TitleAppProduction < YaQueen::Base
|
7
|
+
|
8
|
+
def implement_common_task
|
9
|
+
set :user, config['user']
|
10
|
+
set :deploy_to, fetch(:override_deploy_to, config['deploy_to'])
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def implement_each_task(host, options)
|
15
|
+
role :app, host
|
16
|
+
role :title_app, host
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "ya_queen_role_fontana"
|
3
|
+
|
4
|
+
require "ya_queen"
|
5
|
+
|
6
|
+
module YaQueenRoleFontana
|
7
|
+
class TitleAppSandbox < YaQueen::Base
|
8
|
+
|
9
|
+
def implement_common_task
|
10
|
+
set :user, config['user']
|
11
|
+
set :scm, :git
|
12
|
+
if repo = config["repository"]
|
13
|
+
set :repository, repo
|
14
|
+
end
|
15
|
+
set :scm_verbose, true
|
16
|
+
set :deploy_via, :copy # Projectが生成するconfig/fontana.yml もコピーするので、copyが一番楽
|
17
|
+
## :deploy_to は初期値として { "/u/apps/#{application}" } が入っているので、
|
18
|
+
## -s deploy_to 指定時はオプションの値、省略時は deploy_config (yaml) の値、
|
19
|
+
## という指定方法ができない。-s で指定する場合は -s override_deploy_to で指定することにする
|
20
|
+
set :deploy_to , fetch(:override_deploy_to, config['deploy_to'])
|
21
|
+
set :copy_dir , "/tmp/copy_dir"
|
22
|
+
set :remote_copy_dir, "/tmp/remote_copy_dir"
|
23
|
+
|
24
|
+
set :deploy_env, "production"
|
25
|
+
set :rails_env, "production"
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def implement_each_task(host, options)
|
30
|
+
domain = fetch(:domain, host)
|
31
|
+
role :web, domain
|
32
|
+
role :app, domain
|
33
|
+
role :db , domain, :primary => true
|
34
|
+
role :gotool, domain
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "ya_queen_role_fontana/version"
|
2
|
+
|
3
|
+
module YaQueenRoleFontana
|
4
|
+
autoload :Config, "ya_queen_role_fontana/config"
|
5
|
+
|
6
|
+
# fontana application roles
|
7
|
+
autoload :ConfigsrvProduction, "ya_queen_role_fontana/configsrv_production"
|
8
|
+
autoload :ConfigsrvSandbox , "ya_queen_role_fontana/configsrv_sandbox"
|
9
|
+
|
10
|
+
autoload :TitleAppProduction , "ya_queen_role_fontana/title_app_production"
|
11
|
+
autoload :TitleAppSandbox , "ya_queen_role_fontana/title_app_sandbox"
|
12
|
+
|
13
|
+
# fontana server roles
|
14
|
+
autoload :GotoolProduction, "ya_queen_role_fontana/gotool_production"
|
15
|
+
autoload :GotoolSandbox , "ya_queen_role_fontana/gotool_sandbox"
|
16
|
+
|
17
|
+
autoload :Manage , "ya_queen_role_fontana/manage" # production only
|
18
|
+
autoload :Apisrv , "ya_queen_role_fontana/apisrv" # production only
|
19
|
+
autoload :Asset , "ya_queen_role_fontana/asset" # production only
|
20
|
+
autoload :Mongo , "ya_queen_role_fontana/mongo" # production only
|
21
|
+
autoload :Tengine , "ya_queen_role_fontana/tengine" # production only
|
22
|
+
|
23
|
+
|
24
|
+
class << self
|
25
|
+
def configure(context, path)
|
26
|
+
config = Config.new(context, path)
|
27
|
+
yield(config) if block_given?
|
28
|
+
config
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ya_queen_role_fontana/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ya_queen_role_fontana"
|
8
|
+
spec.version = YaQueenRoleFontana::VERSION
|
9
|
+
spec.authors = ["akima"]
|
10
|
+
spec.email = ["t-akima@groovenauts.jp"]
|
11
|
+
spec.description = %q{defines server deployment role for fontana}
|
12
|
+
spec.summary = %q{defines server deployment role for fontana}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "ya_queen", "~> 0.0.4"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ya_queen_role_fontana
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- akima
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ya_queen
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: defines server deployment role for fontana
|
70
|
+
email:
|
71
|
+
- t-akima@groovenauts.jp
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- .rspec
|
78
|
+
- .travis.yml
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- lib/ya_queen_role_fontana.rb
|
84
|
+
- lib/ya_queen_role_fontana/apisrv.rb
|
85
|
+
- lib/ya_queen_role_fontana/asset.rb
|
86
|
+
- lib/ya_queen_role_fontana/config.rb
|
87
|
+
- lib/ya_queen_role_fontana/configsrv_production.rb
|
88
|
+
- lib/ya_queen_role_fontana/configsrv_sandbox.rb
|
89
|
+
- lib/ya_queen_role_fontana/gotool_production.rb
|
90
|
+
- lib/ya_queen_role_fontana/gotool_sandbox.rb
|
91
|
+
- lib/ya_queen_role_fontana/manage.rb
|
92
|
+
- lib/ya_queen_role_fontana/mongo.rb
|
93
|
+
- lib/ya_queen_role_fontana/tengine.rb
|
94
|
+
- lib/ya_queen_role_fontana/title_app_production.rb
|
95
|
+
- lib/ya_queen_role_fontana/title_app_sandbox.rb
|
96
|
+
- lib/ya_queen_role_fontana/version.rb
|
97
|
+
- spec/spec_helper.rb
|
98
|
+
- spec/ya_queen_role_fontana_spec.rb
|
99
|
+
- ya_queen_role_fontana.gemspec
|
100
|
+
homepage: ''
|
101
|
+
licenses:
|
102
|
+
- MIT
|
103
|
+
metadata: {}
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 2.0.3
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
123
|
+
summary: defines server deployment role for fontana
|
124
|
+
test_files:
|
125
|
+
- spec/spec_helper.rb
|
126
|
+
- spec/ya_queen_role_fontana_spec.rb
|
127
|
+
has_rdoc:
|