docs: add troubleshooting guide for Bad Gateway errors and Docker Compose utilities

This commit is contained in:
Mauricio Siu 2025-02-23 18:36:28 -06:00
parent 99009280a0
commit 3cabc78bce
4 changed files with 110 additions and 3 deletions

View File

@ -0,0 +1,63 @@
---
title: Utilities
description: "Utilities for your Docker Compose application"
---
Dokploy provides a set of utilities to enhance your Docker Compose application deployment experience.
## Isolated Deployments
All open source templates come with this feature enabled by default.
This feature allows you to deploy your application in a separate network, isolated from other applications. This isolation is particularly useful when you need to deploy multiple instances of the same application.
For example, if you want to deploy two WordPress instances, you would typically encounter service naming conflicts since they share the same network (dokploy-network). Docker doesn't allow services with identical names in the same network. Consider this typical WordPress service:
```yaml
services:
wordpress:
image: wordpress:latest
ports:
- "80"
```
<ImageZoom
src="/assets/images/compose-isolate.png"
alt="Isolated Deployments"
width={1000}
height={600}
/>
When Isolated Deployments is enabled, Dokploy will:
1. Add a prefix to all your defined volumes and networks
2. Create a network based on your service's appName and associate it with each service in your compose file
3. Connect the Traefik load balancer to this isolated network, maintaining service isolation while ensuring proper routing
When using this feature, you don't need to explicitly define dokploy-network in your networks section, as isolation is handled automatically.
## Randomize Compose
Dokploy offers functionality to randomize various compose properties:
1. Volumes
2. Networks
3. Services
4. Configs
5. Secrets
You can specify a custom prefix that will be used as a suffix for each compose property.
Note: If both Isolated Deployments and Randomize Compose are enabled, the Isolated Deployments configuration takes precedence.

View File

@ -54,3 +54,6 @@ Proper domain configuration is crucial for the accessibility and security of you
### Important Clarification on Container Ports
The "Container Port" specified in the domain settings is exclusively for routing traffic to the correct application container through Traefik, and does not expose the port directly to the internet. This is fundamentally different from the port settings in the "Advanced -> Ports" section, which are used to directly expose application ports. The container port in the domain settings ensures that Traefik can internally direct traffic to the specified port within the container based on the domain configuration.

View File

@ -10,13 +10,13 @@ You see the deployment succeeded, and logs are running, but the domain isn't wor
1. **Correct Port Mapping**: Ensure the domain is using the correct port for your application. For example, if you're using Next.js, the port should be `3000`, or for Laravel, it should be `8000`. If you change the app port, update the domain to reflect that.
2. **Avoid Using `Ports` in Advanced Settings**: Generally, there's no need to use the `Ports` feature unless you want to access your app via `IP:port`. Leaving this feature enabled may interfere with your domain.
3. **Let's Encrypt Certificates**: It's crucial to point the domain to your servers IP **before** adding it in Dokploy. If the domain is added first, the certificate wont be generated, and you may need to recreate the domain or restart Traefik.
3. **Let's Encrypt Certificates**: It's crucial to point the domain to your server's IP **before** adding it in Dokploy. If the domain is added first, the certificate won't be generated, and you may need to recreate the domain or restart Traefik.
4. **Listen on 0.0.0.0, Not 127.0.0.1**: If your app is bound to `127.0.0.1` (which is common in Vite apps), switch it to `0.0.0.0` to allow external access.
## Logs and Monitoring Not Working After Changing Application Placement?
This is expected behavior. If the application is running on a different node (worker), the UI wont have access to logs or monitoring, as they're not on the same node.
This is expected behavior. If the application is running on a different node (worker), the UI won't have access to logs or monitoring, as they're not on the same node.
## Mounts Are Causing My Application Not to Run?
@ -60,7 +60,7 @@ There are a few potential reasons for this:
## Docker Compose Domain Not Working?
When adding a domain in your Docker Compose file, its not necessary to expose the ports directly. Simply specify the port where your app is running. Exposing the ports can lead to conflicts with other applications or ports.
When adding a domain in your Docker Compose file, it's not necessary to expose the ports directly. Simply specify the port where your app is running. Exposing the ports can lead to conflicts with other applications or ports.
Example of what not to do:
@ -114,3 +114,44 @@ domain: my-app.com
serviceName: app
port: 3000
```
## Getting "Bad Gateway Error" When Accessing Your Application Domain
If you're encountering a Bad Gateway Error when accessing your application through its domain, this typically indicates one of several common configuration issues:
### Common Causes
1. **Port Mismatch**: The configured port might be incorrect
2. **Listen Address Configuration**: The service might be listening only on `127.0.0.1` instead of `0.0.0.0`
### Common Solution for Modern JavaScript Frameworks
This issue frequently occurs with modern JavaScript frameworks like Vite, Astro, or Vue.js applications. By default, these frameworks often listen only on localhost (`127.0.0.1`).
To resolve this, you need to configure your application to listen on all available network interfaces (`0.0.0.0`).
#### Example Configuration for Vite
Here's how to properly configure a Vite application:
```ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
preview: {
port: 3000,
host: true, // This enables listening on all network interfaces
},
server: { // Also add this for development server
host: true, // This enables listening on all network interfaces
port: 3000
}
});
```
### Framework-Specific Notes
- **Vite Apps**: Use the configuration above
- **Astro**: Similar configuration in `astro.config.mjs`
- **Vue.js**: Configure in `vite.config.js` if using Vite
- **Other Frameworks**: Check your framework's documentation for network interface configuration
Remember to deploy again your application after making these changes for them to take effect.

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB