diff --git a/backend/.env.dist b/backend/.env.dist index 8d5ba317c..0860b9c94 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -1,5 +1,5 @@ # Server -PORT=4000 +BACKEND_PORT=4000 JWT_SECRET=secret123 JWT_EXPIRES_IN=10m GRAPHIQL=false diff --git a/backend/.env.template b/backend/.env.template index 9b0bc7df2..5212d1e1b 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -1,11 +1,11 @@ # must match the CONFIG_VERSION.EXPECTED definition in scr/config/index.ts -CONFIG_VERSION=$BACKEND_CONFIG_VERSION # Server JWT_SECRET=$JWT_SECRET JWT_EXPIRES_IN=$JWT_EXPIRES_IN GRAPHIQL=false GDT_API_URL=$GDT_API_URL +BACKEND_PORT=$BACKEND_PORT # Database DB_HOST=127.0.0.1 diff --git a/backend/.env.test_e2e b/backend/.env.test_e2e index e7f3a29c8..1a6c3a214 100644 --- a/backend/.env.test_e2e +++ b/backend/.env.test_e2e @@ -1,5 +1,6 @@ # Server JWT_EXPIRES_IN=2m +BACKEND_PORT=4000 GDT_ACTIVE=false HUMHUB_ACTIVE=false diff --git a/backend/Dockerfile b/backend/Dockerfile index eeab1ac17..f015350c0 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -17,7 +17,7 @@ ENV BUILD_COMMIT="0000000" ## SET NODE_ENV ENV NODE_ENV=production ## App relevant Envs -ENV PORT="4000" +ENV BACKEND_PORT="4000" ## Timezone ENV TZ=UTC ENV DB_HOST=mariadb @@ -42,7 +42,7 @@ LABEL maintainer="support@gradido.net" # Settings ## Expose Container Port -EXPOSE ${PORT} +EXPOSE ${BACKEND_PORT} ## Workdir RUN mkdir -p ${DOCKER_WORKDIR} diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index b583156b5..f29f0b0f7 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -16,7 +16,7 @@ const logging = { } const server = { - PORT: process.env.PORT ?? 4000, + BACKEND_PORT: process.env.BACKEND_PORT ?? 4000, JWT_SECRET: process.env.JWT_SECRET ?? 'secret123', JWT_EXPIRES_IN: process.env.JWT_EXPIRES_IN ?? '10m', REDEEM_JWT_TOKEN_EXPIRATION: process.env.REDEEM_JWT_TOKEN_EXPIRATION ?? '10m', diff --git a/backend/src/config/schema.ts b/backend/src/config/schema.ts index f4e6033ea..4b13b4e64 100644 --- a/backend/src/config/schema.ts +++ b/backend/src/config/schema.ts @@ -260,7 +260,7 @@ export const schema = Joi.object({ }) .description('JWT key for HumHub integration, must be the same as configured in humhub'), - PORT: Joi.number() + BACKEND_PORT: Joi.number() .integer() .min(1024) .max(49151) diff --git a/backend/src/index.ts b/backend/src/index.ts index 283554a9d..db4bf76b5 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -12,12 +12,12 @@ async function main() { const { app } = await createServer(getLogger('apollo')) await writeJwtKeyPairInHomeCommunity() - app.listen(CONFIG.PORT, () => { + app.listen(CONFIG.BACKEND_PORT, () => { // biome-ignore lint/suspicious/noConsole: no need for logging the start message - console.log(`Server is running at http://localhost:${CONFIG.PORT}`) + console.log(`Server is running at http://localhost:${CONFIG.BACKEND_PORT}`) if (CONFIG.GRAPHIQL) { // biome-ignore lint/suspicious/noConsole: no need for logging the start message - console.log(`GraphIQL available at http://localhost:${CONFIG.PORT}`) + console.log(`GraphIQL available at http://localhost:${CONFIG.BACKEND_PORT}`) } }) await startValidateCommunities(Number(CONFIG.FEDERATION_VALIDATE_COMMUNITY_TIMER)) diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 059822ea4..a0e449ac2 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -12,7 +12,7 @@ EMAIL_PASSWORD=1234 EMAIL_SMTP_HOST=smtp.lustig.de EMAIL_SMTP_PORT=587 -PORT=4000 +BACKEND_PORT=4000 # if set to true allow sending gradidos to another communities FEDERATION_XCOM_SENDCOINS_ENABLED=false @@ -24,6 +24,14 @@ EMAIL_CODE_VALID_TIME=1440 # also used for password reset code EMAIL_CODE_REQUEST_TIME=10 +# Need to adjust by updates +# config versions +DATABASE_CONFIG_VERSION=v1.2022-03-18 +BACKEND_CONFIG_VERSION=v23.2024-04-04 +FRONTEND_CONFIG_VERSION=v6.2024-02-27 +ADMIN_CONFIG_VERSION=v2.2024-01-04 +FEDERATION_CONFIG_VERSION=v2.2023-08-24 +FEDERATION_DHT_CONFIG_VERSION=v4.2024-01-17 FEDERATION_DHT_TOPIC=GRADIDO_HUB # Need adjustments for test system diff --git a/dlt-connector/.env.template b/dlt-connector/.env.template index 963d0169b..92819f579 100644 --- a/dlt-connector/.env.template +++ b/dlt-connector/.env.template @@ -21,5 +21,5 @@ GRADIDO_BLOCKCHAIN_CRYPTO_APP_SECRET=$GRADIDO_BLOCKCHAIN_CRYPTO_APP_SECRET GRADIDO_BLOCKCHAIN_SERVER_CRYPTO_KEY=$GRADIDO_BLOCKCHAIN_SERVER_CRYPTO_KEY # Route to Backend -PORT=$PORT +BACKEND_PORT=$BACKEND_PORT JWT_SECRET=$JWT_SECRET \ No newline at end of file diff --git a/dlt-connector/src/client/backend/BackendClient.ts b/dlt-connector/src/client/backend/BackendClient.ts index 7f779fd73..ce9660e36 100644 --- a/dlt-connector/src/client/backend/BackendClient.ts +++ b/dlt-connector/src/client/backend/BackendClient.ts @@ -30,7 +30,7 @@ export class BackendClient { */ private constructor() { this.logger = getLogger(`${LOG4JS_BASE_CATEGORY}.client.BackendClient`) - this.urlValue = `http://localhost:${CONFIG.PORT}` + this.urlValue = `http://localhost:${CONFIG.BACKEND_PORT}` this.logger.addContext('url', this.urlValue) this.client = new GraphQLClient(this.urlValue, { diff --git a/dlt-connector/src/config/schema.ts b/dlt-connector/src/config/schema.ts index 645f07470..9490e8a00 100644 --- a/dlt-connector/src/config/schema.ts +++ b/dlt-connector/src/config/schema.ts @@ -90,7 +90,7 @@ export const configSchema = v.object({ v.string('The home folder for the gradido dlt node server'), path.join(__dirname, '..', '..', 'gradido_node'), ), - PORT: v.optional( + BACKEND_PORT: v.optional( v.pipe( v.string('A valid port on which the backend server is running'), v.transform((input: string) => Number(input)), diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 3d68512ce..3898f9991 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -43,6 +43,26 @@ services: # bind the local folder to the docker to allow live reload - .:/app + ######################################################## + # INSPECTOR ############################################ + ######################################################## + inspector: + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: gradido/inspector:local-development + build: + target: development + networks: + - external-net + - internal-net + environment: + - NODE_ENV=development + volumes: + # This makes sure the docker container has its own node modules. + # Therefore it is possible to have a different node version on the host machine + - node_modules_inspector:/app/node_modules + # bind the local folder to the docker to allow live reload + - .:/app + ######################################################## # BACKEND ############################################## ######################################################## diff --git a/docker-compose.yml b/docker-compose.yml index aeaac0c60..d2d88cc9c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -61,6 +61,30 @@ services: volumes: - ./logs/nginx/admin:/var/log/nginx + ######################################################## + # INSPECTOR ########################################### + ######################################################## + inspector: + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: gradido/inspector:local-production + build: + context: ./inspector + dockerfile: Dockerfile + target: production + networks: + - internal-net + ports: + - ${INSPECTOR_MODULE_PORT:-3100}:3100 + environment: + - NODE_ENV=production + - BUILD_COMMIT=${BUILD_COMMIT} + - BUILD_COMMIT_SHORT=${BUILD_COMMIT_SHORT} + - BUILD_VERSION=${BUILD_VERSION} + # - DEBUG=true + volumes: + - ./logs/nginx/inspector:/var/log/nginx + + ######################################################### ## MARIADB ############################################## ######################################################### @@ -97,7 +121,7 @@ services: environment: # Envs used in Dockerfile # - DOCKER_WORKDIR="/app" - # - PORT=4000 + - BACKEND_PORT=4000 - BUILD_DATE - BUILD_VERSION - BUILD_COMMIT @@ -132,7 +156,6 @@ services: environment: # Envs used in Dockerfile # - DOCKER_WORKDIR="/app" - # - PORT=5000 - BUILD_DATE - BUILD_VERSION - BUILD_COMMIT @@ -167,7 +190,8 @@ services: environment: # Envs used in Dockerfile # - DOCKER_WORKDIR="/app" - - PORT=6010 + - DLT_CONNECTOR_PORT=6010 + - BACKEND_PORT=4000 - BUILD_DATE - BUILD_VERSION - BUILD_COMMIT