animeic 2 years ago
commit
0f362a247b
6 changed files with 206 additions and 0 deletions
  1. 37 0
      config-service.yaml
  2. 79 0
      docker-compose.yaml
  3. 67 0
      nginx/conf.d/default.conf
  4. 1 0
      nginx/www/index.html
  5. 18 0
      readme.md
  6. 4 0
      start.sh

+ 37 - 0
config-service.yaml

@@ -0,0 +1,37 @@
+log:
+  fileName: box-bus.log
+  level: 1
+  serviceName: box-bus
+  
+configer:
+  -
+    name: oilseal-train-mongo
+    value: mongodb://root:oilseal-train@oilseal-train-mongo:27017/oilseal-train?authSource=admin
+    devValue: mongodb://root:oilseal-train@124.71.139.24:37032/oilseal-train?authSource=admin
+  -
+    name: oilseal-train-user-mongo
+    value: mongodb://root:oilseal-train@oilseal-train-mongo:27017/oilseal-train-user?authSource=admin
+    devValue: mongodb://root:oilseal-train@124.71.139.24:37032/oilseal-train-user?authSource=admin
+
+
+  -
+    name: oilseal-train-redis
+    value: 3dshow-redis:6379#0#default#3dshow
+    devValue: 124.71.139.24:16392#0#default#3dshow
+
+  - name: bus-network
+    value: nats://124.71.139.24:14302
+
+# adapter:
+#   -
+#     busName: comm
+#     nats: nats://comm-bus:4222
+
+startLocalNats: true
+startNatsShellParams: "-p 4222 -m 8222 -js"
+startNatsPort: 4222
+
+nats:
+  url: nats://comm-bus:4222
+  maxReconnect: 10000
+  reconnDelaySecond: 5

+ 79 - 0
docker-compose.yaml

@@ -0,0 +1,79 @@
+version: '3.8'
+
+# 网络
+networks:
+  default:
+    name: default-network
+    external: true
+
+services:
+  #nginx反向代理
+  oilseal-train-nginx:
+    image: "registry.cn-chengdu.aliyuncs.com/infish/pack-comm-nginx:1.23.1"
+    restart: always
+    ports:
+      - 18090:80
+    volumes:
+      - ./nginx/conf.d:/etc/nginx/conf.d
+      - ./nginx/www:/usr/share/nginx/html
+
+    depends_on:
+      - oilseal-train
+      - oilseal-train-user
+      
+  #bus消息中间件
+  oilseal-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:
+      - oilseal-train-mongo
+      - oilseal-train-redis    
+    ports:
+      - 14302:4222
+
+  #redis缓存
+  oilseal-train-redis:
+    image: "redis:alpine"
+    restart: always
+    command:
+      --requirepass "oilseal-train" #这一行是设置密码
+    privileged: true
+    ports:
+      - 16392:6379
+
+  #mongo 数据库
+  oilseal-train-mongo:
+    image: mongo:4.4.1
+    restart: always
+    environment:
+      MONGO_INITDB_ROOT_USERNAME: root
+      MONGO_INITDB_ROOT_PASSWORD: oilseal-train
+    volumes:
+      - ~/data/packs-oilseal-train/mongo/db:/data/db
+      - ~/data/packs-oilseal-train/mongo/log:/var/log/mongodb
+    ports: 
+      - 37032:27017
+
+  # oilseal-train
+  oilseal-train:
+    image: registry.cn-chengdu.aliyuncs.com/infish/pack-oilseal-train:v1.0.0
+    restart: always
+    depends_on:
+      - oilseal-train-bus
+    environment: 
+      NATS: nats://oilseal-train-bus:4222
+
+  # user服务
+  oilseal-train-user:
+    image: registry.cn-chengdu.aliyuncs.com/infish/pack-comm-usercenter:v1.0.0
+    restart: always
+    depends_on:
+      - oilseal-train-bus
+    environment: 
+      NATS: nats://oilseal-train-bus:4222
+      CONFIGER_MONGO: oilseal-train-user-mongo
+      CONFIGER_REDIS: oilseal-train-redis
+  

+ 67 - 0
nginx/conf.d/default.conf

@@ -0,0 +1,67 @@
+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;
+    }
+
+    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+    #
+    #location ~ \.php$ {
+    #    proxy_pass   http://127.0.0.1;
+    #}
+
+    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+    #
+    #location ~ \.php$ {
+    #    root           html;
+    #    fastcgi_pass   127.0.0.1:9000;
+    #    fastcgi_index  index.php;
+    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
+    #    include        fastcgi_params;
+    #}
+
+    # deny access to .htaccess files, if Apache's document root
+    # concurs with nginx's one
+    #
+    #location ~ /\.ht {
+    #    deny  all;
+    #}
+
+    location /supplier/ {
+       proxy_pass  http://3dshow-supplier:8888/supplier/;
+    }  
+
+    location /customer/ {
+       proxy_pass  http://3dshow-customer:8888/customer/;
+    }   
+
+    location /supplyUser/ {
+       proxy_pass  http://3dshow-supply-user:8908/usercenter/;
+    }   
+
+    location /customerUser/ {
+       proxy_pass  http://3dshow-customer-user:8908/usercenter/;
+    }   
+
+    # 用户接口
+    # location /usercenter/ {
+    #    proxy_pass  http://box-usercenter:8908/usercenter/;
+    # }
+
+    #nats-exporter
+    # location /natsexporter/ {
+    #    proxy_pass  http://nats-exporter:7777/;
+    # }
+}

+ 1 - 0
nginx/www/index.html

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

+ 18 - 0
readme.md

@@ -0,0 +1,18 @@
+# 说明
+
+## api路径
+
+`https://3dqueen.cloud/oilseal/v1/train/`
+
+## 包含服务
+
+oilseal-train
+18090
+oilseal-train-mongo
+37032
+
+oilseal-train-redis
+16392
+
+oilseal-train-bus
+14302

+ 4 - 0
start.sh

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