Browse Source

Merge branch 'master' of http://git.fmode.cn:3000/bin/nova-live

warrior 2 months ago
parent
commit
4645124e8d
4 changed files with 174 additions and 135 deletions
  1. 144 0
      config/nginx.conf
  2. 19 0
      deploy.dev.ps1
  3. 8 8
      deploy.ps1
  4. 3 127
      package-lock.json

+ 144 - 0
config/nginx.conf

@@ -0,0 +1,144 @@
+server {
+
+    server_name server.gdchat.cn;
+    server_tokens off;
+
+    #large_client_header_buffers 4 32k;
+    client_max_body_size 50M;
+    charset utf-8;
+    index index.html;
+
+    # 启动SSL及证书匹配 ######################################################
+    listen 443 ssl default_server; # managed by Certbot
+
+    ssl_certificate /etc/letsencrypt/live/gdchat.cn/fullchain.pem; # managed by Certbot
+    ssl_certificate_key /etc/letsencrypt/live/gdchat.cn/privkey.pem; # managed by Certbot
+
+    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
+    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
+
+	# 启用OCSP stapling ######################################################
+	ssl_stapling on;
+	ssl_stapling_verify on;
+	# valid表示缓存5分钟
+	#resolver 8.8.8.8 8.8.4.4 valid=300s;
+	resolver 202.96.128.143 114.114.114.114 valid=300s;
+	# 网络超时时间
+	resolver_timeout 5s;
+
+	# 启动Gzip Json模式 ######################################################
+	gzip_http_version 1.0;  # gzip支持http协议 proxy 必须用
+    gzip  on;
+    gzip_vary on;
+    gzip_proxied       any;
+    gzip_static on;
+    gzip_comp_level  4;
+    gzip_min_length 256;
+    gzip_buffers     4 8k;
+    gzip_types       text/html text/plain application/javascript application/x-javascript text/css application/xml application/json;
+
+
+    # Common Api For Nova Cloud To DIY RESTful services
+
+    location /api {
+        #
+        # Wide-open CORS config for nginx
+        #
+        if ($request_method = 'OPTIONS') {
+           add_header 'Access-Control-Allow-Origin' '*';
+           add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+           #
+           # Custom headers and headers various browsers *should* be OK with but aren't
+           #
+           add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
+           #
+           # Tell client that this pre-flight info is valid for 20 days
+           #
+           add_header 'Access-Control-Max-Age' 1728000;
+           add_header 'Content-Type' 'text/plain; charset=utf-8';
+           add_header 'Content-Length' 0;
+           return 204;
+        }
+        if ($request_method = 'POST') {
+           add_header 'Access-Control-Allow-Origin' '*' always;
+           add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
+           add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
+           add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
+        }
+        if ($request_method = 'GET') {
+           add_header 'Access-Control-Allow-Origin' '*' always;
+           add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
+           add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
+           add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
+        }
+
+        rewrite ^/(.*)$ /$1 break;
+        proxy_pass https://server.fmode.cn/api;
+    }
+location /api/apig/face/match {
+        #
+        # Wide-open CORS config for nginx
+        #
+        if ($request_method = 'OPTIONS') {
+           add_header 'Access-Control-Allow-Origin' '*';
+           add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+           #
+           # Custom headers and headers various browsers *should* be OK with but aren't
+           #
+           add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Access-Control-Allow-Origin';
+           #
+           # Tell client that this pre-flight info is valid for 20 days
+           #
+           add_header 'Access-Control-Max-Age' 1728000;
+           add_header 'Content-Type' 'text/plain; charset=utf-8';
+           add_header 'Content-Length' 0;
+           return 204;
+        }
+        if ($request_method = 'POST') {
+           add_header 'Access-Control-Allow-Origin' '*' always;
+           add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
+           add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Access-Control-Allow-Origin' always;
+           add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
+        }
+        if ($request_method = 'GET') {
+           add_header 'Access-Control-Allow-Origin' '*' always;
+           add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
+           add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Access-Control-Allow-Origin' always;
+           add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
+        }
+
+        rewrite ^/(.*)$ /$1 break;
+        proxy_pass https://server.fmode.cn/api/apig/face/match;
+    }
+location /api/novaql {
+        #
+        # Wide-open CORS config for nginx
+        #
+                #add_header 'Access-Control-Allow-Origin' '*';
+                add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, POST, DELETE, OPTIONS';
+                add_header 'Access-Control-Allow-Credentials' 'true';
+                add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Access-Control-Allow-Headers, Access-Control-Request-Method, Access-Control-Request-Headers,Authorization';
+
+        rewrite ^/(.*)$ /$1 break;
+        proxy_pass https://server.fmode.cn/api;
+    }
+
+    location /{
+        #
+        # Wide-open CORS config for nginx
+        #
+        #        add_header 'Access-Control-Allow-Origin' '*';
+        #        add_header 'Access-Control-Allow-Credentials' 'true';
+
+        #
+        # set back end proxy
+        #
+        proxy_set_header Host $http_host;
+        proxy_set_header X-Real-IP $remote_addr;
+        proxy_set_header X-Scheme $scheme;
+        proxy_set_header X-Forwarded-Proto $scheme;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+        proxy_pass https://server.fmode.cn/;
+        proxy_redirect off;
+    }
+}

