From 1b92f05701448ae40bf7aa78ec4780be66015c0e Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Thu, 31 Oct 2024 18:10:23 +0700 Subject: [PATCH 1/2] fix(dashmate): invalid mount path from helper --- packages/dashmate/docker-compose.yml | 3 ++- packages/dashmate/docker/entrypoint.sh | 2 +- packages/dashmate/scripts/helper.js | 1 + packages/dashmate/src/createDIContainer.js | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/dashmate/docker-compose.yml b/packages/dashmate/docker-compose.yml index 67aae0bfa94..fb4cb02b0f3 100644 --- a/packages/dashmate/docker-compose.yml +++ b/packages/dashmate/docker-compose.yml @@ -17,13 +17,14 @@ services: environment: - LOCAL_UID=${LOCAL_UID:?err} - LOCAL_GID=${LOCAL_GID:?err} + - DASHMATE_HOME_DIR=${DASHMATE_HOME_DIR:?err} ports: - 127.0.0.1:${DASHMATE_HELPER_API_PORT:?err}:${DASHMATE_HELPER_API_PORT:?err} command: yarn workspace dashmate helper ${CONFIG_NAME:?err} expose: - ${DASHMATE_HELPER_API_PORT:?err} volumes: - - ${DASHMATE_HOME_DIR:?err}:/home/dashmate/.dashmate + - ${DASHMATE_HOME_DIR:?err}:${DASHMATE_HOME_DIR:?err} - /var/run/docker.sock:/var/run/docker.sock core: diff --git a/packages/dashmate/docker/entrypoint.sh b/packages/dashmate/docker/entrypoint.sh index 773f337a2fa..b0faa7c48f5 100755 --- a/packages/dashmate/docker/entrypoint.sh +++ b/packages/dashmate/docker/entrypoint.sh @@ -31,4 +31,4 @@ fi echo "Starting with UID: $USER_ID, GID: $GROUP_ID, USER: $USERNAME, GROUP: $GROUP" -exec su - $USERNAME -c "cd /platform;DASHMATE_HELPER=1 DASHMATE_HOME_DIR=/home/dashmate/.dashmate $*" +exec su $USERNAME -c "cd /platform;DASHMATE_HOME_DIR=$DASHMATE_HOME_DIR $*" diff --git a/packages/dashmate/scripts/helper.js b/packages/dashmate/scripts/helper.js index 6cd9feb9f61..a11a2e1da0f 100644 --- a/packages/dashmate/scripts/helper.js +++ b/packages/dashmate/scripts/helper.js @@ -45,6 +45,7 @@ import createDIContainer from '../src/createDIContainer.js'; // Register config collection in the container container.register({ configFile: asValue(configFile), + isHelper: asValue(true), }); const provider = config.get('platform.gateway.ssl.provider'); diff --git a/packages/dashmate/src/createDIContainer.js b/packages/dashmate/src/createDIContainer.js index 9f3b8616235..c748fcf25a7 100644 --- a/packages/dashmate/src/createDIContainer.js +++ b/packages/dashmate/src/createDIContainer.js @@ -162,7 +162,7 @@ export default async function createDIContainer(options = {}) { createConfigFile: asFunction(createConfigFileFactory).singleton(), getConfigFileMigrations: asFunction(getConfigFileMigrationsFactory).singleton(), migrateConfigFile: asFunction(migrateConfigFileFactory).singleton(), - isHelper: asValue(process.env.DASHMATE_HELPER === '1'), + isHelper: asValue(false), getConnectionHost: asFunction(getConnectionHostFactory).singleton(), generateEnvs: asFunction(generateEnvsFactory).singleton(), getConfigProfiles: asFunction(getConfigProfilesFactory).singleton(), From 8917557990c5821c360bed90b9de82028273bb8a Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Thu, 31 Oct 2024 22:33:05 +0700 Subject: [PATCH 2/2] revert: DASHMATE_HELPER=1 --- packages/dashmate/docker/entrypoint.sh | 2 +- packages/dashmate/scripts/helper.js | 1 - packages/dashmate/src/createDIContainer.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/dashmate/docker/entrypoint.sh b/packages/dashmate/docker/entrypoint.sh index b0faa7c48f5..852dcb40952 100755 --- a/packages/dashmate/docker/entrypoint.sh +++ b/packages/dashmate/docker/entrypoint.sh @@ -31,4 +31,4 @@ fi echo "Starting with UID: $USER_ID, GID: $GROUP_ID, USER: $USERNAME, GROUP: $GROUP" -exec su $USERNAME -c "cd /platform;DASHMATE_HOME_DIR=$DASHMATE_HOME_DIR $*" +exec su $USERNAME -c "cd /platform;DASHMATE_HELPER=1 DASHMATE_HOME_DIR=$DASHMATE_HOME_DIR $*" diff --git a/packages/dashmate/scripts/helper.js b/packages/dashmate/scripts/helper.js index a11a2e1da0f..6cd9feb9f61 100644 --- a/packages/dashmate/scripts/helper.js +++ b/packages/dashmate/scripts/helper.js @@ -45,7 +45,6 @@ import createDIContainer from '../src/createDIContainer.js'; // Register config collection in the container container.register({ configFile: asValue(configFile), - isHelper: asValue(true), }); const provider = config.get('platform.gateway.ssl.provider'); diff --git a/packages/dashmate/src/createDIContainer.js b/packages/dashmate/src/createDIContainer.js index c748fcf25a7..9f3b8616235 100644 --- a/packages/dashmate/src/createDIContainer.js +++ b/packages/dashmate/src/createDIContainer.js @@ -162,7 +162,7 @@ export default async function createDIContainer(options = {}) { createConfigFile: asFunction(createConfigFileFactory).singleton(), getConfigFileMigrations: asFunction(getConfigFileMigrationsFactory).singleton(), migrateConfigFile: asFunction(migrateConfigFileFactory).singleton(), - isHelper: asValue(false), + isHelper: asValue(process.env.DASHMATE_HELPER === '1'), getConnectionHost: asFunction(getConnectionHostFactory).singleton(), generateEnvs: asFunction(generateEnvsFactory).singleton(), getConfigProfiles: asFunction(getConfigProfilesFactory).singleton(),