Backend
WARNING
Manual editing is usually not required; you typically only need to fill in the main variables because there is a file that generates .env files for services.
| Variable | Default | Purpose |
|---|---|---|
PU_FF_TELEGRAM_BOT_ENABLE | True | Feature flag that controls whether the Telegram Bot is enabled |
PU_FF_GRAFANA_INTEGRATION_ENABLE | True | Feature flag that controls whether integration with Grafana is enabled |
PU_FF_DATAPIPE_DEFAULT_LAST_VALUE_ENABLE | True | Feature flag that controls whether DataPipe of type LastValue is created by default for each UnitNode |
PU_FF_DATAPIPE_ENABLE | True | Feature flag that controls whether DataPipe capabilities are enabled. When disabled, you should also stop the DataPipe service, as it will no longer receive configuration updates, etc. |
PU_FF_PROMETHEUS_ENABLE | True | Feature flag that controls whether monitoring of requests via Prometheus is enabled |
PU_LOG_FORMAT | json | Log format. In json mode, each log record is a single dict. In plain mode, logs are standard text lines, but traceback is written line by line |
PU_MIN_LOG_LEVEL | INFO | Minimum log level output to the console. Logs below this level are not shown. Allowed values: DEBUG, INFO, WARNING, ERROR, CRITICAL |
PU_APP_PREFIX | /pepeunit | Standard prefix used to separate app paths from the domain; usually does not need changes. Useful for complex embedded setups |
PU_API_V1_PREFIX | /api/v1 | Prefix for REST API version. Allows supporting old REST API versions and multiple versions simultaneously |
PU_WORKER_COUNT | 2 | Number of Gunicorn workers; increases the load that the Backend can handle |
PU_DOMAIN | - | Domain name or IP. Affects links generated by the Backend and allows Unit to connect to the Backend. Propagated to Unit ENV as PU_DOMAIN |
PU_SECURE | True | If True, the Backend generates https links for PU_DOMAIN. Propagated to Unit ENV field PU_HTTP_TYPE as https/http |
PU_AUTH_TOKEN_EXPIRATION | 2678400 | Lifetime of user auth tokens, in seconds |
PU_SAVE_REPO_PATH | repo_cache | Path where the Backend stores external Git repositories, relative to the Backend root directory |
PU_SQLALCHEMY_DATABASE_URL | - | Connection URL for PostgreSQL |
PU_CLICKHOUSE_DATABASE_URL | - | Connection URL for ClickHouse |
PU_SECRET_KEY | - | 32‑byte key in base64 format. Used to sign auth tokens. If changed, all previously issued jwt tokens become invalid |
PU_ENCRYPT_KEY | - | 32‑byte key in base64 format. Used to encrypt all data. If changed, all previously encrypted records become impossible to decrypt |
PU_STATIC_SALT | - | 32‑byte key in base64 format. Used to generate password hash values for Users. If changed, all accounts created before the change will no longer be able to authenticate |
PU_MIN_INTERVAL_SYNC_REPOSITORY | 10 | Minimum time in seconds before the next repository update request to an external source |
PU_STATE_SEND_INTERVAL | 60 | Interval in seconds at which Units should send their state. Propagated to Unit ENV as STATE_SEND_INTERVAL |
PU_MAX_EXTERNAL_REPO_SIZE | 50 | Limit in MB for the size of external Git repositories that can be downloaded |
PU_MAX_CIPHER_LENGTH | 1000000 | Maximum length in characters for encrypted data |
PU_MIN_TOPIC_UPDATE_TIME | 30 | Update interval for messages in domain.com/+/pepeunit MQTT topics, in seconds |
PU_UNIT_LOG_EXPIRATION | 86400 | Lifetime in seconds of logs sent by Unit |
PU_MAX_PAGINATION_SIZE | 500 | Maximum number of objects that can be returned in a single request where pagination is used |
PU_TELEGRAM_BOT_MODE | webhook | Accepts webhook or pooling. Defines how the Backend communicates with the Telegram Bot. pooling works without a personal domain and https in environments with internet access. webhook is more performant and intended for https and a personal domain; the webhook URL is set automatically on startup |
PU_TELEGRAM_DEL_OLD_WEBHOOK | True | Whether to delete the existing webhook for the Telegram Bot before creating a new one |
PU_TELEGRAM_TOKEN | - | Telegram Bot token. Secret – do not share it |
PU_TELEGRAM_BOT_LINK | - | Link to the Telegram Bot managed by the Backend. Used to generate verification links for Users. Exposed in openapi.json |
PU_TELEGRAM_ITEMS_PER_PAGE | 7 | Number of items per page in the Telegram Bot UI |
PU_TELEGRAM_HEADER_ENTITY_LENGTH | 15 | Maximum length of entity names shown in the Telegram Bot |
PU_TELEGRAM_GIT_HASH_LENGTH | 8 | Maximum length of Git Commit hash shown in the Telegram Bot |
PU_PROMETHEUS_MULTIPROC_DIR | ./prometheus_metrics | Directory used by Prometheus to store metrics from multiple uvicorn workers. Cleared on application startup |
PU_REDIS_URL | redis://redis:6379/0 | Redis connection URL used by the Backend. The Redis instance must be the same as for MQTT_REDIS_AUTH_URL |
PU_MQTT_HOST | - | Domain name or IP used by the Backend to manage and subscribe to EMQX topics, and by Unit to connect to EMQX. Propagated to Unit ENV as PU_MQTT_HOST |
PU_MQTT_SECURE | True | If True, the Backend uses https to configure EMQX |
PU_MQTT_PORT | 1883 | Port used by Unit and Backend to connect to EMQX. Propagated to Unit ENV as PU_MQTT_PORT |
PU_MQTT_API_PORT | 18083 | EMQX API port used by the Backend to configure EMQX |
PU_MQTT_KEEPALIVE | 60 | Maximum period in seconds between ping messages from the Backend to EMQX |
PU_MQTT_USERNAME | - | EMQX username used by the Backend for initial broker setup |
PU_MQTT_PASSWORD | - | EMQX password used by the Backend for initial broker setup |
PU_MQTT_REDIS_AUTH_URL | redis://redis:6379/0 | Redis connection URL used by EMQX to connect to Redis. The Redis instance must be the same as REDIS_URL |
PU_MQTT_MAX_CLIENTS | 10000 | Maximum number of EMQX clients |
PU_MQTT_MAX_CLIENT_CONNECTION_RATE | 20/s | Maximum connection rate for EMQX clients |
PU_MQTT_MAX_CLIENT_ID_LEN | 512 | Maximum client ID length in EMQX |
PU_MQTT_CLIENT_MAX_MESSAGES_RATE | 30/s | Maximum message rate for a single EMQX client |
PU_MQTT_CLIENT_MAX_BYTES_RATE | 1MB/s | Maximum connection throughput for an EMQX client |
PU_MQTT_MAX_PAYLOAD_SIZE | 256 | Maximum payload size in KB for data sent through EMQX topics |
PU_MQTT_MAX_QOS | 2 | Maximum Quality of Service supported by EMQX |
PU_MQTT_MAX_TOPIC_LEVELS | 5 | Maximum topic depth in EMQX |
PU_MQTT_MAX_LEN_MESSAGE_QUEUE | 128 | Maximum queue length for EMQX messages |
PU_MQTT_MAX_TOPIC_ALIAS | 128 | Maximum number of topic aliases in EMQX |
PU_GITHUB_TOKEN_NAME | - | Name of a GitHub token with read‑only access to public repositories. Increases the rate limit for downloading public repositories from GitHub from 60 to 5000 per hour |
PU_GITHUB_TOKEN_PAT | - | GitHub token with read‑only access to public repositories; also increases the public repo download rate limit |
PU_GRAFANA_ADMIN_USER | - | Admin login for Grafana |
PU_GRAFANA_ADMIN_PASSWORD | - | Admin password for Grafana |
PU_GRAFANA_LIMIT_UNIT_NODE_PER_ONE_PANEL | 10 | Maximum number of UnitNode per single Visualization |
INFO
For testing the Backend there are also dedicated variables: