Dokploy on Your Own Server. Part 4: Dokploy lessons from a real project

All parts of the series “Dokploy on Your Own Server”

Names and paths in the examples below are illustrative.

In part three, we deployed one container. Applications vary, though, and can be considerably more complex than Hello World: several services, a database, a message queue, and a cache may all become part of the system. More components also bring more deployment questions.

The following details come from setting up one of my pet projects on Dokploy 0.31.4. We will start with an option for separating supporting infrastructure from the application, then look at networking, configuration, and updates.

Separate the supporting stack from the application

One option is to create two Compose services in Dokploy. The first describes the supporting stack, such as PostgreSQL, RabbitMQ, and Redis. The second contains the application and its background workers. This separates configuration and lifecycles; both sets of containers can still run on the same server.

An application release then updates its own images and settings. Database, queue, and cache upgrades happen separately, at an appropriate time. This helps when the application changes frequently while supporting components need their own versions, persistent data, and maintenance procedures. Data directories and backups still require explicit configuration: a second Compose project does not protect them by itself.

Connectivity between the stacks needs deliberate configuration. For example, both can join a shared external Docker network and use service names to reach dependencies. Database, queue, and cache ports do not need host publication for this communication. A shared network allows connected containers to reach one another; stricter boundaries require separating networks and access by consumer.

Independent lifecycles also mean accounting for startup order and dependency readiness. One Compose project's depends_on does not manage services in another. The application needs connection retries, a meaningful readiness check, and defined behavior when a database or queue is temporarily unavailable. A single Compose file may be more convenient for a small example; splitting it is useful when different update cycles help operations.

Matching names do not create a shared network

Problem. An application in one Compose project needs postgres and rabbitmq from another, and Traefik must reach public-facing services. Separate default project networks do not provide that connectivity.

Cause. Service names resolve within Docker networks. Traefik's Docker provider discovers containers through the Docker API, but discovery does not establish a network path to a backend.

Solution. Both Compose projects use external apps-network. Traefik joins it as well as the panel's dokploy-network. Public services explicitly set traefik.docker.network=apps-network. Enable Isolated Deployment is off, and Detach dokploy-network prevents the platform from automatically adding that network to application containers.

Check. Inspect the containers' actual networks, name resolution, and port reachability from the application network. For the proxy, check both the Docker provider configuration and Traefik's network attachment. Do not fix a network timeout by randomly changing labels.

IPv6 also affects proxy trust

Problem. Migrated trusted-proxy settings cannot simply retain the previous Docker network's range, particularly when incoming IPv6 must preserve the client's address.

Cause. The application only accepts forwarded headers from trusted intermediaries. An incorrect network list affects HTTPS detection, redirect URLs, and client IP interpretation.

Solution. Compose must use the shared network's actual ranges; an illustrative example is IPv4 172.30.0.0/16 and IPv6 ULA fd00:42::/64. A separate script creates the network with fixed subnets. The VPS's public IPv6 address is not assigned to every container.

Check. Test externally over both IPv4 and IPv6, inspect intermediate addresses, and check the scheme and client IP observed by the application. Do not trust every source just to remove the symptom. The addresses shown here are illustrative; determine the actual ranges on your own server.

Environment: interpolation first, container configuration second

Problem. A setting exists in the panel, but the application continues using the value embedded in its image.

Cause. Compose Environment supplies .env values for interpolation. Only values mapped through environment or env_file reach containers. The application's own configuration precedence then applies.

Solution. The project explicitly lists container settings in environment. Environment variables override embedded appsettings.json; values already matching the image are not duplicated unnecessarily. No separate appsettings files are mounted over the containers.

Check. Verify the specific setting through a safe diagnostic signal. docker compose config --quiet validates configuration without printing substituted secrets. Do not casually send the output of regular docker compose config with production Environment to a log or conversation.

Registry credentials and application secrets operate at different levels

Problem. Private Git access works, but Docker cannot pull an image, or a registry token is placed in application Environment.

Cause. Git retrieves Compose while Docker retrieves the image in a separate request. Authorization does not transfer between them.

Solution. The project configures private registry credentials through Registry UI. Application secrets belong in Environment; Git contains variable names. In this series' demo, CI publishes with GITHUB_TOKEN, while the server pulls with a separate read:packages PAT.

Check. Verify authenticated pulls and anonymous denial. Starting an image already present locally does not prove the credentials still work. Account for token expiry and its rotation procedure.

Encrypted Git files need a decryption stage

Problem. We initially wanted encrypted settings alongside Compose, decrypted immediately before startup.

Cause. That requires a defined stage between retrieving Git and invoking Compose, plus access to a decryption key. No suitable built-in hook was found for the tested Dokploy 0.31.4 workflow.

Solution. The teaching lab supplies secrets through Environment. We did not add external orchestration or application-side decryption just to preserve the original idea. This does not claim every Dokploy version lacks external secret providers; it describes the verified Git/Compose workflow.

The project's release API key solves a different problem and lives in a SOPS-encrypted file in the application repository. The runner decrypts it before calling Dokploy, using the existing KMS/age mechanism. This does not decrypt Environment on the Dokploy server.

Check. Separately verify that Git contains no plaintext secrets and that CI can run. An encrypted file alone does not explain who can decrypt it, where, or when.

Separate application releases from infrastructure deployments

Problem. A new website release should not recreate PostgreSQL, RabbitMQ, and the infrastructure stack.

Cause. The configuration repository contains independent Compose projects. An overly broad trigger couples their lifecycles.

Solution. The project uses ./apps/docker-compose.yml with Watch Paths apps/**; infrastructure lives in stack/. Once all six images are published, the release workflow updates TAG_ID only on the application Compose service and invokes its API deployment. Configuration push deployments for apps/** remain enabled and use the current Environment tag.

Check. Verify the chosen service ID, its history, and all component image tags. The lab in part three disables Auto Deploy for simplicity; the project deliberately has two initiators. Concurrent manual and automatic operations still require coordination.

An accepted API request is not a completed release

Problem. A successful POST is insufficient, and the deployment title can become a Git commit message.

Cause. The request queues work. Dokploy 0.31.4 replaces completed Git deployment titles, making title-only tracking unreliable. A small API limit can interrupt polling.

Solution. The project's technical user can access the API and the required Compose service, but not the infrastructure stack. Its key allows 120 requests per minute. The script preserves Environment except TAG_ID, snapshots deployment IDs, and tracks the specific new ID. It polls every five seconds, with a 20-minute deadline.

Check. The project was verified by deploying an already published release: container tags, API/Identity/BFF readiness, and the SSR response. Script tests cover overwritten titles, ambiguous records, errors, and timeouts. Never blindly repeat a POST after a network failure: the operation may already be running. A timeout rolls back neither the selected version nor containers.

A health-check command must exist inside the image

Problem. Readiness needs checking after startup, but a tool such as curl may not exist in a minimal runtime image.

Cause. Docker executes health checks inside containers. Installing curl on the VPS does not put it inside an image. For .NET components, readiness may also depend on migrations and connections.

Solution. The current project Compose configuration restores explicit health checks. .NET services use the Bash available in their images and an HTTP request through /dev/tcp to /health/ready; SSR uses its own available tool. Startup grace periods allow ordinary .NET services up to 300 seconds. This is not a mandatory delay for every successful startup: an early successful probe can mark a container healthy.

Check. Verify the executable exists in the exact image, inspect container health, and test the external route. Docker health is not automatic recovery: restart: unless-stopped alone does not restart a container simply because it is unhealthy. Readiness and zero-downtime update strategy are separate concerns too. This section describes the current Compose source; I did not separately validate its latest change on production while preparing this article.

Container replacement exposes data and ownership assumptions

Problem. After migration, the application must retain its keys and files, while its non-root process needs write permission.

Cause. Bind mounts refer to the server running Compose. Relative paths and directories on the article author's computer do not become VPS directories. The panel does not automatically correct old UID/GID ownership.

Solution. The project's persistent directories live under /apps/pet-project, with application data permissions prepared for UID/GID 1654. Data Protection keys live outside replaceable containers. Kubernetes keys are not imported automatically; without migrating old keys, users need to sign in again.

Check. Test writes as the actual container user and check persistence after replacement. Docker cleanup and directory removal are not harmless parts of redeployment. A complete backup strategy is beyond this article.

Different Traefik operations preserve different state

Problem. Additional networks and proxy settings must survive actions performed in the panel.

Cause. Host configuration files, attached networks, and manual container modifications are different forms of state.

Solution. For Dokploy 0.31.4, a normal Traefik recreation through Modify Environment → Update was tested separately: apps-network remained attached and the panel kept responding. This does not imply arbitrary manual mounts or docker run options are restored. The project's extra metrics and tracing settings are applied by a script that merges them with Dokploy's configuration.

Check. Test both panel and application after changes. If UI operations rewrite the panel router, reapply observability exclusions for administrative traffic. Monitoring helps verify proxy behavior here; a green dashboard alone does not prove release success.

The useful way to document this platform is through verifiable boundaries: who retrieves Git, who pulls the image, which container changes, where a request goes, and what survives replacement. A failure then belongs to a specific stage rather than a vague “Dokploy does not work.”

Sources

Only registered users can leave a comment.

Sign in or register to leave a comment.