add script to auto configure platform to pull images from

This commit is contained in:
wemeya 2016-07-28 16:18:24 +08:00
parent 5e38e84c89
commit 09fc1f3ee0
3 changed files with 33 additions and 68 deletions

View File

@ -1,68 +0,0 @@
version: '2'
services:
log:
image: daocloud.io/harbor/deploy_log:latest
volumes:
- /var/log/harbor/:/var/log/docker/
ports:
- 1514:514
registry:
image: daocloud.io/library/registry:2.3.0
volumes:
- /data/registry:/storage
- ./config/registry/:/etc/registry/
ports:
- 5001:5001
command:
/etc/registry/config.yml
depends_on:
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
syslog-tag: "registry"
mysql:
image: daocloud.io/harbor/deploy_mysql:latest
volumes:
- /data/database:/var/lib/mysql
env_file:
- ./config/db/env
depends_on:
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
syslog-tag: "mysql"
ui:
image: daocloud.io/harbor/deploy_ui:latest
env_file:
- ./config/ui/env
volumes:
- ./config/ui/app.conf:/etc/ui/app.conf
- ./config/ui/private_key.pem:/etc/ui/private_key.pem
depends_on:
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
syslog-tag: "ui"
proxy:
image: daocloud.io/library/nginx:1.9
volumes:
- ./config/nginx:/etc/nginx
ports:
- 80:80
- 443:443
depends_on:
- mysql
- registry
- ui
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
syslog-tag: "proxy"

View File

@ -0,0 +1 @@
docker-compose.sh is used to configure docker-compose.yml to pull images from platform like docker hub, daocloud.io and others. If you don't want to waste time on building images, you can execute this script to pull images from platform you prefer. Currently, we only support daocloud.io and docker hub, the default is docker hub.

View File

@ -0,0 +1,32 @@
#/bin/eash
read -p "Please input the platform name you want to pull images, for docker hub, enter 1; for daocloud.io, enter 2, otherwise enter the name of the platform, the default is 1:" choice
cd ../../Deploy
template_file="docker-compose.yml.template"
yml_file='docker-compose.yml'
if test -e $template_file
then
cp $template_file $yml_file
else
cp $yml_file $template_file
fi
platform=''
choice=${choice:-1}
if [ $choice == '1' ]
then
platform='prjharbor/'
elif [ $choice == '2' ]
then
platform='daocloud.io/harbor/'
else
platform=$choice
fi
version='0.3.0'
log='deploy_log:'
db='deploy_mysql:'
job_service='deploy_jobservice:'
ui='deploy_ui:'
sed -i -- '/build: .\/log\//c\ image: '$platform$log$version'' $yml_file
sed -i -- '/build: .\/db\//c\ image: '$platform$db$version'' $yml_file
sed -i -- '/ui:/{n;N;N;d}' $yml_file && sed -i -- '/ui:/a\\ image: '$platform$ui$version'' $yml_file
sed -i -- '/jobservice:/{n;N;N;d}' $yml_file && sed -i -- '/jobservice:/a\\ image: '$platform$job_service$version'' $yml_file
echo "succeed! "