refactor: build on production updated
This commit is contained in:
parent
c9437d7c67
commit
8b445f9925
5
.env
5
.env
|
@ -1,9 +1,12 @@
|
|||
# app
|
||||
APP_NAME = Huaxin OA
|
||||
APP_PORT = 7001
|
||||
APP_PORT = 8001
|
||||
APP_BASE_URL = http://localhost:${APP_PORT}
|
||||
APP_LOCALE = zh-CN
|
||||
|
||||
# cluster
|
||||
CPU_LEN = 1
|
||||
|
||||
# logger
|
||||
LOGGER_LEVEL = verbose
|
||||
LOGGER_MAX_FILES = 31
|
||||
|
|
|
@ -6,7 +6,7 @@ FROM node:20-slim AS base
|
|||
|
||||
ENV PROJECT_DIR=/huaxin-admin \
|
||||
DB_HOST=mysql \
|
||||
APP_PORT=7001 \
|
||||
APP_PORT=8001 \
|
||||
PNPM_HOME="/pnpm" \
|
||||
PATH="$PNPM_HOME:$PATH"
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ pnpm migration:revert
|
|||
4.执行sql覆盖docker中的数据库
|
||||
|
||||
```bash
|
||||
docker exec -i huaxin-admin-mysql mysql -h 127.0.0.1 -u root -phuaxin123 hxoa < hxoa_2024-03-07_171919.sql
|
||||
docker exec -i huaxin-admin-mysql mysql -h 127.0.0.1 -u root -phuaxin123 hxoa < huaxinoa0327.sql
|
||||
```
|
||||
|
||||
更多细节,请移步至[官方文档](https://typeorm.io/migrations)
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 拉取最新的代码
|
||||
|
||||
git config core.fileMode false
|
||||
|
||||
git pull
|
||||
|
||||
docker compose --env-file .env --env-file .env.production up -d --build
|
||||
docker-compose --env-file .env --env-file .env.production up -d --build
|
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@ version: '3'
|
|||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:latest
|
||||
image: mysql:8.0
|
||||
container_name: huaxin-admin-mysql
|
||||
restart: always
|
||||
env_file:
|
||||
|
@ -17,10 +17,11 @@ services:
|
|||
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
|
||||
ports:
|
||||
- '${DB_PORT}:3306'
|
||||
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci #设置utf8字符集
|
||||
command:
|
||||
mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
|
||||
volumes:
|
||||
- ./__data/mysql/:/var/lib/mysql/ # ./__data/mysql/ 路径可以替换成自己的路径
|
||||
- ./deploy/sql/:/docker-entrypoint-initdb.d/ # 初始化的脚本,若 ./__data/mysql/ 文件夹存在数据,则不会执行初始化脚本
|
||||
- ./init_data/sql/:/docker-entrypoint-initdb.d/ # 初始化的脚本,若 ./__data/mysql/ 文件夹存在数据,则不会执行初始化脚本
|
||||
networks:
|
||||
- huaxin_admin_net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { cpus } = require('os')
|
||||
const { cpus } = require('os');
|
||||
|
||||
const cpuLen = cpus().length
|
||||
const cpuLen = cpus().length;
|
||||
|
||||
module.exports = {
|
||||
apps: [
|
||||
|
@ -10,13 +10,13 @@ module.exports = {
|
|||
autorestart: true,
|
||||
exec_mode: 'cluster',
|
||||
watch: false,
|
||||
instances: cpuLen,
|
||||
instances: process.env.CPU_LEN ?? cpuLen,
|
||||
max_memory_restart: '520M',
|
||||
args: '',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
PORT: process.env.APP_PORT,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
PORT: process.env.APP_PORT
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@ import path from 'node:path';
|
|||
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
const sql = fs.readFileSync(path.join(__dirname, '../../deploy/sql/hxoa.sql'), 'utf8');
|
||||
const sql = fs.readFileSync(path.join(__dirname, '../../init_data/sql/hxoa.sql'), 'utf8');
|
||||
|
||||
export class InitData1707996695540 implements MigrationInterface {
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
|
|
Loading…
Reference in New Issue