Skip to content

Configuration

rbnboe edited this page Oct 15, 2026 · 1 revision

Configuration

Configuration comes from environment files loaded at startup and from a singleton database settings record that can be changed at runtime.

Environment files

Use the examples in the repository: backend/.env.example, backend/.env.db.example, and frontend/.env.example. Keep real credentials out of version control.

Variables Purpose
POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB, POSTGRES_HOST, POSTGRES_PORT Database credentials and network settings. Keep backend and database environment files aligned.
DATABASE_URL, ALEMBIC_DATABASE_URL Full SQLAlchemy connection URLs. Compose env_file values do not expand other variables, so enter complete literal URLs.
OPC_UA_URL, OPC_UA_USER, OPC_UA_PASSWORD PLC endpoint and credentials.
RABBITMQ_URL AMQP connection URL.
RABBITMQ_STORAGE_INBOUND_QUEUE Separate inbound stock queue. Leave empty to disable the consumer; do not set it to the outbound storage queue.
STORAGE_STALE_AFTER_SECONDS Age after which legacy database stock is marked stale (default 3600).
OPC_UA_CONTRACT_VERIFIED Whether confirmed product result codes can be interpreted. Default false.
OPC_UA_PRODUCT_RESULTS JSON mapping of confirmed PLC result codes. Default {}.
ORDER_POLL_INTERVAL_S, ORDER_REFRESH_INTERVAL_S, ORDER_STALE_AFTER_S PLC polling and order refresh/freshness intervals.
ORDER_START_TIMEOUT_S, ORDER_COMPLETION_TIMEOUT_S, ORDER_RESET_TIMEOUT_S, ORDER_REST_BUFFER_S Handshake deadlines and rest buffer.
ORDER_PLANT_TIMEZONE Time zone used for proposed order date/time (default Europe/Berlin).
PRODUCT_CATALOG_REFRESH_INTERVAL_S PLC catalog synchronization interval in seconds (default 30).
PRODUCT_CATALOG_STALE_AFTER_S Maximum catalog age for new order admission in seconds (default 300).
MES_BACKEND_URL Next.js order API proxy target.
BACKEND_INTERNAL_URL Next.js settings, inventory, and analytics proxy target; use http://backend:8000 in production Compose.

Runtime settings

GET/PUT /settings/ accesses the database settings singleton. It stores the PLC order node names, child node names, product queue pattern, storage node names, and polling interval. Defaults are in the settings service and sample config; check the current API schema before overriding them. Browse names can be customized, while the PLC node structure and field layout are fixed by the integration implementation.

Changing an active order's target PLC node is rejected with 409. Other settings may be updated while orders are active, subject to the field-specific validation in the API.

Release image selection

Set MES_IMAGE_TAG alongside docker-compose.prod.yml to choose the same version for the backend and frontend, for example v0.2.1. See Deployment.

Clone this wiki locally