change PORT env variable to BACKEND_PORT to prevent mix-ups with native PORT env from nginx in Docker

This commit is contained in:
einhornimmond 2025-10-28 10:03:53 +01:00
parent b09dd70e81
commit 9c85b7829f
13 changed files with 69 additions and 16 deletions

View File

@ -1,5 +1,5 @@
# Server
PORT=4000
BACKEND_PORT=4000
JWT_SECRET=secret123
JWT_EXPIRES_IN=10m
GRAPHIQL=false

View File

@ -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

View File

@ -1,5 +1,6 @@
# Server
JWT_EXPIRES_IN=2m
BACKEND_PORT=4000
GDT_ACTIVE=false
HUMHUB_ACTIVE=false

View File

@ -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}

View File

@ -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',

View File

@ -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)

View File

@ -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))

View File

@ -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

View File

@ -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

View File

@ -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, {

View File

@ -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<string, number>((input: string) => Number(input)),

View File

@ -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 ##############################################
########################################################

View File

@ -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