[Request] Support Docker Environments File
Can you please add support for using a Docker environments file as this would make doing upgrades a lot easier after there have been changes to the Docker Compose file.
This is just an example of something you could do:
Example: .env
# ---------- Database Configuration ----------
DB_HOST=db
DB_PORT=5432
DB_USER=patchmon_user
DB_PASSWORD=secure_password_123
DB_NAME=patchmon_db
# ---------- Application Secrets ----------
SECRET_KEY=supersecretkey123!
ACCESS_TOKEN_EXPIRE_MINUTES=60
REFRESH_TOKEN_SECRET=anothersecretvalue
# ---------- API and Server Settings ----------
API_PORT=8080
CORS_ORIGIN=https://myfrontend.example.com
# ---------- Docker Volume Paths ----------
LOGS_VOLUME_PATH=/var/log/patchmon
DATA_VOLUME_PATH=/var/lib/patchmon/data
BACKUPS_VOLUME_PATH=/var/lib/patchmon/backups
POSTGRES_DATA_VOLUME=pgdata
POSTGRES_DATA_PATH=/var/lib/postgresql/data
# ---------- Miscellaneous ----------
ENVIRONMENT=production
DEBUG=falseExample: docker-compose.yml
services:
patchmon:
build:
context: ..
dockerfile: Dockerfile
env_file:
- ./patchmon.env
ports:
- "${API_PORT}:8080"
volumes:
- "${LOGS_VOLUME_PATH}:/app/logs"
- "${DATA_VOLUME_PATH}:/app/data"
- "${BACKUPS_VOLUME_PATH}:/app/backups"
environment:
- CORS_ORIGIN=${CORS_ORIGIN}
- ENVIRONMENT=${ENVIRONMENT}
depends_on:
- db
db:
image: postgres:15
env_file:
- ./patchmon.env
volumes:
- ${POSTGRES_DATA_VOLUME}:${POSTGRES_DATA_PATH}
environment:
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_NAME}
ports:
- "${DB_PORT}:5432"
volumes:
${POSTGRES_DATA_VOLUME}:4 Comments
If I may suggest the following example:
Have a "static" docker-compose.yaml and combine it with a .env (copy example.env to .env).
This looks more similar to things like https://docs.immich.app/install/docker-compose/.
example: example.env
# PatchMon Configuration
# Define passwords and URLs.
# Generate passwords with 'openssl rand -hex 64'
#
# Passwords:
# 1. The database password in the environment variable POSTGRES_PASSWORD
# 2. The redis password in the command redis-server --requirepass your-redis-password-here
# 3. The jwt secret in the environment variable JWT_SECRET
#
# URL areas:
# 1. Setup your CORS_ORIGIN to what url you will use for accessing PatchMon frontend url
# 2. Setup your SERVER_PROTOCOL, SERVER_HOST and SERVER_PORT to what you will use for linux agents to access PatchMon
#
# This is generally the same as your CORS_ORIGIN url, in some cases it might be different - SERVER_* variables are used in the scripts for Server connection.
# You can also change this in the front-end but in the case of docker-compose - it is overwritten by the variables set here.
# Passwords and Secrets
POSTGRES_PASSWORD= # REQUIRED: Set a strong database password here
REDIS_PASSWORD= # REQUIRED: Set a strong Redis password here
JWT_SECRET= # REQUIRED: Set a strong JWT secret here
# Database Configuration
POSTGRES_DB=patchmon_db
POSTGRES_USER=patchmon_user
# Server Configuration - Used by Linux agents to connect to PatchMon
SERVER_PROTOCOL=http
SERVER_HOST=localhost
SERVER_PORT=3000
# CORS Configuration - Should match your frontend URL
CORS_ORIGIN=http://localhost:3000
# Logging
LOG_LEVEL=info
# Database Connection Pool Configuration (Prisma)
DB_CONNECTION_LIMIT=30
DB_POOL_TIMEOUT=20
DB_CONNECT_TIMEOUT=10
DB_IDLE_TIMEOUT=300
DB_MAX_LIFETIME=1800
# Rate Limiting (times in milliseconds)
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX=5000
AUTH_RATE_LIMIT_WINDOW_MS=600000
AUTH_RATE_LIMIT_MAX=500
AGENT_RATE_LIMIT_WINDOW_MS=60000
AGENT_RATE_LIMIT_MAX=1000
# Redis Connection
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_DB=0example: docker-compose.yaml
# Set Passwords and URL areas in the .env file.
# (see also: example.env)
# Generate passwords with 'openssl rand -hex 64'
#
# Passwords:
# 1. The database password in the environment variable POSTGRES_PASSWORD
# 2. The redis password in the command redis-server --requirepass your-redis-password-here
# 3. The jwt secret in the environment variable JWT_SECRET
#
# URL areas:
# 1. Setup your CORS_ORIGIN to what url you will use for accessing PatchMon frontend url
# 2. Setup your SERVER_PROTOCOL, SERVER_HOST and SERVER_PORT to what you will use for linux agents to access PatchMon
#
# This is generally the same as your CORS_ORIGIN url, in some cases it might be different - SERVER_* variables are used in the scripts for Server connection.
# You can also change this in the front-end but in the case of docker-compose - it is overwritten by the variables set here.
name: patchmon
services:
database:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- patchmon-internal
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 3s
timeout: 5s
retries: 7
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --requirepass ${REDIS_PASSWORD}
volumes:
- redis_data:/data
networks:
- patchmon-internal
healthcheck:
test: ["CMD", "redis-cli", "--no-auth-warning", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 3s
timeout: 5s
retries: 7
backend:
image: ghcr.io/patchmon/patchmon-backend:latest
restart: unless-stopped
# See PatchMon Docker README for additional environment variables and configuration instructions
environment:
LOG_LEVEL: ${LOG_LEVEL}
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database:5432/${POSTGRES_DB}
JWT_SECRET: ${JWT_SECRET}
SERVER_PROTOCOL: ${SERVER_PROTOCOL}
SERVER_HOST: ${SERVER_HOST}
SERVER_PORT: ${SERVER_PORT}
CORS_ORIGIN: ${CORS_ORIGIN}
# Database Connection Pool Configuration (Prisma)
DB_CONNECTION_LIMIT: ${DB_CONNECTION_LIMIT}
DB_POOL_TIMEOUT: ${DB_POOL_TIMEOUT}
DB_CONNECT_TIMEOUT: ${DB_CONNECT_TIMEOUT}
DB_IDLE_TIMEOUT: ${DB_IDLE_TIMEOUT}
DB_MAX_LIFETIME: ${DB_MAX_LIFETIME}
# Rate Limiting (times in milliseconds)
RATE_LIMIT_WINDOW_MS: ${RATE_LIMIT_WINDOW_MS}
RATE_LIMIT_MAX: ${RATE_LIMIT_MAX}
AUTH_RATE_LIMIT_WINDOW_MS: ${AUTH_RATE_LIMIT_WINDOW_MS}
AUTH_RATE_LIMIT_MAX: ${AUTH_RATE_LIMIT_MAX}
AGENT_RATE_LIMIT_WINDOW_MS: ${AGENT_RATE_LIMIT_WINDOW_MS}
AGENT_RATE_LIMIT_MAXYou can use env_file: patchmon_env.yaml in the compose file or use a .env file and store all environment variables as required by pitchman in the file. No need to map them all in the compose file.
services:
frontend:
image: ghcr.io/patchmon/patchmon-frontend:1.3.6
env_file: patchmon_env.yaml
deploy:
mode: replicated
Thank you for this. I agree.
I will look into it as we do anticipate changes to the environment in the future as well so your suggestion makes sense.
iby___

This has noe been implemented within the recommended way of installing 1.4.x