Server e database
Il server web, la connessione MySQL, l’account admin, e cosa esegue ogni processo (AF_ROLE e le variabili RTE_*)
Modificale quando l’applicazione gira dietro un reverse proxy, su un’altra porta, o con un database esterno al progetto compose.
Esempio
Dietro un reverse proxy che termina il TLS, sotto /ansibleforms, con un MySQL esterno. In docker-compose.yml:
environment:
- BASE_URL=/ansibleforms # the proxy forwards /ansibleforms/ unchanged
- HTTPS=0 # the proxy terminates TLS
- PORT=8000
- DB_HOST=mysql.example.com
- DB_PORT=3306
- DB_USER=ansibleforms
- DB_PASSWORD=change-me
Queste sostituiscono le righe DB_* e PORT che il file compose ha già lì, e che vincono sugli stessi nomi in .env. Rimuovi il servizio mysqldb e il depends_on che lo attende, e mappa la porta 8000 in ports. Il lato del proxy è descritto nella pagina Reverse proxy.
Variabili
Ogni variabile di questo gruppo, con il suo tipo, il valore predefinito e la descrizione:
| Variabile | Scelte/Valori predefiniti | Commenti |
|---|---|---|
| NODE_ENV string | Predefinito: production | The Node.js environment
Nodejs can have multiple environments, like development or production |
| DB_HOST string / required | Database host
AnsibleForms requires a MySQL database connection to store the configuration of the application. | |
| DB_PORT number / required added in version 6.3.0 | Database port
Port of the MySQL or MariaDB server, usually 3306. It has no default: the server refuses to start when DB_PORT, DB_HOST, DB_USER or DB_PASSWORD is not set, and changing it needs a restart. | |
| DB_USER string / required | Database user
AnsibleForms requires a MySQL database connection to store the configuration of the application. Give it a user of its own with rights on its schema only - not root: That is all the application needs: it creates and patches its schema, makes its backups, and ends a dead worker’s session (its own sessions, which needs no further right). A user with rights on every database turns any hole in the application into a hole in the whole database server ; the Status page and the log say so when the user has them. | |
| DB_PASSWORD string / required Segreto | Database password
AnsibleForms requires a MySQL database connection to store the configuration of the application. | |
| DB_POOL_SIZE number | Predefinito: 20 | Database connection pool size
Maximum number of concurrent MySQL connections kept in the pool. All database queries share this pool instead of opening a new connection per query, which dramatically reduces connection overhead and improves throughput under load. Increase this if you have many concurrent users or long-running cron-driven jobs; decrease it if your MySQL server has a low |
| PORT number | Predefinito: 8000 | HTTP port
The listening port of the web application |
| BASE_URL string | Predefinito: / | URL subpath to host the application under
Host the whole application (GUI, REST API and Swagger interface) under a URL subpath, typically behind a reverse proxy. For example with |
| TRUST_PROXY string added in version 7.0.0 | Predefinito: 0 | Trusted reverse proxies
Behind a reverse proxy (nginx, traefik, a kubernetes ingress, a load balancer) every connection comes from the proxy, so without this setting the audit trail records the proxy’s address for every action. Set it to tell the application which proxies it may believe when they report the real client address in the
Security: |
| DEFAULT_LANGUAGE string | Predefinito: en | Default language
Sets the language for the application, for users who have not picked their own with the language switcher. The chosen language is persisted in a cookie. Both frontend UI and backend error messages are translated. |
| HTTPS number | Scelte:
| Enable HTTPS
Our docker-compose comes with sample certificates. It is highly recommended to enable HTTPS. |
| HTTPS_KEY string | Predefinito: %PERSISTENT_FOLDER%/certificates/key.pem | HTTPS private key
The path to the private key of the server certificate, in BASE64/PEM format. |
| HTTPS_CERT string | Predefinito: %PERSISTENT_FOLDER%/certificates/cert.pem | HTTPS certificate
The path to the server certificate, in BASE64/PEM format. |
| ADMIN_USERNAME string added in version 5.0.8 | Predefinito: admin | Admin username
The admin username is the first user that can login to the application. |
| ADMIN_PASSWORD string Segreto added in version 5.0.8 | Predefinito: AnsibleForms!123 | Admin password
The admin password is the password for first user that can login to the application. |
| AF_ROLE string added in version 7.0.0 | Predefinito: all | What this process runs
|
| RTE_MODE string added in version 7.3.0 | Predefinito: database | How a runner talks to the controller
Read by a runner (
A dial that fails is logged at warning with its cause and a hint: a name that does not resolve, nothing listening, a certificate not trusted or not for that name, a proxy, or the controller refusing the socket (401 the token, 404 the
In both socket modes the runner holds no database credentials: the controller sends it each job and stores what comes back - the output, the events, the end - exactly once, and sends the end notifications. The job’s files come with it unless
|
| CONTROLLER_URL string added in version 7.8.0 | The controller's address a runner dials
On a runner in On a runner in The certificate is checked: name a private CA with | |
| CONTROLLER_TLS_VERIFY number added in version 7.8.0 | Predefinito: 1 | Whether a runner checks the controller's certificate
On a runner that dials the controller ( |
| APP_URL string added in version 7.3.0 | The controller's address a runner dials (deprecated)
Deprecated: use | |
| APP_TLS_VERIFY number added in version 7.3.0 | Predefinito: 1 | Whether a runner checks the controller's certificate (deprecated)
Deprecated: use |
| RTE_JOIN_TOKEN string Segreto added in version 7.3.0 | The token a runner joins the controller with, once
On a runner in a socket mode, the first time, optional. Without it a runner the controller does not know asks to join and waits for an admin’s approval under Connections > Runners. With it the runner is approved at once - for unattended installs - and the controller adds it under Connections > Runners (or gives a runner of that name still waiting for approval the new token ; an approved runner keeps its token, which only an admin changes). Join tokens are made through the API ( | |
| RTE_NAME string added in version 7.3.0 | The name a runner joins as
On a runner in a socket mode: its name under Connections > Runners, which forms name with | |
| RTE_FILES string added in version 7.3.0 | Predefinito: transfer | Where a socket-mode runner gets a job's files
On a runner in a socket mode. |
| RTE_FILES_MAX_MB number added in version 7.3.0 | Predefinito: 512 | The largest folder the controller sends a runner
Read by the controller: a playbooks or inventory folder bigger than this is not sent to a runner with |
| RTE_SPOOL_PATH string added in version 7.3.0 | Predefinito: %PERSISTENT_FOLDER%/rte-spool | Where a socket-mode runner keeps what the controller has not stored yet
On a runner in a socket mode: each job’s output, events and end wait here until the controller acks them, and are sent again after a reconnect - to the same controller node or another. On a volume, a runner that restarts sends what it had not delivered. |
| RTE_CACHE_PATH string added in version 7.3.0 | Predefinito: %PERSISTENT_FOLDER%/rte-files | Where a socket-mode runner keeps the job files the controller sent
On a runner with |
| RTE_CACHE_MB number added in version 7.3.0 | Predefinito: 1024 | The size of a socket-mode runner's job files cache
On a runner with |
| RTE_TOKEN string Segreto added in version 7.0.0 | The token between a controller and its runner
On a runner ( | |
| RTE_REGISTER number added in version 7.0.0 | Predefinito: 1 | A database-mode runner registers itself (deprecated)
Deprecated since 7.3.0, removed in 8.0.0 with database mode. Read only by a runner in database mode (no On a database-mode runner: 1 (the default) and the runner adds itself under Connections > Runners when it starts, and checks every 30 seconds that it is still there. The first runner becomes the default runner. Its address is A runner that registered itself shows as automatic on the Runners page, and as unresponsive once the runner stopped writing its heartbeat ; the worker removes it 10 minutes later. A recreated container registers again under its new address and takes the default from the one that stopped. A runner added by hand at the same address stays yours (its token follows 0: the runner does not register itself ; add it under Connections > Runners or in the seed. |
| RTE_MAX_JOBS number added in version 7.0.0 | Predefinito: 10 | How many playbooks a runner runs at once
Read by a runner ( |
| RTE_DRAIN_SECONDS number added in version 7.0.0 | Predefinito: 25 | How long a stopping runner waits for its running playbooks
Read by a runner. On a stop (SIGTERM: a rolling update, a scale down) it takes no new job and waits this long for the running playbooks to end ; those still running then end as abandoned. Keep it below what the platform waits before it kills the container: Kubernetes’ terminationGracePeriodSeconds (30 by default), docker stop’s –time (10). On a socket-mode runner it can be set on its runner page ; a value there wins over this one. |
| RTE_QUEUE_MINUTES number added in version 7.0.0 | Predefinito: 60 | Wait for a busy or disconnected runner (minutes)
A job handed to a runner that is full (RTE_MAX_JOBS) or stopping waits for it, asking again every 10 seconds, for this many minutes ; then it fails and says why. An abort ends the wait at once. It also covers the running jobs of a socket-mode runner (outbound, inbound) whose connection dropped: their playbooks run on and the runner keeps their output, so they stay running for this many minutes and go on when it reconnects, or end as abandoned after that (or at once when the runner comes back without them). 0 waits for ever. |
| LISTEN_HOST string added in version 7.3.0 | The address a runner listens on
On a runner ( | |
| RTE_URL string added in version 7.0.0 | The address the controller reaches a runner on
On a runner in On a deprecated database-mode runner that registers itself ( An inbound runner ( | |
| ALLOW_SCHEMA_CREATION number added in version 5.0.3 | Scelte:
| Allow schema creation
With 1, the worker creates the schema (all AnsibleForms tables) itself at startup when it finds an empty database. It only does so on a database without a single AnsibleForms table, so an existing installation is never recreated. Controller nodes wait until the worker has created and patched the schema before they serve. With 0, nothing creates the schema: the worker skips it at startup, the schema endpoint refuses to create it, and controller nodes start without waiting for it. Set 0 to rule out any schema creation, for example on a production database. The docker-compose MySQL only creates the empty |
| REINIT_ADMIN number added in version 6.0.0 | Scelte:
| Reset the local admin user/password at startup
Recovery hatch when you’ve lost access to the local
The action is logged loudly. This is NOT a runtime auth bypass — once the admin is back in shape, unset |
| API_BODY_LIMIT_MB number added in version 6.0.0 | Predefinito: 50 | Request body size limit (MB)
Cap on the size of JSON and urlencoded request bodies accepted by the AnsibleForms API. Default is 50 MB, generous enough for large form designs and heavy job extravars. Increase if you have unusually large forms or expression payloads. Note: this does NOT apply to file uploads (those are governed by |
| MAX_HTTP_HEADER_SIZE number added in version 7.1.0 | Predefinito: 16384 | Request header size limit (bytes)
The largest request header the server accepts, in bytes. Node.js refuses a request whose headers are larger with 431 Request Header Fields Too Large, before it reaches the application, so nothing of it is in the log. Unset, Node’s own limit applies: 16384 bytes (16 KB), or the value of |
| UPLOAD_MAX_GB number added in version 6.0.0 | Predefinito: 10 | Upload size limit (GB)
Cap on the size of a single file uploaded through the form upload field, in gigabytes. Default is 10 GB to accommodate large artifacts (e.g. firmware images, upgrade bundles). Set to |
| PROCESS_MAX_BUFFER number added in version 5.0.8 | Predefinito: 50 * 1024 * 1024 | The playbook output a runner stores per stream
Read by a runner ( |