Merge "Add custom docker registry to DockerStandaloneHost"

This commit is contained in:
Jenkins 2015-11-09 10:26:18 +00:00 committed by Gerrit Code Review
commit 082cc0c0cc
6 changed files with 90 additions and 28 deletions

View File

@ -31,6 +31,9 @@ Properties:
dockerRegistry: dockerRegistry:
Contract: $.string() Contract: $.string()
dockerMirror:
Contract: $.string()
applicationEndpoints: applicationEndpoints:
Contract: Contract:
- port: $.int().notNull().check($ > 0) - port: $.int().notNull().check($ > 0)
@ -65,11 +68,13 @@ Methods:
- $resources: new(sys:Resources) - $resources: new(sys:Resources)
- $template: $resources.yaml('StartDocker.template') - $template: $resources.yaml('StartDocker.template')
- $.instance.agent.call($template, $resources) - $.instance.agent.call($template, $resources)
- If: $.dockerRegistry != null and $.dockerRegistry != '' - If: $.dockerMirror != null and $.dockerMirror != ''
or $.dockerRegistry != null and $.dockerRegistry != ''
Then: Then:
- $._environment.reporter.report($this, 'Configuring Docker registry') - $._environment.reporter.report($this, 'Configuring Docker options')
- $template: $resources.yaml('SetupDockerRegistry.template').bind(dict( - $template: $resources.yaml('SetupDockerOptions.template').bind(dict(
dockerRegistry => $.dockerRegistry dockerRegistry => $.dockerRegistry,
dockerMirror => $.dockerMirror
)) ))
- $.instance.agent.call($template, $resources) - $.instance.agent.call($template, $resources)
- $._environment.reporter.report($this, 'Docker Server is up and running') - $._environment.reporter.report($this, 'Docker Server is up and running')

View File

@ -0,0 +1,53 @@
# 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.
FormatVersion: 2.0.0
Version: 1.0.0
Name: Setup Docker options
Parameters:
dockerRegistry: $dockerRegistry
dockerMirror: $dockerMirror
Body: |
if args.dockerRegistry:
setupRegistry(args.dockerRegistry)
if args.dockerMirror:
setupMirror(args.dockerMirror)
restartDocker()
Scripts:
setupMirror:
Type: Application
Version: 1.0.0
EntryPoint: setupDockerMirror.sh
Files: []
Options:
captureStdout: true
captureStderr: true
setupRegistry:
Type: Application
Version: 1.0.0
EntryPoint: setupDockerRegistry.sh
Files: []
Options:
captureStdout: true
captureStderr: true
restartDocker:
Type: Application
Version: 1.0.0
EntryPoint: restartDocker.sh
Options:
captureStdout: false
captureStderr: false

View File

@ -1,3 +1,4 @@
#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License"); you may # 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 # not use this file except in compliance with the License. You may obtain
# a copy of the License at # a copy of the License at
@ -10,22 +11,4 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
FormatVersion: 2.0.0 service docker restart
Version: 1.0.0
Name: Setup Docker registry
Parameters:
dockerRegistry: $dockerRegistry
Body: |
setupRegistry(args.dockerRegistry)
Scripts:
setupRegistry:
Type: Application
Version: 1.0.0
EntryPoint: setupDockerRegistry.sh
Files: []
Options:
captureStdout: true
captureStderr: true

View File

@ -0,0 +1,16 @@
#!/bin/bash
# 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.
source /etc/default/docker
DOCKER_OPTS+=" --registry-mirror=$1"
echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker

View File

@ -12,7 +12,5 @@
# under the License. # under the License.
source /etc/default/docker source /etc/default/docker
DOCKER_OPTS+=" --registry-mirror=$1" DOCKER_OPTS+=" --insecure-registry $1"
echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker echo DOCKER_OPTS=\"$DOCKER_OPTS\" > /etc/default/docker
service docker restart

View File

@ -17,6 +17,7 @@ Application:
type: io.murano.apps.docker.DockerStandaloneHost type: io.murano.apps.docker.DockerStandaloneHost
name: $.appConfiguration.name name: $.appConfiguration.name
dockerRegistry: $.appConfiguration.dockerRegistry dockerRegistry: $.appConfiguration.dockerRegistry
dockerMirror: $.appConfiguration.dockerMirror
instance: instance:
?: ?:
type: io.murano.resources.LinuxMuranoInstance type: io.murano.resources.LinuxMuranoInstance
@ -53,7 +54,13 @@ Forms:
type: string type: string
label: Custom Docker registry URL label: Custom Docker registry URL
description: >- description: >-
URL of docker repository mirror to use. Leave empty for Docker default Host IP or domain name of custom Docker registry to use. Leave empty for Docker default
required: false
- name: dockerMirror
type: string
label: Docker registry mirror URL
description: >-
URL of Docker registry mirror to use. Leave empty to not use one
required: false required: false
- instanceConfiguration: - instanceConfiguration: