openpanel icon indicating copy to clipboard operation
openpanel copied to clipboard

If I am not allowed to register when I am self-hosting and deploying, how can I create my first account?

Open fre2d0m opened this issue 3 months ago • 4 comments

As the title says, my .env file is configured as follows:

NODE_ENV="production"
NEXT_PUBLIC_SELF_HOSTED="true"
GEO_IP_HOST="http://op-geo:8080"
BATCH_SIZE="5000"
BATCH_INTERVAL="10000"
ALLOW_REGISTRATION="false"
ALLOW_INVITATION="true"

So how can I get the first account?

I set the dashboard to port 49001 and the api to port 49000. When registering the dashboard, the following interface error 404 (after reverse proxy) occurs, but the local request is 403 error.

[root@iZbp16t01erjm1qy0v0vmuZ self-hosting]# curl -X POST -v 'http://localhost:49001/api/trpc/auth.signUpEmail'
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 49001 (#0)
> POST /api/trpc/auth.signUpEmail HTTP/1.1
> Host: localhost:49001
> User-Agent: curl/7.61.1
> Accept: */*
> 
< HTTP/1.1 403 Forbidden
< Date: Sat, 27 Sep 2025 08:28:13 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
< Transfer-Encoding: chunked

To be honest, I'm confused by self-hosting. Is it that other people haven't encountered such problems, or am I stupid?

I tried to set ALLOW_REGISTRATION = true or false, it's all the above.

fre2d0m avatar Sep 27 '25 08:09 fre2d0m

The self-hosting should be very simple tbh. Its just a wizard and then you should be good to go.

Regarding register, the logic looks like this:

async function getIsRegistrationAllowed(inviteId?: string | null) {
  // ALLOW_REGISTRATION is always undefined in cloud
  if (process.env.ALLOW_REGISTRATION === undefined) {
    return true;
  }

  // Self-hosting logic
  // 1. First user is always allowed
  const count = await db.user.count();
  if (count === 0) {
    return true;
  }

  // 2. If there is an invite, check if it is valid
  if (inviteId) {
    if (process.env.ALLOW_INVITATION === 'false') {
      return false;
    }

    const invite = await db.invite.findUnique({
      where: {
        id: inviteId,
      },
    });

    return !!invite;
  }

  // 3. Otherwise, check if general registration is allowed
  return process.env.ALLOW_REGISTRATION !== 'false';
}

So either way if you allow or disallow registrations, the first sign up should always be allowed. So I have a feeling you already have an account?

Whats the actual body you get from the signup request? Do you get Registrations are not allowed?

lindesvard avatar Sep 28 '25 10:09 lindesvard

I had the same problem. In my case it was an error occuring because my base port was on https but the trcp auth link for the registration was in http. I had to define the NEXT URL Variables in the env file and include some http to https settings in my traefik middlewares yaml.

In my case I deployed the template service in dokploy.

https://www.fzeba.com/posts/42_dokploy-openpanel-errors/

flnzba avatar Oct 04 '25 14:10 flnzba

@flnzba is this similar to these issues I pointed out here? https://github.com/Dokploy/templates/issues/292

lindesvard avatar Oct 05 '25 06:10 lindesvard

@lindesvard Yes. Exactly the same issue. I think my changes match your recommendation 90%.

flnzba avatar Oct 05 '25 13:10 flnzba