From 09fc1f3ee08b6825b58c0586cea5bd76f6c41d15 Mon Sep 17 00:00:00 2001 From: wemeya Date: Thu, 28 Jul 2016 16:18:24 +0800 Subject: [PATCH] add script to auto configure platform to pull images from --- contrib/docker-compose.yml.daocloud | 68 ---------------------- contrib/prebuild-install/README.md | 1 + contrib/prebuild-install/docker-compose.sh | 32 ++++++++++ 3 files changed, 33 insertions(+), 68 deletions(-) delete mode 100644 contrib/docker-compose.yml.daocloud create mode 100644 contrib/prebuild-install/README.md create mode 100755 contrib/prebuild-install/docker-compose.sh diff --git a/contrib/docker-compose.yml.daocloud b/contrib/docker-compose.yml.daocloud deleted file mode 100644 index e93fb42f1..000000000 --- a/contrib/docker-compose.yml.daocloud +++ /dev/null @@ -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" diff --git a/contrib/prebuild-install/README.md b/contrib/prebuild-install/README.md new file mode 100644 index 000000000..3984e78b4 --- /dev/null +++ b/contrib/prebuild-install/README.md @@ -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. diff --git a/contrib/prebuild-install/docker-compose.sh b/contrib/prebuild-install/docker-compose.sh new file mode 100755 index 000000000..eff4aa7f4 --- /dev/null +++ b/contrib/prebuild-install/docker-compose.sh @@ -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! "