diff --git a/.env b/.env new file mode 100644 index 00000000..d88cde69 --- /dev/null +++ b/.env @@ -0,0 +1,13 @@ +#-----------------------Backend Config------------------------------# +# Prisma Config +DATABASE_URL=postgresql://root:wjyy26303@10.5.153.1:5432/canyon +#mongodb url +MONGODB_URL=mongodb://t_flttsworkstruct:HW3cp57rCtgk9DKUmFEz@flttsworkstruct01.mongo.db.fat.qa.nt.ctripcorp.com:55111/flttsworkstructdb +# Gitlab Auth Config +GITLAB_URL="http://git.dev.sh.ctripcorp.com" +GITLAB_TOKEN="6bb2887ea5bc21df691ab73f877b056593a798471f1a161e9b2682ed885dc84f" +GITLAB_CLIENT_ID="7fa15c07f39bf9a394e61a7fec497d2ff4b51545bcc84272fbbc7bac82dc4999" +GITLAB_CLIENT_SECRET="ed033561bb04e587fbcf738d38efa3e088e41ab07fd814787669d4f38ff062bb" + +# Backend URLs +VITE_BACKEND_API_URL=http://10.5.153.1:3170 diff --git a/.gitignore b/.gitignore index 6daa74da..ab25354a 100755 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,4 @@ dist-ssr pnpm-lock.yaml -.env \ No newline at end of file +#.env \ No newline at end of file diff --git a/app.config.js b/app.config.js new file mode 100644 index 00000000..480b8f62 --- /dev/null +++ b/app.config.js @@ -0,0 +1,7 @@ +const path = require('path') +const packageConfig = require(path.resolve(__dirname, './package.json')) + +module.exports = { + AppID: packageConfig.AppID, + Env: 'fws', +} diff --git a/eslint-report.json b/eslint-report.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/eslint-report.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/package.json b/package.json index f8ae727c..b239900b 100755 --- a/package.json +++ b/package.json @@ -12,5 +12,6 @@ }, "keywords": [], "author": "", - "license": "ISC" -} + "license": "ISC", + "AppId": "100034535" +} \ No newline at end of file diff --git a/scripts/dump.cmd b/scripts/dump.cmd new file mode 100644 index 00000000..e1ce984c --- /dev/null +++ b/scripts/dump.cmd @@ -0,0 +1,2 @@ +@echo off +node "%~dp0..\node_modules\@ctrip\node-vampire-heapdump\scripts\dumpApp.js" %* \ No newline at end of file diff --git a/scripts/dump.sh b/scripts/dump.sh new file mode 100644 index 00000000..c60611e2 --- /dev/null +++ b/scripts/dump.sh @@ -0,0 +1,3 @@ +#!/bin/bash +scriptsDir=$(dirname $BASH_SOURCE) +node ${scriptsDir%%/}/"../node_modules/@ctrip/node-vampire-heapdump/scripts/dumpApp.js" $* \ No newline at end of file diff --git a/scripts/processCount.sh b/scripts/processCount.sh new file mode 100644 index 00000000..be4ffa55 --- /dev/null +++ b/scripts/processCount.sh @@ -0,0 +1,3 @@ +#!/bin/bash +scriptsDir=$(dirname $BASH_SOURCE) +cat ${scriptsDir%%/}/"../node_modules/@ctrip/node-vampire-heapdump/.state.json" \ No newline at end of file diff --git a/scripts/shutdown.sh b/scripts/shutdown.sh new file mode 100644 index 00000000..7b136b1c --- /dev/null +++ b/scripts/shutdown.sh @@ -0,0 +1,3 @@ +pm2 delete all + +exit 0 diff --git a/scripts/startup.sh b/scripts/startup.sh new file mode 100644 index 00000000..c04b3e32 --- /dev/null +++ b/scripts/startup.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +appid=${PAAS_APP_APPID:-100034535} +appname=nodeapp-$appid + + +# 不同的环境因为机器配置不一样,使用不同的实例数 +case "$env" in + "FWS"|"FAT"|"LPT") + instance=1 + ;; + "UAT") + instance=5 + ;; + *) + instance=10 +;; +esac + +pm2 delete all + +if [ -d /opt/nodeapp ]; then + # docker + cd /opt/nodeapp +else + # vm + cd "$(dirname $BASH_SOURCE)/../current/" +fi + + +NODE_ENV=production pm2 start packages/app-backend/dist/main.js \ + -i $instance \ + --name $appname \ + --merge-logs \ + --log-date-format "YYYY-MM-DD HH:mm:ss.SSS" \ + --log "/opt/logs/$appid/outerr.log" \ + --output "/opt/logs/$appid/out.log" \ + --error "/opt/logs/$appid/err.log" +exit 0