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 | Values | Purpose |
|---|---|---|---|
PU_FF_TELEGRAM_BOT_ENABLE | True | True / False | Feature flag that controls whether the Telegram Bot is enabled |
PU_FF_GRAFANA_INTEGRATION_ENABLE | True | True / False | Feature flag that controls whether integration with Grafana is enabled |
PU_FF_DATAPIPE_ENABLE | True | True / False | 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_DATAPIPE_DEFAULT_LAST_VALUE_ENABLE | True | True / False | Feature flag that controls whether DataPipe of type LastValue is created by default for each UnitNode |
PU_FF_PROMETHEUS_ENABLE | True | True / False | Feature flag that controls whether monitoring of requests via Prometheus is enabled |
PU_FF_FEDERATION_ENABLE | True | True / False | Feature flag that controls whether interaction with other Pepeunit instances is enabled: polling their state and exchanging known domains and public registries. When the flag is off, background jobs that collect data about external instances do not start |
PU_LOG_FORMAT | json | json / plain | 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 | DEBUG / INFO / WARNING / ERROR / CRITICAL | 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 | /..., ≤ 128 chars | 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 | /..., ≤ 128 chars | Prefix for REST API version. Allows supporting old REST API versions and multiple versions simultaneously |
PU_WORKER_COUNT | 2 | 2–128 | Number of Gunicorn workers; increases the load that the Backend can handle |
PU_DOMAIN | - | hostname, ≤ 128 chars | 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 | True / False | 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 | 600–11059200 | Lifetime of User auth tokens, in seconds |
PU_SAVE_REPO_PATH | repo_cache | ≤ 128 chars | Path where the Backend stores external Git repositories, relative to the Backend root directory |
PU_PROMETHEUS_MULTIPROC_DIR | ./prometheus_metrics | ≤ 128 chars | Directory used by Prometheus to store metrics from multiple uvicorn workers. Cleared on application startup |
PU_MIN_INTERVAL_SYNC_REPOSITORY | 10 | 1–1800 | Minimum time in seconds before the next repository update request to an external source |
PU_STATE_SEND_INTERVAL | 60 | 1–600 | Interval in seconds at which Units should send their state. Propagated to Unit ENV as STATE_SEND_INTERVAL |
PU_MAX_EXTERNAL_REPO_SIZE | 50 | 0–1024 | Limit in MB for the size of external Git repositories that can be downloaded |
PU_MAX_CIPHER_LENGTH | 1000000 | 0–1000000 chars | Maximum length in characters for encrypted data |
PU_HTTP_TIMEOUT | 30 | 0–120 | Timeout in seconds for outgoing HTTP requests from the Backend: to EMQX, Grafana, external Git repositories, and other Pepeunit instances |
PU_HTTP_CONNECT_TIMEOUT | 15 | 0–60 | Timeout in seconds for establishing a connection for outgoing HTTP requests, and for connections to Redis and ClickHouse |
PU_INSTANCE_MAX_STATE_SIZE | 4096 | 4096–65536 bytes | Maximum size of an external Pepeunit instance response in bytes. Larger responses are rejected when collecting state |
PU_INSTANCE_RETENTION_DAYS | 60 | 1–120 | Number of days without a successful poll after which a trusted external Pepeunit instance is deleted. A mandatory extra poll is performed before deletion |
PU_ADMIN_EMAIL | - | email or empty, ≤ 128 chars | Public email of the instance Administrator. Shown in the current instance contacts; can be empty |
PU_ADMIN_TG | - | ≤ 128 chars | Public Telegram contact of the instance Administrator. Shown in the current instance contacts; can be empty |
PU_UNIT_LOG_EXPIRATION | 86400 | 60–604800 | Lifetime in seconds of logs sent by Unit |
PU_MAX_PAGINATION_SIZE | 100 | 1–500 | Maximum number of objects that can be returned in a single request where pagination is used |
PU_SECRET_KEY | - | 16–128 chars | 32-byte key in base64 format. Used to sign auth tokens. If changed, all previously issued jwt tokens become invalid |
PU_ENCRYPT_KEY | - | base64 → 16 / 24 / 32 bytes, ≤ 128 chars | 32-byte key in base64 format. Used to encrypt all data. If changed, all previously encrypted records become impossible to decrypt |
PU_STATIC_SALT | - | not empty, ≤ 128 chars | 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_SQLALCHEMY_DATABASE_URL | - | postgresql / postgresql+psycopg2 / postgresql+asyncpg, ≤ 1024 chars | Connection URL for PostgreSQL |
PU_CLICKHOUSE_DATABASE_URL | - | URL with hostname, ≤ 1024 chars | Connection URL for ClickHouse |
PU_REDIS_URL | redis://redis:6379/0 | redis / rediss, ≤ 1024 chars | Redis connection URL used by the Backend. The Redis instance must be the same as for PU_MQTT_REDIS_AUTH_URL |
PU_TELEGRAM_BOT_MODE | webhook | webhook / pooling | 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 | True / False | Whether to delete the existing webhook for the Telegram Bot before creating a new one |
PU_TELEGRAM_TOKEN | - | 123456:ABC-def, ≤ 128 chars | Telegram Bot token. Secret – do not share it |
PU_TELEGRAM_BOT_LINK | - | http / https, ≤ 512 chars | 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 | 1–20 | Number of items per page in the Telegram Bot UI |
PU_TELEGRAM_HEADER_ENTITY_LENGTH | 15 | 1–64 chars | Maximum length of entity names shown in the Telegram Bot |
PU_TELEGRAM_GIT_HASH_LENGTH | 8 | 1–16 chars | Maximum length of Git Commit hash shown in the Telegram Bot |
PU_TELEGRAM_PROXY_URL | - | http / https / socks5 / socks5h or empty, ≤ 512 chars | When specified, allows the bot to proxy requests through the given server, for example socks5://user:password@1.1.1.1:1080. In combination with pooling, it helps bypass Telegram blocks |
PU_MQTT_HOST | - | hostname, ≤ 128 chars | 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 | True / False | If True, the Backend uses https to configure EMQX |
PU_MQTT_PORT | 1883 | 1–65535 | Port used by Unit and Backend to connect to EMQX. Propagated to Unit ENV as PU_MQTT_PORT |
PU_MQTT_API_PORT | 18083 | 1–65535 | EMQX API port used by the Backend to configure EMQX |
PU_MQTT_KEEPALIVE | 60 | 0–600 | Maximum period in seconds between ping messages from the Backend to EMQX |
PU_MQTT_USERNAME | - | not empty, ≤ 128 chars | EMQX username used by the Backend for initial broker setup |
PU_MQTT_PASSWORD | - | not empty, ≤ 128 chars | EMQX password used by the Backend for initial broker setup |
PU_MQTT_REDIS_AUTH_URL | redis://redis:6379/0 | redis / rediss, ≤ 512 chars | Redis connection URL used by EMQX to connect to Redis. The Redis instance must be the same as PU_REDIS_URL |
PU_MQTT_MAX_CLIENTS | 1024 | 1–1024 | Maximum number of EMQX clients |
PU_MQTT_MAX_CLIENT_CONNECTION_RATE | 20/s | 20 / 20/s / 20/m / 20/h, ≤ 64 chars | Maximum connection rate for EMQX clients |
PU_MQTT_MAX_CLIENT_ID_LEN | 512 | 1–1024 chars | Maximum client ID length in EMQX |
PU_MQTT_CLIENT_MAX_MESSAGES_RATE | 30/s | 20 / 20/s / 20/m / 20/h, ≤ 64 chars | Maximum message rate for a single EMQX client |
PU_MQTT_CLIENT_MAX_BYTES_RATE | 1MB/s | 1MB/s, KB / MB / GB / B, ≤ 64 chars | Maximum connection throughput for an EMQX client |
PU_MQTT_MAX_PAYLOAD_SIZE | 256 | 1–4096 KB | Maximum payload size in kilobytes for data sent through EMQX topics |
PU_MQTT_MAX_QOS | 2 | 0–2 | Maximum Quality of Service supported by EMQX |
PU_MQTT_MAX_TOPIC_LEVELS | 5 | 5–32 | Maximum topic depth in EMQX |
PU_MQTT_MAX_LEN_MESSAGE_QUEUE | 128 | 1–1024 | Maximum queue length for EMQX messages |
PU_MQTT_MAX_TOPIC_ALIAS | 128 | 0–256 | Maximum number of topic aliases in EMQX |
PU_GRAFANA_ADMIN_USER | - | not empty when FF is on, ≤ 128 chars | Admin login for Grafana |
PU_GRAFANA_ADMIN_PASSWORD | - | not empty when FF is on, ≤ 128 chars | Admin password for Grafana |
PU_GRAFANA_LIMIT_UNIT_NODE_PER_ONE_PANEL | 10 | 1–32 | Maximum number of UnitNode per single Visualization |
PU_GITHUB_TOKEN_NAME | - | together with PAT or both empty, ≤ 128 chars | 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 | - | together with NAME or both empty, ≤ 128 chars | 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 |
INFO
For testing the Backend there are also dedicated variables: