-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
287 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'railsless-deploy' | ||
gem 'jenkins-capistrano' | ||
gem 'capistrano_colors' | ||
gem 'pry' | ||
gem 'jenkins-capistrano', :path => '..' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
# jenkins-capistrano example | ||
|
||
jenkins-capistranoを使って、master-slave構成のJenkinsに以下のことを行う設定例 | ||
This is a example **batch** project with jekins-capistrano configs | ||
which deploy and configure the following staff to the master-slave Jenkins: | ||
|
||
* バッチで必要なジョブ | ||
* バッチを実際に実行するためのスレーブノードの登録 | ||
* バッチプログラム(binディレクトリ)のデプロイ | ||
* A job to execute the batch program | ||
* A node to excute the job | ||
* The batch program itself | ||
|
||
## 前提 | ||
## Deploy | ||
|
||
* ローカルにruby1.8.7+が入っていること | ||
* 各スレーブノードに`/opt/hello`ディレクトリがあること | ||
* `/opt/hello`ディレクトリにjenkinsユーザが書き込み権限があること | ||
* jenkinsユーザがマスターノードからスレーブノードに公開鍵認証で接続できること | ||
### Development | ||
|
||
## デプロイの仕方 | ||
|
||
本番環境: | ||
``` | ||
$ script/deploy production | ||
$ script/deploy | ||
``` | ||
|
||
ステージング環境: | ||
### Staging | ||
|
||
``` | ||
$ script/deploy staging | ||
``` | ||
|
||
開発環境: | ||
### Production | ||
|
||
``` | ||
$ script/deploy | ||
$ script/deploy production | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# ブランチはconfig/deploy.rbの設定に従う | ||
role :batch, 'dev-slave01.local' | ||
set :jenkins_host, 'dev-master.local' | ||
role :batch, 'localhsot:22222' | ||
set :jenkins_host, 'localhost:8080' | ||
set :jenkins_node_config_dir, 'config/jenkins/nodes/develop' | ||
|
||
set :jenkins_template_vars, { | ||
credential_id: 'AAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
set :branch, 'v1.0.0' | ||
|
||
role :batch, 'prod-slave01.local' | ||
# 複数ノードの場合 | ||
#role :batch, 'prod-slave02.local' | ||
#role :batch, 'prod-slave03.local' | ||
role :batch, 'prod-slave02.local' | ||
role :batch, 'prod-slave03.local' | ||
|
||
set :jenkins_host, 'prod-master.local' | ||
set :jenkins_node_config_dir, 'config/jenkins/nodes/production' | ||
set :jenkins_template_vars, { | ||
slave01: { | ||
credential_id: 'PRODUCTION-SLAVE01-CREDENTIAL', | ||
}, | ||
slave02: { | ||
credential_id: 'PRODUCTION-SLAVE02-CREDENTIAL', | ||
}, | ||
slave03: { | ||
credential_id: 'PRODUCTION-SLAVE03-CREDENTIAL', | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
set :branch, 'release/1.0.1' | ||
|
||
role :batch, 'stg-slave01.local' | ||
# 複数ノードの場合 | ||
#role :batch, 'stg-slave02.local' | ||
#role :batch, 'stg-slave03.local' | ||
role :batch, 'stg-slave02.local' | ||
role :batch, 'stg-slave03.local' | ||
|
||
set :jenkins_host, 'stg-master.local' | ||
set :jenkins_node_config_dir, 'config/jenkins/nodes/staging' | ||
|
||
set :jenkins_template_vars, { | ||
slave01: { | ||
credential_id: 'STAGING-SLAVE01-CREDENTIAL', | ||
}, | ||
slave02: { | ||
credential_id: 'STAGING-SLAVE02-CREDENTIAL', | ||
}, | ||
slave03: { | ||
credential_id: 'STAGING-SLAVE03-CREDENTIAL', | ||
} | ||
} |
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<slave> | ||
<name>dev-slave01</name> | ||
<description>Slave01</description> | ||
<remoteFS>/home/jenkins</remoteFS> | ||
<numExecutors>5</numExecutors> | ||
<mode>EXCLUSIVE</mode> | ||
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/> | ||
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="[email protected]"> | ||
<host>dev-slave01.local</host> | ||
<port>22</port> | ||
<credentialsId><%= @credential_id %></credentialsId> | ||
<jvmOptions>-Dfile.encoding=UTF-8</jvmOptions> | ||
</launcher> | ||
<label>hello</label> | ||
<nodeProperties> | ||
<hudson.slaves.EnvironmentVariablesNodeProperty> | ||
<envVars serialization="custom"> | ||
<unserializable-parents/> | ||
<tree-map> | ||
<default> | ||
<comparator class="hudson.util.CaseInsensitiveComparator"/> | ||
</default> | ||
<int>2</int><!-- must specify env var count --> | ||
<string>LANG</string> | ||
<string>ja_JP.UTF-8</string> | ||
<string>ENVIRONMENT</string> | ||
<string>develop</string> | ||
</tree-map> | ||
</envVars> | ||
</hudson.slaves.EnvironmentVariablesNodeProperty> | ||
</nodeProperties> | ||
</slave> |
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
example/config/jenkins/nodes/production/prod-slave01.xml.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<slave> | ||
<name>prod-slave01</name> | ||
<description>Slave01</description> | ||
<remoteFS>/home/jenkins</remoteFS> | ||
<numExecutors>5</numExecutors> | ||
<mode>EXCLUSIVE</mode> | ||
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/> | ||
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="[email protected]"> | ||
<host>prod-slave01.local</host> | ||
<port>22</port> | ||
<credentialsId><%= @slave01[:credential_id] %></credentialsId> | ||
<jvmOptions>-Dfile.encoding=UTF-8</jvmOptions> | ||
</launcher> | ||
<label>hello</label> | ||
<nodeProperties> | ||
<hudson.slaves.EnvironmentVariablesNodeProperty> | ||
<envVars serialization="custom"> | ||
<unserializable-parents/> | ||
<tree-map> | ||
<default> | ||
<comparator class="hudson.util.CaseInsensitiveComparator"/> | ||
</default> | ||
<int>2</int><!-- must specify env var count --> | ||
<string>LANG</string> | ||
<string>ja_JP.UTF-8</string> | ||
<string>ENVIRONMENT</string> | ||
<string>production</string> | ||
</tree-map> | ||
</envVars> | ||
</hudson.slaves.EnvironmentVariablesNodeProperty> | ||
</nodeProperties> | ||
</slave> |
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
example/config/jenkins/nodes/production/prod-slave02.xml.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<slave> | ||
<name>prod-slave02</name> | ||
<description>Slave02</description> | ||
<remoteFS>/home/jenkins</remoteFS> | ||
<numExecutors>5</numExecutors> | ||
<mode>EXCLUSIVE</mode> | ||
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/> | ||
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="[email protected]"> | ||
<host>prod-slave02.local</host> | ||
<port>22</port> | ||
<credentialsId><%= @slave02[:credential_id] %></credentialsId> | ||
<jvmOptions>-Dfile.encoding=UTF-8</jvmOptions> | ||
</launcher> | ||
<label>hello</label> | ||
<nodeProperties> | ||
<hudson.slaves.EnvironmentVariablesNodeProperty> | ||
<envVars serialization="custom"> | ||
<unserializable-parents/> | ||
<tree-map> | ||
<default> | ||
<comparator class="hudson.util.CaseInsensitiveComparator"/> | ||
</default> | ||
<int>2</int><!-- must specify env var count --> | ||
<string>LANG</string> | ||
<string>ja_JP.UTF-8</string> | ||
<string>ENVIRONMENT</string> | ||
<string>production</string> | ||
</tree-map> | ||
</envVars> | ||
</hudson.slaves.EnvironmentVariablesNodeProperty> | ||
</nodeProperties> | ||
</slave> |
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
example/config/jenkins/nodes/production/prod-slave03.xml.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<slave> | ||
<name>prod-slave03</name> | ||
<description>Slave03</description> | ||
<remoteFS>/home/jenkins</remoteFS> | ||
<numExecutors>5</numExecutors> | ||
<mode>EXCLUSIVE</mode> | ||
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always"/> | ||
<launcher class="hudson.plugins.sshslaves.SSHLauncher" plugin="[email protected]"> | ||
<host>prod-slave03.local</host> | ||
<port>22</port> | ||
<credentialsId><%= @slave03[:credential_id] %></credentialsId> | ||
<jvmOptions>-Dfile.encoding=UTF-8</jvmOptions> | ||
</launcher> | ||
<label>hello</label> | ||
<nodeProperties> | ||
<hudson.slaves.EnvironmentVariablesNodeProperty> | ||
<envVars serialization="custom"> | ||
<unserializable-parents/> | ||
<tree-map> | ||
<default> | ||
<comparator class="hudson.util.CaseInsensitiveComparator"/> | ||
</default> | ||
<int>2</int><!-- must specify env var count --> | ||
<string>LANG</string> | ||
<string>ja_JP.UTF-8</string> | ||
<string>ENVIRONMENT</string> | ||
<string>production</string> | ||
</tree-map> | ||
</envVars> | ||
</hudson.slaves.EnvironmentVariablesNodeProperty> | ||
</nodeProperties> | ||
</slave> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.