增加启动脚本

This commit is contained in:
cebgcontract 2022-10-26 14:38:04 +08:00
parent b12565a346
commit cf3d451ebd
5 changed files with 54 additions and 7 deletions

13
boundle.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
source /etc/profile
npm install --prefer-offline --loglevel info --unsafe-perm=true --allow-root >> boundle.log
npm run build
mv node_modules dist/node_modules
echo 'move node_modules to dist/node_modules' >> boundle.log
cd ./dist/ && tar -zcvf ghost.tar.gz ./
cd ..
mkdir target && mv ./dist/ghost.tar.gz ./target/ghost.tar.gz
echo 'all done' 2>&1 >> boundle.log

View File

@ -5,6 +5,7 @@
"main": "index.js",
"scripts": {
"dev:api": "ts-node -r tsconfig-paths/register src/api.ts",
"build": "tsc",
"prod:api": "NODE_PATH=./dist node dist/api.js",
"lint": "eslint --ext .ts src/**",
"format": "eslint --ext .ts src/** --fix"
@ -19,6 +20,7 @@
"@typegoose/typegoose": "^9.12.1",
"axios": "^1.1.3",
"dotenv": "^16.0.3",
"fast-rbac": "^2.0.1",
"fastify": "^4.8.1",
"fastify-plugin": "^4.2.1",
"google-auth-library": "^8.5.2",

View File

@ -1,12 +1,12 @@
import { ApiServer } from "api.server";
import logger from "./logger/logger";
import { ApiServer } from './api.server'
import logger from './logger/logger'
class Server extends ApiServer {
constructor() {
super();
super()
}
}
let server = new Server();
server.start().then((address) => {
logger.log(`Api Server listening at ${address}`);
});
let server = new Server()
server.start().then(address => {
logger.log(`Api Server listening at ${address}`)
})

27
start.json Normal file
View File

@ -0,0 +1,27 @@
{
"apps": [
{
"name": "wallet-svr",
"script": "npm",
"args": "run prod:api",
"cwd": "/data/apps/wallet-svr",
"max_memory_restart": "1024M",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
"watch": true,
"ignore_watch": [
"node_modules",
"logs",
"fixtures",
"tasks"
],
"instances": 1,
"exec_mode": "cluster",
"env": {
"NODE_ENV": "production"
},
"env_production": {
"NODE_ENV": "production"
}
}
]
}

View File

@ -875,6 +875,11 @@ fast-querystring@^1.0.0:
dependencies:
fast-decode-uri-component "^1.0.1"
fast-rbac@^2.0.1:
version "2.0.1"
resolved "https://registry.npmmirror.com/fast-rbac/-/fast-rbac-2.0.1.tgz#1eb4370d6e2a9e2c49b56dab00c2fce4328cded9"
integrity sha512-mfvwVtEDNvMtJOJcfo71tIvqNtZScu/bCAWUBMcpLpcn+bRuveR4UCeXKl2uKFBUJB2zp7tLnsoMHRx4rFrtww==
fast-redact@^3.1.1:
version "3.1.2"
resolved "https://registry.npmmirror.com/fast-redact/-/fast-redact-3.1.2.tgz#d58e69e9084ce9fa4c1a6fa98a3e1ecf5d7839aa"