OSDN Git Service

adds the `screwdriver-on-docker` role.
authorwhitestar <whitestar@users.osdn.me>
Sat, 2 Sep 2017 09:53:36 +0000 (18:53 +0900)
committerwhitestar <whitestar@users.osdn.me>
Sat, 2 Sep 2017 09:53:36 +0000 (18:53 +0900)
nodes/local-screwdriver-on-docker.json [new file with mode: 0644]
roles/devops-suite-on-docker.rb
roles/screwdriver-on-docker.rb [new file with mode: 0644]

diff --git a/nodes/local-screwdriver-on-docker.json b/nodes/local-screwdriver-on-docker.json
new file mode 100644 (file)
index 0000000..356c762
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "run_list": [
+    "role[screwdriver-on-docker]"
+  ]
+}
index 14a74a6..e9bd402 100644 (file)
@@ -22,20 +22,23 @@ dockerd_extra_opts = [
   '--bip=192.168.100.1/24 --fixed-cidr=192.168.100.0/24',
 ].join(' ')
 network_mode_bridge = false
-aptly_port         =  '7080'  # default: 8080
-aptly_api_port     =  '7081'  # default: 8081
-athenz_zms_port    =  '7043'  # default: 4443
-athenz_zts_port    =  '8043'  # default: 8443
-athenz_ui_port     =  '9043'  # default: 9443
-concourse_port     =  '8080'
-gitlab_http_port   =    '80'  # default: 80, Note: 8080 already in use.
-gitlab_ssh_port    =  '2022'
-jenkins_port       =  '9080'  # default: 8080
-jenkins_agent_port = '50000'  # default: 50000
+aptly_port             =  '7080'  # default: 8080
+aptly_api_port         =  '7081'  # default: 8081
+athenz_zms_port        =  '7043'  # default: 4443
+athenz_zts_port        =  '8043'  # default: 8443
+athenz_ui_port         =  '9043'  # default: 9443
+concourse_port         =  '8080'
+gitlab_http_port       =    '80'  # default: 80, Note: 8080 already in use.
+gitlab_ssh_port        =  '2022'
+jenkins_port           =  '9080'  # default: 8080
+jenkins_agent_port     = '50000'  # default: 50000
 jenkins_home_path = '/opt/docker-compose/app/jenkins/home'
 nexus_ver = '3'
 nexus_port = nexus_ver == '3' ? '8081' : '8071'
-vault_port         =  '8200'  # default: 8200
+screwdriver_ui_port    =  '9000'  # default: 9000
+screwdriver_api_port   =  '9001'  # default: 9001
+screwdriver_store_port =  '9002'  # default: 9002
+vault_port             =  '8200'  # default: 8200
 
 run_list(
   'role[docker]',
@@ -46,6 +49,7 @@ run_list(
   'role[gitlab-runner]',
   'role[jenkins-on-docker]',
   "role[nexus#{nexus_ver}-on-docker]",
+  'role[screwdriver-on-docker]',
   'role[vault-on-docker]',
 )
 
@@ -187,6 +191,35 @@ attrs = {
       },
     },
   },
+  'screwdriver' => {
+    'docker-compose' => {
+      'config' => {
+        'services' => {
+          'api' => {
+            'ports' => [
+              "#{screwdriver_api_port}:80",
+            ],
+            'environment' => {
+            },
+          },
+          'ui' => {
+            'ports' => [
+              "#{screwdriver_ui_port}:80",
+            ],
+            'environment' => {
+            },
+          },
+          'store' => {
+            'ports' => [
+              "#{screwdriver_store_port}:80",
+            ],
+            'environment' => {
+            },
+          },
+        },
+      },
+    },
+  },
   'hc-vault' => {
     'config' => {
     },
@@ -228,6 +261,11 @@ if network_mode_bridge
   ]
   nexus_srvs['nexus']['network_mode'] = 'bridge'
 
