diff --git a/docker/app-mariadb/docker-compose.yml b/docker/app-mariadb/docker-compose.yml index ff9d33b2b..e9c5678dd 100644 --- a/docker/app-mariadb/docker-compose.yml +++ b/docker/app-mariadb/docker-compose.yml @@ -17,6 +17,7 @@ services: - DB_USER=nocobase - DB_PASSWORD=nocobase - DB_TIMEZONE=+08:00 + - DB_UNDERSCORED=true volumes: - ./storage:/app/nocobase/storage ports: @@ -29,5 +30,7 @@ services: MYSQL_PASSWORD: nocobase MYSQL_ROOT_PASSWORD: nocobase restart: always + volumes: + - ./storage/db/mariadb:/var/lib/mysql networks: - nocobase \ No newline at end of file diff --git a/docker/app-mysql/docker-compose.yml b/docker/app-mysql/docker-compose.yml index 43351dfcd..c668c4d75 100644 --- a/docker/app-mysql/docker-compose.yml +++ b/docker/app-mysql/docker-compose.yml @@ -29,5 +29,7 @@ services: MYSQL_PASSWORD: nocobase MYSQL_ROOT_PASSWORD: nocobase restart: always + volumes: + - ./storage/db/mysql:/var/lib/mysql networks: - nocobase diff --git a/docker/app-postgres/docker-compose.yml b/docker/app-postgres/docker-compose.yml index d7e5c04e8..127e94ba6 100644 --- a/docker/app-postgres/docker-compose.yml +++ b/docker/app-postgres/docker-compose.yml @@ -28,5 +28,7 @@ services: POSTGRES_USER: nocobase POSTGRES_DB: nocobase POSTGRES_PASSWORD: nocobase + volumes: + - ./storage/db/postgres:/var/lib/postgresql/data networks: - nocobase \ No newline at end of file diff --git a/package.json b/package.json index e9017dcb8..2bc49fdcc 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "scripts": { "nocobase": "nocobase", "pm": "nocobase pm", + "pm2": "nocobase pm2", "dev": "nocobase dev", "dev-server": "nocobase dev --server", "start": "nocobase start", diff --git a/packages/core/cli/src/commands/index.js b/packages/core/cli/src/commands/index.js index 48bfd57ee..2dc619c51 100644 --- a/packages/core/cli/src/commands/index.js +++ b/packages/core/cli/src/commands/index.js @@ -16,6 +16,7 @@ module.exports = (cli) => { require('./e2e')(cli); require('./clean')(cli); require('./doc')(cli); + require('./pm2')(cli); require('./test')(cli); require('./umi')(cli); require('./upgrade')(cli); diff --git a/packages/core/cli/src/commands/pm2.js b/packages/core/cli/src/commands/pm2.js new file mode 100644 index 000000000..423b04a90 --- /dev/null +++ b/packages/core/cli/src/commands/pm2.js @@ -0,0 +1,28 @@ +const chalk = require('chalk'); +const { Command } = require('commander'); +const { run, isDev } = require('../util'); + +/** + * + * @param {Command} cli + */ +module.exports = (cli) => { + cli + .command('pm2') + .allowUnknownOption() + .action(() => { + run('pm2', process.argv.slice(3)); + }); + cli + .command('pm2-restart') + .allowUnknownOption() + .action(() => { + run('pm2', ['restart', 'all']); + }); + cli + .command('pm2-stop') + .allowUnknownOption() + .action(() => { + run('pm2', ['stop', 'all']); + }); +};