Browse Source

revise rancher initial script

master
Richard Shih 5 years ago
parent
commit
8101626337
13 changed files with 39 additions and 51 deletions
  1. 20
      site/docker-compose.yml
  2. 6
      site/install-rancher.sh
  3. 9
      site/management-backend/create-stacks.sh
  4. 0
      site/management-backend/docker-compose.yml
  5. 0
      site/management-backend/rancher-compose.yml
  6. 2
      site/prod/TML-KHHW/docker-compose.yml
  7. 19
      site/prod/TML-KHHW/rancher-compose.yml
  8. 2
      site/prod/TML-TXGW/docker-compose.yml
  9. 17
      site/prod/TML-TXGW/rancher-compose.yml
  10. 4
      site/prod/create-stacks.sh
  11. 0
      site/uat/TML-KHHW/docker-compose.yml
  12. 0
      site/uat/TML-KHHW/rancher-compose.yml
  13. 11
      site/uat/create-stacks.sh

20
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

6
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

9
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

site/uat/Management-Backend/docker-compose.yml → site/management-backend/docker-compose.yml

site/uat/Management-Backend/rancher-compose.yml → site/management-backend/rancher-compose.yml

2
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:

19
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

2
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:

17
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

4
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
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

site/uat/WHL-KHHW/docker-compose.yml → site/uat/TML-KHHW/docker-compose.yml

site/uat/WHL-KHHW/rancher-compose.yml → site/uat/TML-KHHW/rancher-compose.yml

11
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
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
Loading…
Cancel
Save