+ 19 - 0
deploy.dev.ps1

@@ -0,0 +1,19 @@
+
+# https://app.fmode.cn/dev/live/tabs/home
+# 打包项目,携带应用前缀(index.html中相对路径将自动修复为/dev/live前缀)
+# live-app 子项目名称
+# /dev/ 项目测试版上传路径
+# /dev/live live-app项目预留路径
+ng build live-app --base-href=/dev/live/
+
+# 清空旧文件目录
+obsutil rm obs://nova-cloud/dev/live -r -f -i=XSUWJSVMZNHLWFAINRZ1 -k=P4TyfwfDovVNqz08tI1IXoLWXyEOSTKJRVlsGcV6 -e="obs.cn-south-1.myhuaweicloud.com"
+
+# 同步文件目录
+obsutil sync ./dist/live-app/browser obs://nova-cloud/dev/live  -i=XSUWJSVMZNHLWFAINRZ1 -k=P4TyfwfDovVNqz08tI1IXoLWXyEOSTKJRVlsGcV6 -e="obs.cn-south-1.myhuaweicloud.com" -acl=public-read
+
+# 授权公开可读
+obsutil chattri obs://nova-cloud/dev/live -r -f -i=XSUWJSVMZNHLWFAINRZ1 -k=P4TyfwfDovVNqz08tI1IXoLWXyEOSTKJRVlsGcV6 -e="obs.cn-south-1.myhuaweicloud.com" -acl=public-read
+
+# 超级权限(内部机密AKSK)
+hcloud CDN CreateRefreshTasks/v2 --cli-region="cn-north-1" --refresh_task.urls.1="https://app.fmode.cn/dev/live/" --refresh_task.type="directory" --cli-access-key=2BFF7JWXAIJ0UGNJ0OSB --cli-secret-key=NaPCiJCGmD3nklCzX65s8mSK1Py13ueyhgepa0s1

+ 8 - 8
deploy.ps1

@@ -1,19 +1,19 @@
 
-# https://app.fmode.cn/dev/live/tabs/home
-# 打包项目,携带应用前缀(index.html中相对路径将自动修复为/dev/live前缀)
+# https://chat.gdchat.cn/tabs/home
+# 打包项目,携带应用前缀(index.html中相对路径将自动修复为前缀)
 # live-app 子项目名称
 # /dev/ 项目测试版上传路径
-# /dev/live live-app项目预留路径
-ng build live-app --base-href=/dev/live/
+#  live-app项目预留路径
+ng build live-app
 
 # 清空旧文件目录
-obsutil rm obs://nova-cloud/dev/live -r -f -i=XSUWJSVMZNHLWFAINRZ1 -k=P4TyfwfDovVNqz08tI1IXoLWXyEOSTKJRVlsGcV6 -e="obs.cn-south-1.myhuaweicloud.com"
+obsutil rm obs://gdchat-app -r -f -i=UFJ22GIEDLZAIU7Q7PM8 -k=biKvfZoA69m6dGb3cYvOilunwnW8wQOBvh5yNbGf -e="obs.cn-south-1.myhuaweicloud.com"
 
 # 同步文件目录
-obsutil sync ./dist/live-app/browser obs://nova-cloud/dev/live  -i=XSUWJSVMZNHLWFAINRZ1 -k=P4TyfwfDovVNqz08tI1IXoLWXyEOSTKJRVlsGcV6 -e="obs.cn-south-1.myhuaweicloud.com" -acl=public-read
+obsutil sync ./dist/live-app/browser obs://gdchat-app  -i=UFJ22GIEDLZAIU7Q7PM8 -k=biKvfZoA69m6dGb3cYvOilunwnW8wQOBvh5yNbGf -e="obs.cn-south-1.myhuaweicloud.com" -acl=public-read
 
 # 授权公开可读
-obsutil chattri obs://nova-cloud/dev/live -r -f -i=XSUWJSVMZNHLWFAINRZ1 -k=P4TyfwfDovVNqz08tI1IXoLWXyEOSTKJRVlsGcV6 -e="obs.cn-south-1.myhuaweicloud.com" -acl=public-read
+obsutil chattri obs://gdchat-app -r -f -i=UFJ22GIEDLZAIU7Q7PM8 -k=biKvfZoA69m6dGb3cYvOilunwnW8wQOBvh5yNbGf -e="obs.cn-south-1.myhuaweicloud.com" -acl=public-read
 
 # 超级权限(内部机密AKSK)
-hcloud CDN CreateRefreshTasks/v2 --cli-region="cn-north-1" --refresh_task.urls.1="https://app.fmode.cn/dev/live/" --refresh_task.type="directory" --cli-access-key=2BFF7JWXAIJ0UGNJ0OSB --cli-secret-key=NaPCiJCGmD3nklCzX65s8mSK1Py13ueyhgepa0s1
+hcloud CDN CreateRefreshTasks/v2 --cli-region="cn-north-1" --refresh_task.urls.1="https://chat.gdchat.cn/" --refresh_task.type="directory" --cli-access-key=UFJ22GIEDLZAIU7Q7PM8 --cli-secret-key=biKvfZoA69m6dGb3cYvOilunwnW8wQOBvh5yNbGf

File diff suppressed because it is too large
+ 3 - 127
package-lock.json


Some files were not shown because too many files changed in this diff