sunsheng 1 year ago
commit
5904457d16

+ 34 - 0
config-service.yaml

@@ -0,0 +1,34 @@
+log:
+  fileName: cr.log
+  level: 1
+  serviceName: cr-bus
+  
+configer:
+  -
+    name: cr-mongo
+    value: mongodb://root:crzzz_x@cr-mongo:27017/cr?authSource=admin
+    devValue: mongodb://root:crzzz_x@127.0.0.1:17017/cr?authSource=admin
+  
+  -
+    name: cr-user-mongo
+    value: mongodb://root:crzzz_x@cr-mongo:27017/user?authSource=admin
+    devValue: mongodb://root:crzzz_x@127.0.0.1:17017/user?authSource=admin
+
+  -
+    name: cr-redis
+    value: cr-redis:6379#0#default#crzzz_x
+    devValue: 127.0.0.1:16379#0#default#crzzz_x
+
+# adapter:
+#   -
+#     busName: comm
+#     nats: nats://comm-bus:4222
+
+startLocalNats: true
+startNatsShellParams: "-p 4222 -m 8222 -js"
+startNatsPort: 4222
+
+nats:
+  url: nats://cr-bus:4222
+  maxReconnect: 10000
+  reconnDelaySecond: 5

+ 94 - 0
docker-compose.yaml

@@ -0,0 +1,94 @@
+version: '3.8'
+
+# 网络
+networks:
+  default:
+    name: default-network
+    external: true
+
+services:
+  #nginx反向代理
+  cr-nginx:
+    image: "registry.cn-chengdu.aliyuncs.com/infish/pack-comm-nginx:1.23.1"
+    restart: always
+    ports:
+      - 8085:80
+    volumes:
+      - ./nginx/conf.d:/etc/nginx/conf.d
+      - ./nginx/www:/usr/share/nginx/html
+
+    depends_on:
+      - cr-svc
+      - cr-user
+      
+  #bus消息中间件
+  cr-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:
+      - cr-mongo
+      - cr-redis
+    ports:
+      - 14222:4222
+
+  #redis缓存
+  cr-redis:
+    image: "redis:alpine"
+    restart: always
+    command:
+      --requirepass "crzzz_x" #这一行是设置密码
+    privileged: true
+    ports:
+      - 16379:6379
+
+  cr-mongo:
+    image: mongo:4.4.1
+    restart: always
+    environment:
+      MONGO_INITDB_ROOT_USERNAME: root
+      MONGO_INITDB_ROOT_PASSWORD: crzzz_x
+    volumes:
+      - ~/cr-svc/data/mongo/db:/data/db
+      - ~/cr-svc/data/mongo/log:/var/log/mongodb
+    #command: mongod --port 27017 --replSet rs0
+    ports: 
+      - 17017:27017
+
+  # 3dshow
+  cr-svc:
+    image: registry.cn-chengdu.aliyuncs.com/infish/pack-cr:v1.0.0
+    restart: always
+    depends_on:
+      - cr-bus
+    environment: 
+      NATS: nats://cr-bus:4222
+    volumes:
+      - ~/cr-svc/data/package:/root/projects/package
+
+  # user服务
+  cr-user:
+    image: registry.cn-chengdu.aliyuncs.com/infish/pack-comm-usercenter:v1.0.1
+    restart: always
+    depends_on:
+      - cr-bus
+    environment: 
+      NATS: nats://cr-bus:4222
+      CONFIGER_MONGO: cr-user-mongo
+      CONFIGER_REDIS: cr-redis
+      CONFIGER_JWT: crsvc#crsvc_zzzzxxx#168
+      IGNORE_USERTYPE: "true"
+      # MONGO_MIGRATIONS: /data/migrations==mongodb://root:3dshow@3dshow-mongo-alpha:27017/supply-user?authSource=admin&&/data/migrations==mongodb://user:password@host:port/dbname?query
+      MONGO_MIGRATIONS: /data/migrations==mongodb://root:crzzz_x@cr-mongo:27017/user?authSource=admin
+    volumes:
+      - ./mongo-migrations:/data/migrations
+
+
+
+
+    
+
+
+

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

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

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

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

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

@@ -0,0 +1,56 @@
+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;
+    #}  
+
+   # 3dshow2.0 用户
+   location /user/ {
+      proxy_pass  http://3dshow2-user:8908/usercenter/;
+   }
+   
+   # 3dshow2.0
+   location / {
+      proxy_pass  http://3dshow2:8888/3dshow/;
+   }
+
+    #nats-exporter
+    # location /natsexporter/ {
+    #    proxy_pass  http://nats-exporter:7777/;
+    # }
+}

+ 1 - 0
nginx/www/index.html

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

+ 22 - 0
readme.md

@@ -0,0 +1,22 @@
+# 说明
+
+## api路径
+
+`https://localhost:8085/cr-svc/`
+
+## 包含服务
+
+cr-nginx
+8085
+
+cr-svc
+6123
+
+cr-mongo
+17017
+
+cr-redis
+16379
+
+cr-bus
+14222

+ 4 - 0
start.sh

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