From 810162633727baa47495414a69d5dfc555bf5187 Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 19 Feb 2019 13:43:53 +0800 Subject: [PATCH] revise rancher initial script --- site/docker-compose.yml | 20 +++++++++---------- site/install-rancher.sh | 6 +++--- site/management-backend/create-stacks.sh | 9 +++++++++ .../docker-compose.yml | 0 .../rancher-compose.yml | 0 site/prod/TML-KHHW/docker-compose.yml | 2 +- site/prod/TML-KHHW/rancher-compose.yml | 19 ++++++------------ site/prod/TML-TXGW/docker-compose.yml | 2 +- site/prod/TML-TXGW/rancher-compose.yml | 17 +++++----------- site/prod/create-stacks.sh | 4 ++-- .../{WHL-KHHW => TML-KHHW}/docker-compose.yml | 0 .../rancher-compose.yml | 0 site/uat/create-stacks.sh | 11 ++-------- 13 files changed, 39 insertions(+), 51 deletions(-) create mode 100644 site/management-backend/create-stacks.sh rename site/{uat/Management-Backend => management-backend}/docker-compose.yml (100%) rename site/{uat/Management-Backend => management-backend}/rancher-compose.yml (100%) rename site/uat/{WHL-KHHW => TML-KHHW}/docker-compose.yml (100%) rename site/uat/{WHL-KHHW => TML-KHHW}/rancher-compose.yml (100%) diff --git a/site/docker-compose.yml b/site/docker-compose.yml index 945c83b..cc4e445 100644 --- a/site/docker-compose.yml +++ b/site/docker-compose.yml @@ -23,15 +23,16 @@ services: depends_on: - "mysql" links: - - mysql:db - fluent-log: - container_name: fluent-log - image: "fluent/fluentd" - ports: - - 24224:24224 - - 24224:24224/udp - volumes: - - /docker/log:/fluentd/log + - mysql:db + # fluent-log: + # container_name: fluent-log + # image: "fluent/fluentd" + # ports: + # - 24224:24224 + # - 24224:24224/udp + # volumes: + # - /docker/log:/fluentd/log + # network_mode: "bridge" rancher-server: container_name: rancher-server image: "rancher/server" @@ -45,4 +46,3 @@ services: DB_HOST: db links: - mysql:db - diff --git a/site/install-rancher.sh b/site/install-rancher.sh index 85d6e83..0b93b7a 100644 --- a/site/install-rancher.sh +++ b/site/install-rancher.sh @@ -1,8 +1,8 @@ export RANCHER_URL=http://localhost:8888 #Create necessary folders for volume mounting -mkdir -p -m 777 /docker/mysql -mkdir -p -m 777 /docker/log -chmod -R 777 /docker/* +mkdir -p /docker/mysql +mkdir -p /docker/log +chmod -R 777 /docker # install rancher cli curl -LkSs https://github.com/rancher/cli/releases/download/v0.6.11/rancher-linux-amd64-v0.6.11.tar.gz | tar -xz && mv -f ./rancher-v0.6.11/rancher /bin/rancher && rm -rf ./rancher-v0.6.11 docker-compose up -d \ No newline at end of file diff --git a/site/management-backend/create-stacks.sh b/site/management-backend/create-stacks.sh new file mode 100644 index 0000000..1422733 --- /dev/null +++ b/site/management-backend/create-stacks.sh @@ -0,0 +1,9 @@ +export RANCHER_URL=http://localhost:8888 +export IPADDRESS=$(hostname -i) +#Create Management Stacks +#Create necessary folders for volume mounting +mkdir -p /docker/nexus3/nexus-data +mkdir -p /docker/teamcity/data +mkdir -p /docker/teamcity/logs +chmod -R 777 /docker +rancher --wait-state active --env UAT stack create Management-Backend -f ./docker-compose.yml -r ./rancher-compose.yml \ No newline at end of file diff --git a/site/uat/Management-Backend/docker-compose.yml b/site/management-backend/docker-compose.yml similarity index 100% rename from site/uat/Management-Backend/docker-compose.yml rename to site/management-backend/docker-compose.yml diff --git a/site/uat/Management-Backend/rancher-compose.yml b/site/management-backend/rancher-compose.yml similarity index 100% rename from site/uat/Management-Backend/rancher-compose.yml rename to site/management-backend/rancher-compose.yml diff --git a/site/prod/TML-KHHW/docker-compose.yml b/site/prod/TML-KHHW/docker-compose.yml index d1785ad..9368254 100644 --- a/site/prod/TML-KHHW/docker-compose.yml +++ b/site/prod/TML-KHHW/docker-compose.yml @@ -9,7 +9,7 @@ services: io.rancher.container.hostname_override: container_name io.rancher.container.pull_image: always LB: - image: rancher/lb-service-haproxy:v0.9.3 + image: rancher/lb-service-haproxy:v0.9.6 ports: - 80:80/tcp labels: diff --git a/site/prod/TML-KHHW/rancher-compose.yml b/site/prod/TML-KHHW/rancher-compose.yml index f9e0baf..52d1011 100644 --- a/site/prod/TML-KHHW/rancher-compose.yml +++ b/site/prod/TML-KHHW/rancher-compose.yml @@ -2,10 +2,10 @@ version: '2' services: TML-WS: scale: 1 - start_on_create: true + start_on_create: false LB: scale: 2 - start_on_create: true + start_on_create: false lb_config: certs: [] config: "defaults\noption forwardfor\n\nlisten stats \nbind 0.0.0.0:9123\nmode\ @@ -47,13 +47,6 @@ services: service: TML-WS source_port: 80 target_port: 8080 - - hostname: khhwtml.wanhai.com - path: /haproxy_stats - priority: 6 - protocol: http - service: LB - source_port: 80 - target_port: 9123 stickiness_policy: cookie: JSESSIONID indirect: true @@ -70,14 +63,14 @@ services: reinitializing_timeout: 60000 TML-CY: scale: 2 - start_on_create: true + start_on_create: false TML-MENU: retain_ip: true scale: 1 - start_on_create: true + start_on_create: false TML-STATIC: scale: 1 - start_on_create: true + start_on_create: false OTT: scale: 1 - start_on_create: true + start_on_create: false diff --git a/site/prod/TML-TXGW/docker-compose.yml b/site/prod/TML-TXGW/docker-compose.yml index c49633c..439a040 100644 --- a/site/prod/TML-TXGW/docker-compose.yml +++ b/site/prod/TML-TXGW/docker-compose.yml @@ -9,7 +9,7 @@ services: io.rancher.container.hostname_override: container_name io.rancher.container.pull_image: always LB: - image: rancher/lb-service-haproxy:v0.9.3 + image: rancher/lb-service-haproxy:v0.9.6 ports: - 80:80/tcp labels: diff --git a/site/prod/TML-TXGW/rancher-compose.yml b/site/prod/TML-TXGW/rancher-compose.yml index 37969f6..111b7a8 100644 --- a/site/prod/TML-TXGW/rancher-compose.yml +++ b/site/prod/TML-TXGW/rancher-compose.yml @@ -2,10 +2,10 @@ version: '2' services: TML-WS: scale: 1 - start_on_create: true + start_on_create: false LB: scale: 2 - start_on_create: true + start_on_create: false lb_config: certs: [] config: "defaults\noption forwardfor\n\nlisten stats \nbind 0.0.0.0:9123\nmode\ @@ -47,13 +47,6 @@ services: service: TML-WS source_port: 80 target_port: 8080 - - hostname: txgwtml.wanhai.com - path: /haproxy_stats - priority: 7 - protocol: http - service: LB - source_port: 80 - target_port: 9123 stickiness_policy: cookie: JSESSIONID indirect: true @@ -70,13 +63,13 @@ services: reinitializing_timeout: 60000 TML-CY: scale: 2 - start_on_create: true + start_on_create: false TML-MENU: scale: 1 - start_on_create: true + start_on_create: false TML-STATIC: scale: 1 - start_on_create: true + start_on_create: false OTT: scale: 1 start_on_create: false diff --git a/site/prod/create-stacks.sh b/site/prod/create-stacks.sh index b44af15..8e8315f 100644 --- a/site/prod/create-stacks.sh +++ b/site/prod/create-stacks.sh @@ -2,5 +2,5 @@ export RANCHER_URL=http://localhost:8888 #Create Rancher Environment rancher env create PROD #Create Application Stacks -rancher --wait-state active --env PROD stack create TML-KHHW -f ./WHL-KHHW/docker-compose.yml -r ./WHL-KHHW/rancher-compose.yml -rancher --wait-state active --env PROD stack create TML-TXGW -f ./WHL-TXGW/docker-compose.yml -r ./WHL-TXGW/rancher-compose.yml \ No newline at end of file +rancher --wait-state active --env PROD stack create TML-KHHW -f ./TML-KHHW/docker-compose.yml -r ./TML-KHHW/rancher-compose.yml +rancher --wait-state active --env PROD stack create TML-TXGW -f ./TML-TXGW/docker-compose.yml -r ./TML-TXGW/rancher-compose.yml \ No newline at end of file diff --git a/site/uat/WHL-KHHW/docker-compose.yml b/site/uat/TML-KHHW/docker-compose.yml similarity index 100% rename from site/uat/WHL-KHHW/docker-compose.yml rename to site/uat/TML-KHHW/docker-compose.yml diff --git a/site/uat/WHL-KHHW/rancher-compose.yml b/site/uat/TML-KHHW/rancher-compose.yml similarity index 100% rename from site/uat/WHL-KHHW/rancher-compose.yml rename to site/uat/TML-KHHW/rancher-compose.yml diff --git a/site/uat/create-stacks.sh b/site/uat/create-stacks.sh index d0e039b..91b48ce 100644 --- a/site/uat/create-stacks.sh +++ b/site/uat/create-stacks.sh @@ -4,12 +4,5 @@ export IPADDRESS=$(hostname -i) #Create Rancher Environment rancher env create UAT #Create Application Stacks -rancher --wait-state active --env UAT stack create TML-KHHW -f ./WHL-KHHW/docker-compose.yml -r ./WHL-KHHW/rancher-compose.yml -rancher --wait-state active --env UAT stack create TML-TXGW -f ./WHL-TXGW/docker-compose.yml -r ./WHL-TXGW/rancher-compose.yml -#Create Management Stacks -#Create necessary folders for volume mounting -mkdir -p -m 777 /docker/nexus3/nexus-data -mkdir -p -m 777 /docker/teamcity/data -mkdir -p -m 777 /docker/teamcity/logs -chmod -R 777 /docker/* -rancher --wait-state active --env UAT stack create Management-Backend -f ./Management-Backend/docker-compose.yml -r ./Management-Backend/rancher-compose.yml \ No newline at end of file +rancher --wait-state active --env UAT stack create TML-KHHW -f ./TML-KHHW/docker-compose.yml -r ./TML-KHHW/rancher-compose.yml +rancher --wait-state active --env UAT stack create TML-TXGW -f ./TML-TXGW/docker-compose.yml -r ./WHL-TXGW/rancher-compose.yml \ No newline at end of file