Эх сурвалжийг харах

添加自动化部署脚本

zhh 6 жил өмнө
parent
commit
f92927086d

+ 62 - 0
document/docker/docker-compose.yml

@@ -0,0 +1,62 @@
+version: '2'
+services:
+  mysql:
+    image: mysql:5.7
+    ports:
+      - 3306:3306
+    volumes:
+      - /mydata/mysql/data:/var/lib/mysql
+      - /mydata/mysql/conf:/etc/mysql
+      - /mydata/mysql/log:/var/log/mysql
+    environment:
+      - MYSQL_ROOT_PASSWORD:root
+  elasticsearch:
+    image: elasticsearch:2.4
+    ports:
+      - 9200:9200
+      - 9300:9300
+    volumes:
+      - /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins
+      - /mydata/elasticsearch/data:/usr/share/elasticsearch/data
+  redis:
+    image: redis:3.2
+    ports:
+      - 6379:6379
+    volumes:
+      - /mydata/redis/data:/data
+    command: redis-server --appendonly yes
+  mongo:
+    image: mongo:3.2
+    ports:
+      - 27017:27017
+    volumes:
+      - /mydata/mongo/db:/data/db
+  nginx:
+    image: nginx:1.10
+    ports:
+      - 80:80
+    volumes:
+      - /mydata/nginx/html:/usr/share/nginx/html
+      - /mydata/nginx/logs:/var/log/nginx
+      - /mydata/nginx/conf:/etc/nginx
+  mall-admin:
+    image: mall/mall-admin:0.0.1-SNAPSHOT
+    ports:
+      - 8080:8080
+    links:
+      - mysql:db
+  mall-search:
+    image: mall/mall-search:0.0.1-SNAPSHOT
+    ports:
+      - 8081:8081
+    links:
+      - elasticsearch:es
+      - mysql:db
+  mall-portal:
+    image: mall/mall-portal:0.0.1-SNAPSHOT
+    ports:
+      - 8085:8085
+    links:
+      - redis:redis
+      - mongo:mongo
+      - mysql:db

+ 13 - 4
document/docker/docker-deploy.md

@@ -27,7 +27,7 @@ docker pull mysql:5.7
 ###创建实例并启动
 docker run -p 3306:3306 --name mysql \
 -v /mydata/mysql/log:/var/log/mysql \
--v /mydata/mysql/data:/var/lib/mysql/ \
+-v /mydata/mysql/data:/var/lib/mysql \
 -v /mydata/mysql/conf:/etc/mysql \
 -e MYSQL_ROOT_PASSWORD=123456  \
 -d mysql:5.7
@@ -85,7 +85,10 @@ rabbitmq:management
 ###下载镜像文件
 docker pull elasticsearch:2.4
 ###创建实例并运行
-docker run -p 9200:9200 -p 9300:9300 --name elasticsearch -d elasticsearch:2.4
+docker run -p 9200:9200 -p 9300:9300 --name elasticsearch \
+-v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
+-v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \
+-d elasticsearch:2.4
 ###测试
 访问会返回版本信息:http://192.168.1.66:9200/
 ###安装目录位置
@@ -111,7 +114,7 @@ docker run -p 27017:27017 --name mongo -v $PWD/db:/data/db -d mongo:3.2
 ###使用mongo命令进入容器
 docker exec -it mongo mongo
 
-##SpringBoot应用部署
+##SpringBoot应用命令部署
 **docker容器间进行连接才能互相访问**
 ###部署mall-admin
 docker run -p 8080:8080 --name mall-admin \
@@ -127,4 +130,10 @@ docker run -p 8085:8085 --name mall-portal \
 --link mysql:db \
 --link redis:redis \
 --link mongo:mongo \
--d mall/mall-portal:0.0.1-SNAPSHOT
+-d mall/mall-portal:0.0.1-SNAPSHOT
+
+##SpringBoot应用自动化部署
+###部署文件
+document/docker/docker-compose.yml
+###部署命令
+docker-compose up -d

+ 7 - 4
document/docker/host.txt

@@ -1,4 +1,7 @@
-192.168.1.71 db
-192.168.1.71 es
-192.168.1.71 redis
-192.168.1.71 mongo
+192.168.1.78 db
+192.168.1.78 es
+192.168.1.78 redis
+192.168.1.78 mongo
+192.168.1.78 mall-admin
+192.168.1.78 mall-search
+192.168.1.78 mall-portal