Dokploy / dokploy

Open Source Alternative to Vercel, Netlify and Heroku.
https://dokploy.com/
Other
7.35k stars 366 forks source link

An error occurred enable self hosted registry #143

Closed jaiiye closed 2 months ago

jaiiye commented 3 months ago

The following error occurs when I add a self hosted registry:

Command failed: echo dokploy | docker login xxx(my domain) --username dokploy --password-stdin Error response from daemon: Get "https://xxx/v2/": tls: failed to verify certificate: x509: certificate is valid for 1fb0b7b0fd9469e8f6e4f86f47d288ce.b1720affd94dc276efd0b354bf53e787.traefik.default, not xxx

It could be a problem here @/server/api/services/registry.ts::createRegistry

Siumauricio commented 3 months ago

please give steps to reproduce the issue, that looks related to traefik certificate

  1. How did you create the self hosted registry?
  2. Did you point the domain name of registry in your dns provider?

In the meantime can you try to reload the traefik?

jaiiye commented 3 months ago
  1. Install and login
  2. Set the server domain and configure Let’s Encrypt certificates to enable HTTPS. I used sslip.io,for example: 8-137-0-0.sslip.io
  3. Enable Self Hosted Registry, you need to enter the Username, Password and Registry URL, here Registry URL set to registry.8-137-0-0.sslip.io
Siumauricio commented 3 months ago

That is the reason, you are using a domain that does not belong to you, you cannot assign SSL certificates to those that are accesible only via HTTP domains.

You need to modify the registry file registry.yml from traefik file system and do the following

remove the middlewares, entrypoints and TLS, and restart traefik and it should work

jaiiye commented 3 months ago

That is the reason, you are using a domain that does not belong to you, you cannot assign SSL certificates to those that are accesible only via HTTP domains.

I don't think that's the problem. The @/server/api/services/registry.ts::createRegistry method has not yet created a docker registry, and of course has not applied for a certificate.

Siumauricio commented 3 months ago

Sorry, I don't understand much, you mean the docker registry is not being created, can you share the log of docker service ls?

jaiiye commented 3 months ago

Yes,the docker registry is not being created.The initializeRegistry method is the only way to start the docker registry,and now the createRegistry method tries to connect to the registry.

enableSelfHostedRegistry: adminProcedure
        .input(apiEnableSelfHostedRegistry)
        .mutation(async ({ input }) => {
            const selfHostedRegistry = await createRegistry({
                ...input,
                registryName: "Self Hosted Registry",
                registryType: "selfHosted",
                registryUrl:
                    process.env.NODE_ENV === "production"
                        ? input.registryUrl
                        : "dokploy-registry.docker.localhost",
                imagePrefix: null,
            });

            await manageRegistry(selfHostedRegistry);
            await initializeRegistry(input.username, input.password);

            return selfHostedRegistry;
        })

This is the docker service ls output:

root@jinsiyi:~# docker service ls
ID             NAME               MODE         REPLICAS   IMAGE                    PORTS
weydtswbt3m2   dokploy            replicated   1/1        dokploy/dokploy:latest
j7uk1vsp5evg   dokploy-postgres   replicated   1/1        postgres:16              *:30000->5432/tcp
qxg7qev0b6m7   dokploy-redis      replicated   1/1        redis:7                  *:30001->6379/tcp
z544zykeytt7   dokploy-traefik    replicated   1/1        traefik:v2.5
Siumauricio commented 3 months ago

Try to do something, recreate the self hosted registry, and there go to settings -> server -> view logs, and check if there is any error

callowaysutton commented 3 months ago

Although it doesn't fix the root issue, I managed to get around this by just using the Gitea container

Siumauricio commented 2 months ago

Fixed in #196 v0.3.1