Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domain not working after server restart or Traefik reload #1345

Open
mgyugcha opened this issue Feb 22, 2025 · 3 comments · May be fixed by #1371
Open

Domain not working after server restart or Traefik reload #1345

mgyugcha opened this issue Feb 22, 2025 · 3 comments · May be fixed by #1371
Labels
bug Something isn't working

Comments

@mgyugcha
Copy link

To Reproduce

I have tested with the Ghost and Umami templates, when deployed for the first time everything works fine

Image

When the server is restarted or when Traefik is reloaded the domain stops working.

Image

Current vs. Expected behavior

Domain does not redirect to container

When the server is restarted or Traefik is reloaded, the domains should work automatically without having to deploy each application

Provide environment information

OS: Ubuntu 24.04
Dokploy version: 0.18.4
VPS Provider: DigitalOcean

Which area(s) are affected? (Select all that apply)

Traefik

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

I have an older version of the Umami template that does not have this problem. I was able to identify that this version had the following piece of code

networks:
  - dokploy-network

Which was removed in #1276. I could see that in this version the umami service did not create a network for compose, but rather only the dokploy-network was used. When restarting the server or reloading Traefik the domain worked perfectly.

In the latest version I can see that a network is created (in my case utilidades-umami-58e1ef) in which after deploying 3 containers are tied: traefik, umami and db. This is when everything works fine.

[
    {
        "Name": "utilidades-umami-58e1ef",
        "Id": "f1f536a792a70346164215d03db07fd85630a83b0424a6817b01b3974d898261",
        "Created": "2025-02-22T00:06:59.08590962-05:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv4": true,
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "5a5dce4605e4c3b574e79ada5a917737daa55660c4be51f92bd99254d0f9443e": {
                "Name": "dokploy-traefik.1.orsjt8hv4jb191cg8ariugmik",
                "EndpointID": "d6cb4e30fa66ad82ef968cd5138d29af395f1b95cda7fb0cc7aa8293bdda0b8d",
                "MacAddress": "86:9d:c9:50:8f:5d",
                "IPv4Address": "172.18.0.4/16",
                "IPv6Address": ""
            },
            "81cdf8360e58af6c0690222d6c3014885b4b5a864e68aafc8463e1ed643aa88d": {
                "Name": "utilidades-umami-58e1ef-umami-1",
                "EndpointID": "0123f07a50d975d65e933e2abce026b11f41796732e9755a3d9e881bddc13f93",
                "MacAddress": "62:fa:65:31:ab:65",
                "IPv4Address": "172.18.0.3/16",
                "IPv6Address": ""
            },
            "8c7327163ef9bd7d521d1c200962ccbc17603cfd6c82c49ec9463730f1e1e590": {
                "Name": "utilidades-umami-58e1ef-db-1",
                "EndpointID": "eab4a8211ec014d3c891ba2927be114b0af1a91a87d1042ba6731a90caa30d6e",
                "MacAddress": "52:75:fb:5c:a1:64",
                "IPv4Address": "172.18.0.2/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

But when restarting the server or reloading traefik only umami and db are tied.

[
    {
        "Name": "utilidades-umami-58e1ef",
        "Id": "f1f536a792a70346164215d03db07fd85630a83b0424a6817b01b3974d898261",
        "Created": "2025-02-22T00:06:59.08590962-05:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv4": true,
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "81cdf8360e58af6c0690222d6c3014885b4b5a864e68aafc8463e1ed643aa88d": {
                "Name": "utilidades-umami-58e1ef-umami-1",
                "EndpointID": "0123f07a50d975d65e933e2abce026b11f41796732e9755a3d9e881bddc13f93",
                "MacAddress": "62:fa:65:31:ab:65",
                "IPv4Address": "172.18.0.3/16",
                "IPv6Address": ""
            },
            "8c7327163ef9bd7d521d1c200962ccbc17603cfd6c82c49ec9463730f1e1e590": {
                "Name": "utilidades-umami-58e1ef-db-1",
                "EndpointID": "eab4a8211ec014d3c891ba2927be114b0af1a91a87d1042ba6731a90caa30d6e",
                "MacAddress": "52:75:fb:5c:a1:64",
                "IPv4Address": "172.18.0.2/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

After deploying, the 3 containers are tied together again and it works again.

How can I solve this problem? Taking into account that I have several Compose in my Dokploy, and I would not like to have to deploy one by one every time there is an OS update and I have to restart the server

Thank you very much for your help. I love Dokploy 😄

Will you send a PR to fix it?

Maybe, need help

@mgyugcha mgyugcha added the bug Something isn't working label Feb 22, 2025
@Siumauricio
Copy link
Contributor

Thanks for the detail, I can already guess what is happening, we currently run this command, we look for the current container that is called dokploy-traefik and join it to the network, but when it is restarted as regular docker containers do not keep the same reference to docker swarm service level, so when it is restarted I assume that reference is lost that we did in the command, I guess I would have to change the command to update the service and not use the regular containers, I had not really contemplated this case! thank you very much.

if (compose.isolatedDeployment) {
await execAsync(
`docker network connect ${compose.appName} $(docker ps --filter "name=dokploy-traefik" -q) >/dev/null 2>&1`,
).catch(() => {});
}

@Siumauricio
Copy link
Contributor

It seems that using docker service update will not be the best solution and we are likely to have a breaking change or downtime, because adding a docker network to a docker swarm service will cause downtime because it will force a restart of the traefik container which is not a good idea because every time we deploy a template we will have this problem, another solution, which to some extent is a breaking change, is to basically replace a docker swarm service of dokloy-traefik with a regular docker container, and that would work in any case whether it's a reboot or whatever.

@shreeshailaya
Copy link

shreeshailaya commented Feb 25, 2025

When this will going to fix or any alternative way to fix this?

Can I pull this branch? (https://github.com/Dokploy/dokploy/tree/1345-domain-not-working-after-server-restart-or-traefik-reload)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants