diff --git a/docker-compose.yaml b/docker-compose.yaml index 97ac43c6..833c6f71 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,8 +3,9 @@ version: "3" services: dbgate: - build: docker + # build: docker # image: dbgate/dbgate:beta-alpine + image: dbgate/dbgate:alpine # image: dbgate/dbgate:beta restart: always ports: @@ -15,8 +16,8 @@ services: volumes: - dbgate-data:/root/dbgate-data - environment: - WEB_ROOT: /dbgate + # environment: + # WEB_ROOT: /dbgate # CONNECTIONS: mssql # LABEL_mssql: MS Sql @@ -25,11 +26,11 @@ services: # PORT_mssql: 1433 # PASSWORD_mssql: Pwd2020Db # ENGINE_mssql: mssql@dbgate-plugin-mssql - proxy: - # image: nginx - build: test/nginx - ports: - - 8082:80 + # proxy: + # # image: nginx + # build: test/nginx + # ports: + # - 8082:80 # volumes: # - /home/jena/test/chinook:/mnt/sqt diff --git a/package.json b/package.json index 695c5f2e..e0a6a40c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "ts:api": "yarn workspace dbgate-api ts", "ts:web": "yarn workspace dbgate-web ts", "ts": "yarn ts:api && yarn ts:web", - "postinstall": "yarn resetPackagedPlugins && yarn build:lib && patch-package && yarn fillNativeModules && yarn build:plugins:frontend" + "postinstall": "yarn resetPackagedPlugins && yarn build:lib && patch-package && yarn fillNativeModules && yarn build:plugins:frontend", + "dbgate-serve": "node packages/dbgate/bin/dbgate-serve.js" }, "dependencies": { "concurrently": "^5.1.0", diff --git a/packages/api/src/controllers/runners.js b/packages/api/src/controllers/runners.js index be8445c6..0430dfab 100644 --- a/packages/api/src/controllers/runners.js +++ b/packages/api/src/controllers/runners.js @@ -111,7 +111,7 @@ module.exports = { stdio: ['ignore', 'pipe', 'pipe', 'ipc'], env: { ...process.env, - DBGATE_API: global['API_PACKAGE'] || global['dbgateApiModulePath'] || process.argv[1], + DBGATE_API: global['API_PACKAGE'] || process.argv[1], ..._.fromPairs(pluginNames.map(name => [`PLUGIN_${_.camelCase(name)}`, getPluginBackendPath(name)])), }, } diff --git a/packages/api/src/index.js b/packages/api/src/index.js index 21ce5f68..b93feeb9 100644 --- a/packages/api/src/index.js +++ b/packages/api/src/index.js @@ -8,7 +8,7 @@ if (processArgs.startProcess) { const proc = require('./proc'); const module = proc[processArgs.startProcess]; module.start(); -} else if (!processArgs.checkParent && !global['API_PACKAGE'] && !global['dbgateApiModulePath']) { +} else if (!processArgs.checkParent && !global['API_PACKAGE']) { const main = require('./main'); main.start(); diff --git a/packages/api/src/utility/directories.js b/packages/api/src/utility/directories.js index 35b5c887..ff942648 100644 --- a/packages/api/src/utility/directories.js +++ b/packages/api/src/utility/directories.js @@ -54,7 +54,7 @@ function packagedPluginsDir() { } if (platformInfo.isNpmDist) { // node_modules - return global['dbgateApiPackagedPluginsPath']; + return global['PLUGINS_DIR']; } if (platformInfo.isElectronBundle) { return path.resolve(__dirname, '../../plugins'); diff --git a/packages/api/src/utility/platformInfo.js b/packages/api/src/utility/platformInfo.js index b5d59052..77143ef1 100644 --- a/packages/api/src/utility/platformInfo.js +++ b/packages/api/src/utility/platformInfo.js @@ -10,7 +10,7 @@ const isMac = platform === 'darwin'; const isLinux = platform === 'linux'; const isDocker = fs.existsSync('/home/dbgate-docker/public'); const isDevMode = process.env.DEVMODE == '1'; -const isNpmDist = !!global['dbgateApiModulePath']; +const isNpmDist = !!global['IS_NPM_DIST']; const isForkedApi = processArgs.isForkedApi; // function moduleAvailable(name) { diff --git a/packages/dbgate/bin/dbgate-serve.js b/packages/dbgate/bin/dbgate-serve.js index 4231b81b..a20d52ff 100755 --- a/packages/dbgate/bin/dbgate-serve.js +++ b/packages/dbgate/bin/dbgate-serve.js @@ -3,8 +3,9 @@ const path = require('path'); require('dotenv').config(); -global.dbgateApiModulePath = path.dirname(path.dirname(require.resolve('dbgate-api'))); -global.dbgateApiPackagedPluginsPath = path.dirname(global.dbgateApiModulePath); +global.API_PACKAGE = path.dirname(path.dirname(require.resolve('dbgate-api'))); +global.PLUGINS_DIR = path.dirname(global.API_PACKAGE); +global.IS_NPM_DIST = true; const dbgateApi = require('dbgate-api');