suncloud hai 1 ano
pai
achega
89442ca1dc

+ 28 - 0
pack-copter-train/config-service.yaml

@@ -0,0 +1,28 @@
+log:
+  fileName: copter-train-bus.log
+  level: 1
+  serviceName: copter-train-bus
+  
+configer:
+  -
+    name: copter-train-mongo
+    value: mongodb://root:copter-train-8888@copter-train-mongo:27017/copter?authSource=admin
+    devValue: mongodb://root:copter-train-8888@124.70.148.113:27019/copter?authSource=admin
+  -
+    name: copter-train-redis
+    value: copter-train-redis:6379#0#default#copter_vxxx
+    # devValue: 47.108.113.38:6397#0#default#copter_vxxx
+
+# adapter:
+#   -
+#     busName: comm
+#     nats: nats://comm-bus:4222
+
+startLocalNats: true
+startNatsShellParams: "-p 4222 -m 8222 -js"
+startNatsPort: 4222
+
+nats:
+  url: nats://copter-train-bus:4222
+  maxReconnect: 10000
+  reconnDelaySecond: 5

+ 67 - 0
pack-copter-train/docker-compose.yaml

@@ -0,0 +1,67 @@
+version: '3.8'
+
+# 网络
+networks:
+  default:
+    name: default-network
+    external: true
+
+services:
+  #nginx反向代理
+  copter-train-nginx:
+    image: "registry.cn-chengdu.aliyuncs.com/infish/pack-comm-nginx:1.23.1"
+    restart: always
+    ports:
+      - 8101:80
+    volumes:
+      - ./nginx/conf.d:/etc/nginx/conf.d
+      - ./nginx/www:/usr/share/nginx/html
+
+    depends_on:
+      - copter-train
+
+  #bus消息中间件
+  copter-train-bus:
+    restart: always
+    image: registry.cn-chengdu.aliyuncs.com/infish/pack-comm-bus:v1.0.0
+    volumes:
+      - ./config-service.yaml:/root/bus/app.yaml
+    depends_on:
+      - copter-train-mongo
+      - copter-train-redis    
+    ports:
+      - 4223:4222
+
+  #redis缓存
+  copter-train-redis:
+    image: "redis:alpine"
+    restart: always
+    command:
+      --requirepass "copter_vxxx" #这一行是设置密码
+    privileged: true
+    # ports:
+    #   - 6397:6379
+
+  #mongo 数据库
+  copter-train-mongo:
+    image: mongo:4.4.1
+    restart: always
+    environment:
+      MONGO_INITDB_ROOT_USERNAME: root
+      MONGO_INITDB_ROOT_PASSWORD: copter-train-8888
+    volumes:
+      - /data/project-data/pack-copter-train/mongo/db:/data/db
+      - /data/project-data/pack-copter-train/mongo/log:/var/log/mongodb
+    ports:
+      - 27019:27017
+
+  copter-train:
+    image: registry.cn-chengdu.aliyuncs.com/infish/pack-copter-train:v1.0.0
+    restart: always
+    depends_on:
+      - copter-train-bus
+    environment: 
+      NATS: nats://copter-train-bus:4222
+      CONFIGER_MONGO: copter-train-mongo
+      CONFIGER_REDIS: copter-train-redis
+

+ 15 - 0
pack-copter-train/mongo-migrations/1_apps.down.json

@@ -0,0 +1,15 @@
+[
+    {
+        "delete": "apps",
+        "deletes": [
+           {
+             "q" : {
+                "_id": {
+                    "$oid": "637dde15ad5446a2050456f1"
+                }
+             },
+             "limit" : 1
+           }
+        ]
+     }
+]

+ 13 - 0
pack-copter-train/mongo-migrations/1_apps.up.json

@@ -0,0 +1,13 @@
+[
+    {
+        "insert": "apps",
+        "documents": [ {
+            "_id": {
+                "$oid": "637dde15ad5446a2050456f1"
+            },
+            "name": "adxihua",
+            "key": "adxihua",
+            "restrict": false
+        }]
+     }
+]

+ 31 - 0
pack-copter-train/nginx/conf.d/default.conf

@@ -0,0 +1,31 @@
+server {
+    listen       80;
+    listen  [::]:80;
+    server_name  localhost;
+    #access_log  /var/log/nginx/host.access.log  main;
+    # location / {
+    #     root   /usr/share/nginx/html;
+    #     index  index.html index.htm;
+    # }
+    #error_page  404              /404.html;
+
+    # redirect server error pages to the static page /50x.html
+    #
+    error_page   500 502 503 504  /50x.html;
+    location = /50x.html {
+        root   /usr/share/nginx/html;
+    }
+
+    # 客户端上传文件最大值
+    # client_max_body_size 50M;
+    # client_body_buffer_size 30M;
+    
+    location / {
+       proxy_set_header Host $host:$server_port; #远程主机 IP:PORT
+       proxy_set_header X-Real-PORT $remote_port; #远程端口
+       proxy_set_header X-Real-IP $remote_addr; #远程地址
+       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #远程代理地址
+       proxy_pass  http://copter-train:8101/;
+    }   
+
+}

+ 1 - 0
pack-copter-train/nginx/www/index.html

@@ -0,0 +1 @@
+hello world~!!!

+ 4 - 0
pack-copter-train/start.sh

@@ -0,0 +1,4 @@
+#!/bin/bash
+
+docker-compose up -d --remove-orphans
+docker-compose ps