Production best practices
1.Every environment
1.1Password configuration
Zato provides three built-in user accounts. Administrators sign in to the Dashboard as admin, connect to the container over SSH as zato, and deploy code from an IDE as ide_publisher.
| Account | Used to | Environment variable |
|---|---|---|
admin | Sign in to the Dashboard | Zato_Dashboard_Password |
zato | Connect to the container over SSH | Zato_SSH_Password |
ide_publisher | Deploy code from an IDE through IDE integration | Zato_IDE_Password |
Zato reads the password of each account from its environment variable when the container starts. If the variable is not set, Zato generates a random password for the account at every start, and the password changes with each restart.
Before you start a production container, set each of the three variables to its own password, taken from the secrets store of your organization. Do not use Zato_Password in production - it assigns one password to all three accounts and is intended for development environments.
docker run \
-e Zato_Dashboard_Password="$ZATO_DASHBOARD_PASSWORD" \
-e Zato_SSH_Password="$ZATO_SSH_PASSWORD" \
-e Zato_IDE_Password="$ZATO_IDE_PASSWORD" \
zatosource/zato-4.1@sha256:<digest>
To change a password later, set the new value in the variable and restart the container, as described in changing passwords.
1.2Dashboard access
The Dashboard gives full control over the environment, so make it reachable from your internal network only. Publish the Dashboard port on an address of the internal network, and administrators connect to it from the office or through a VPN.
A Dashboard session lasts two hours by default. To change it, set Zato_Dashboard_Session_Timeout to the number of seconds a session lasts.
1.3Development settings
Leave the following variables unset in production. They are meant for development environments.
| Variable | What it does |
|---|---|
Zato_Log_Env_Details | Writes the passwords of the admin, zato and ide_publisher accounts to files inside the container and to server.log |
Zato_Password | Assigns one password to all three accounts, instead of the separate passwords |
Zato_Skip_SSL_Verify | Stops Zato from verifying the certificates of the systems that it connects to |
Zato_Dashboard_Debug | Shows error details, including parts of the Dashboard configuration, in the browser of anyone who causes an error |
If you start the production environment from a Compose file or a script copied from a development environment, remove these variables from it.
1.4Image digest and automatic updates
Zato fetches the latest Zato code each time the container starts, so two starts of the same image can run different code. In production, run the code that you tested - refer to the image by its digest instead of latest, and set Zato_Install_Updates to False. With this setting, Zato also stops the automatic updates scheduled in the Dashboard.
docker images --digests zatosource/zato-4.1 shows the digest of each image that you pulled. To move to a new version, test the new image and then change the digest, as described in updating environments.
1.5Log rotation
Zato rotates server.log and http_access.log when a file reaches 1 GB, and keeps two rotated copies of each. To change it, set Zato_Server_Log_Max_Size to the size in bytes and Zato_Server_Log_Backup_Count to the number of copies, and restart the container.
Docker keeps the container output in a file of its own, which has no size limit by default. Limit it with the --log-opt options of docker run:
1.6Environment name
2.SSL
2.1Configure SSL
Configure SSL/TLS for every environment that API clients or administrators reach over a network, as described in SSL/TLS configuration.
Use a certificate issued by the certificate authority of your organization instead of the self-signed certificate that Zato generates, as described in use your own SSL certificate.
2.2Published ports
Each Zato interface has a plain-text port and a TLS port. Docker makes a port reachable from outside the host only if you publish it with the -p option of docker run.
| Interface | Used by | Plain-text port | TLS port |
|---|---|---|---|
| Dashboard | Administrators | 8183 | 8184 |
| API | API clients | 11223 | 11224 |
| OpenAPI console | API consumers who read the API documentation | 8185 | 8186 |
| HL7 MLLP | Clinical systems | 11553 | 11554 |
Publish only the TLS ports of the interfaces you use. Do not publish the plain-text ports, and do not publish port 22, which is used for SSH.
3.Behind a proxy or load balancer
3.1Forwarded headers
If a reverse proxy or a load balancer in front of Zato sets X-Forwarded-For, set Zato_Trust_Forwarded_Headers to True. Zato then takes the address of the caller from that header, so IP filtering, rate limits and the access log use the address of the caller instead of the address of the proxy.
Leave the variable unset when callers connect to Zato directly. Otherwise, a caller can send X-Forwarded-For itself and choose the address that IP filtering and rate limits apply to. The details are in client IP resolution.
3.2Dashboard trusted origins
If administrators open the Dashboard through a proxy, set Zato_Dashboard_CSRF_Trusted_Origins to the address that they open in the browser, with the scheme and with the port if it is not the default one, for instance https://dashboard.example.com. Separate several addresses with commas. Otherwise, Dashboard forms fail with the error "CSRF verification failed". The details are in set CSRF trusted origins for the Dashboard.
4.Monitoring and log collection
4.1Metrics endpoint authentication
The /metrics endpoint requires HTTP Basic Auth with the user metrics. Set Zato_Metrics_Password to a password from the secrets store of your organization, and give the same password to the system that collects the metrics. Without the variable, Zato generates a new password at each start, and the collector stops receiving metrics after a restart.
docker run \
-e Zato_Metrics_Password="$ZATO_METRICS_PASSWORD" \
zatosource/zato-4.1@sha256:<digest>
The details are in monitoring.
4.2Log aggregation
Zato writes the server log to the container output as well as to server.log. The container empties its logs directory at each start, so send the container output to your log platform through a Docker logging driver:
docker run \
--log-driver=fluentd \
--log-opt fluentd-address=logs.example.com:24224 \
zatosource/zato-4.1@sha256:<digest>
The details are in logging.
4.3Reading the server log with a log agent
A log agent, such as the Datadog Agent, can read the container output, which carries the server log. Each entry in the server log begins with a date, so configure the agent to start a new record at each date - otherwise, every line of a traceback becomes a record of its own.
With Datadog, set DD_LOGS_ENABLED=true on the Datadog Agent and label the Zato container:
docker run \
-l com.datadoghq.ad.logs='[{"source": "zato", "service": "zato", "log_processing_rules": [{"type": "multi_line", "name": "new_entry", "pattern": "\\d{4}-\\d{2}-\\d{2}"}]}]' \
zatosource/zato-4.1@sha256:<digest>
The metrics side of Datadog is in Datadog.
See also
| Page | What it covers |
|---|---|
| Security defaults | Generated passwords, inactive channels and the audit log |
| Environment variables | Every variable on this page, with its default |
| Updating environments | Replacing a container with a newer image |