Browse Source

更新部署脚本

test
smallchill 6 years ago
parent
commit
1c0208739e
  1. 6
      blade-common/src/main/java/org/springblade/common/constant/CommonConstant.java
  2. 4
      doc/docker/README.md
  3. 0
      doc/nacos/README.md
  4. 4
      doc/nacos/blade-prod.yaml
  5. 4
      doc/nacos/blade-test.yaml
  6. 2
      pom.xml
  7. 2
      script/docker/.env
  8. 29
      script/docker/deploy.sh
  9. 49
      script/docker/docker-compose.yml
  10. 19
      script/docker/nacos/custom.properties

6
blade-common/src/main/java/org/springblade/common/constant/CommonConstant.java

@ -10,12 +10,12 @@ public interface CommonConstant {
/**
* nacos dev 地址
*/
String NACOS_DEV_ADDR = "127.0.0.1:8848";
String NACOS_DEV_ADDR = "10.211.55.5:8848";
/**
* nacos prod 地址
*/
String NACOS_PROD_ADDR = "192.168.0.157:8848";
String NACOS_PROD_ADDR = "172.30.0.48:8848";
/**
* sentinel dev 地址
@ -25,7 +25,7 @@ public interface CommonConstant {
/**
* sentinel prod 地址
*/
String SENTINEL_PROD_ADDR = "192.168.0.157:8858";
String SENTINEL_PROD_ADDR = "172.30.0.48:8858";
/**
* sword 系统名

4
doc/docker/README.md

@ -4,7 +4,7 @@
```
<servers>
<server>
<id>192.168.0.157</id>
<id>10.211.55.5</id>
<username>admin</username>
<password>Harbor12345</password>
<configuration>
@ -20,7 +20,7 @@
###2. docker开启远程访问
如果没有远程访问,会报 `Connect to 192.168.0.157:2375 [/192.168.0.157] failed: Connection refused: connect`
如果没有远程访问,会报 `Connect to 10.211.55.5:2375 [/10.211.55.5] failed: Connection refused: connect`
在`/usr/lib/systemd/system/docker.service`,配置远程访问。主要是在[Service]这个部分,加上下面两个参数:

0
script/docker/nacos.md → doc/nacos/README.md

4
doc/nacos/blade-prod.yaml

@ -2,7 +2,7 @@
spring:
redis:
##redis 单机环境配置
host: 192.168.0.157
host: 10.211.55.5
port: 3379
password:
database: 0
@ -17,6 +17,6 @@ blade:
#通用开发生产环境数据库地址(特殊情况可在对应的子工程里配置覆盖)
datasource:
prod:
url: jdbc:mysql://192.168.0.157:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8
url: jdbc:mysql://10.211.55.5:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8
username: root
password: root

4
doc/nacos/blade-test.yaml

@ -2,7 +2,7 @@
spring:
redis:
##redis 单机环境配置
host: 192.168.0.157
host: 10.211.55.5
port: 3379
password:
database: 0
@ -17,6 +17,6 @@ blade:
#通用开发生产环境数据库地址(特殊情况可在对应的子工程里配置覆盖)
datasource:
test:
url: jdbc:mysql://192.168.0.157:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8
url: jdbc:mysql://10.211.55.5:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8
username: root
password: root

2
pom.xml

@ -27,7 +27,7 @@
<spring.platform.version>Cairo-SR7</spring.platform.version>
<!-- 推荐使用Harbor -->
<docker.registry.url>192.168.0.157</docker.registry.url>
<docker.registry.url>10.211.55.5</docker.registry.url>
<docker.registry.host>http://${docker.registry.url}:2375</docker.registry.host>
<docker.plugin.version>1.2.0</docker.plugin.version>
</properties>

2
script/docker/.env

@ -1,2 +0,0 @@
REGISTER=192.168.0.157/blade
TAG=2.0.0.RC6

29
script/docker/deploy.sh

@ -16,23 +16,31 @@ port(){
service firewalld restart
}
#启动基础模块
base(){
##放置挂载文件
mount(){
if test ! -f "/docker/nginx/gateway/nginx.conf" ;then
mkdir /docker/nginx/gateway
cp /nginx/gateway/nginx.conf /docker/nginx/gateway/nginx.conf
mkdir -p /docker/nginx/gateway
cp nginx/gateway/nginx.conf /docker/nginx/gateway/nginx.conf
fi
if test ! -f "/docker/nginx/web/nginx.conf" ;then
mkdir /docker/nginx/web
cp /nginx/web/nginx.conf /docker/nginx/web/nginx.conf
cp /nginx/web/html /docker/nginx/web/html
mkdir -p /docker/nginx/web
cp nginx/web/nginx.conf /docker/nginx/web/nginx.conf
cp -r nginx/web/html /docker/nginx/web/html
fi
docker-compose up -d nacos prometheus grafana sentinel web-nginx blade-nginx blade-redis blade-gateway1 blade-gateway2 blade-gateway3
if test ! -f "/docker/nacos/init.d/custom.properties" ;then
mkdir -p /docker/nacos/init.d
cp nacos/custom.properties /docker/nacos/init.d/custom.properties
fi
}
#启动基础模块
base(){
docker-compose up -d nacos sentinel web-nginx blade-nginx blade-redis
}
#启动程序模块
modules(){
docker-compose up -d blade-admin blade-auth blade-user blade-desk blade-system blade-log
docker-compose up -d blade-gateway1 blade-gateway2 blade-gateway3 blade-admin blade-auth blade-user blade-desk blade-system blade-log
}
#关闭所有模块
@ -55,6 +63,9 @@ case "$1" in
"port")
port
;;
"mount")
mount
;;
"base")
base
;;

49
script/docker/docker-compose.yml

@ -1,46 +1,27 @@
version: '3'
services:
nacos:
image: nacos/nacos-server:latest
container_name: nacos
image: nacos/nacos-server:0.9.0
hostname: "nacos-standalone"
environment:
- PREFER_HOST_MODE=hostname
- MODE=standalone
volumes:
- ./standalone-logs/:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
- /docker/nacos/standalone-logs/:/home/nacos/logs
- /docker/nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties
ports:
- 8848:8848
networks:
blade_net:
ipv4_address: 172.30.0.48
prometheus:
container_name: prometheus
image: prom/prometheus:latest
volumes:
- ./prometheus/prometheus-standalone.yaml:/etc/prometheus/prometheus.yml
ports:
- 9090:9090
depends_on:
- nacos
restart: on-failure
grafana:
container_name: grafana
image: grafana/grafana:latest
ports:
- 3000:3000
restart: on-failure
sentinel:
container_name: sentinel
image: bladex/sentinel-dashboard:1.4.2
hostname: "sentinel"
ports:
- 8858:8858
restart: on-failure
networks:
blade_net:
ipv4_address: 172.30.0.58
- blade_net
blade-nginx:
image: nginx:stable-alpine-perl
@ -81,7 +62,7 @@ services:
- blade_net
blade-admin:
image: "${REGISTER}/blade-admin:${TAG}"
image: "10.211.55.5/blade/blade-admin:2.0.0.RC6"
ports:
- 7002:7002
privileged: true
@ -90,7 +71,7 @@ services:
- blade_net
blade-gateway1:
image: "${REGISTER}/blade-gateway:${TAG}"
image: "10.211.55.5/blade/blade-gateway:2.0.0.RC6"
privileged: true
restart: always
networks:
@ -98,7 +79,7 @@ services:
ipv4_address: 172.30.0.81
blade-gateway2:
image: "${REGISTER}/blade-gateway:${TAG}"
image: "10.211.55.5/blade/blade-gateway:2.0.0.RC6"
privileged: true
restart: always
networks:
@ -106,7 +87,7 @@ services:
ipv4_address: 172.30.0.82
blade-gateway3:
image: "${REGISTER}/blade-gateway:${TAG}"
image: "10.211.55.5/blade/blade-gateway:2.0.0.RC6"
privileged: true
restart: always
networks:
@ -114,35 +95,35 @@ services:
ipv4_address: 172.30.0.83
blade-auth:
image: "${REGISTER}/blade-auth:${TAG}"
image: "10.211.55.5/blade/blade-auth:2.0.0.RC6"
privileged: true
restart: always
networks:
- blade_net
blade-log:
image: "${REGISTER}/blade-log:${TAG}"
image: "10.211.55.5/blade/blade-log:2.0.0.RC6"
privileged: true
restart: always
networks:
- blade_net
blade-desk:
image: "${REGISTER}/blade-desk:${TAG}"
image: "10.211.55.5/blade/blade-desk:2.0.0.RC6"
privileged: true
restart: always
networks:
- blade_net
blade-user:
image: "${REGISTER}/blade-user:${TAG}"
image: "10.211.55.5/blade/blade-user:2.0.0.RC6"
privileged: true
restart: always
networks:
- blade_net
blade-system:
image: "${REGISTER}/blade-system:${TAG}"
image: "10.211.55.5/blade/blade-system:2.0.0.RC6"
privileged: true
restart: always
networks:

19
script/docker/nacos/custom.properties

@ -0,0 +1,19 @@
#spring.security.enabled=false
#management.security=false
#security.basic.enabled=false
#nacos.security.ignore.urls=/**
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for prometheus
management.endpoints.web.exposure.include=*
# metrics for elastic search
#management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for influx
#management.metrics.export.influx.enabled=false
#management.metrics.export.influx.db=springboot
#management.metrics.export.influx.uri=http://localhost:8086
#management.metrics.export.influx.auto-create-db=true
#management.metrics.export.influx.consistency=one
#management.metrics.export.influx.compressed=true
Loading…
Cancel
Save