+  screwdriver_srvs = attrs['screwdriver']['docker-compose']['config']['services']
+  screwdriver_srvs['api']['network_mode'] = 'bridge'
+  screwdriver_srvs['ui']['network_mode'] = 'bridge'
+  screwdriver_srvs['store']['network_mode'] = 'bridge'
+  
   vault_srvs = attrs['hc-vault']['docker-compose']['config']['services']
   vault_srvs['vault']['network_mode'] = 'bridge'
 end
diff --git a/roles/screwdriver-on-docker.rb b/roles/screwdriver-on-docker.rb
new file mode 100644 (file)
index 0000000..5688570
--- /dev/null
@@ -0,0 +1,96 @@
+#
+# Copyright 2017, whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name 'screwdriver-on-docker'
+description 'Screwdriver on Docker'
+
+#ui_port     = '9000'
+#api_port    = '9001'
+#store_port  = '9002'
+
+run_list(
+  'role[docker]',
+  'recipe[screwdriver::docker-compose]',
+)
+
+override_attributes(
+  'screwdriver' => {
+    'docker-compose' => {
+      # REQUIRED: SCM OAuth client ID and secret
+=begin
+      'oauth_client_id_vault_item' => {
+        'vault' => 'screwdriver',
+        'name' => 'oauth_client_id',
+        'env_context' => false,
+        'key' => 'cid',  # real hash path: "/cid"
+      },
+      'oauth_client_secret_vault_item' => {
+        'vault' => 'screwdriver',
+        'name' => 'oauth_client_secret',
+        'env_context' => false,
+        'key' => 'secret',  # real hash path: "/secret"
+      },
+=end
+      'config' => {
+        'services' => {
+          'api' => {
+            'ports' => [
+              #"#{api_port}:80",
+            ],
+            'environment' => {
+              # REQUIRED: SCM settings
+              'SCM_PLUGIN' => 'github',  # 'gitlab' or 'github' or 'bitbucket'
+              # OAuth Callback URL: "http://#{node['fqdn']}:9001/v4/auth/login/web"
+              'SCM_USERNAME' => 'ci-tool',
+              'SCM_EMAIL' => 'citool@mail.example.com',
+              #'WEBHOOK_GITHUB_SECRET' => 'SUPER-SECRET-SIGNING-THING',
+              #'SCM_GITLAB_HOST' => 'gitlab.io.example.com',
+              #'SCM_GITLAB_PROTOCOL' => 'https',
+              #'NODE_TLS_REJECT_UNAUTHORIZED' => '0',  # for self-signed cetificates
+              # The following variables will be set by the screwdriver::docker-compose recipe automatically.
+              #'SECRET_OAUTH_CLIENT_ID' => '${SECRET_OAUTH_CLIENT_ID}',
+              #'SECRET_OAUTH_CLIENT_SECRET' => '${SECRET_OAUTH_CLIENT_SECRET}',
+              #'SECRET_JWT_PRIVATE_KEY' => '${SECRET_JWT_PRIVATE_KEY}',
+              #'SECRET_JWT_PUBLIC_KEY' => '${SECRET_JWT_PUBLIC_KEY}',
+              #'ECOSYSTEM_UI' => "http://#{node['fqdn']}:#{ui_port}",
+              #'ECOSYSTEM_STORE' => "http://#{node['fqdn']}:#{store_port}",
+            },
+          },
+          'ui' => {
+            'ports' => [
+              #"#{ui_port}:80",
+            ],
+            'environment' => {
+              # These variables will be set by the screwdriver::docker-compose recipe automatically.
+              #'ECOSYSTEM_API' => "http://#{node['fqdn']}:#{api_port}",
+              #'ECOSYSTEM_STORE' => "http://#{node['fqdn']}:#{store_port}",
+            },
+          },
+          'store' => {
+            'ports' => [
+              #"#{store_port}:80",
+            ],
+            'environment' => {
+              # These variables will be set by the screwdriver::docker-compose recipe automatically.
+              #'ECOSYSTEM_UI' => "http://#{node['fqdn']}:#{ui_port}",
+              #'SECRET_JWT_PUBLIC_KEY' => '${SECRET_JWT_PUBLIC_KEY}',
+            },
+          },
+        },
+      },
+    },
+  },
+)