OpenSign icon indicating copy to clipboard operation
OpenSign copied to clipboard

[Bug]: Unable to create first user on brand new local Docker installation

Open dsaltares opened this issue 1 year ago • 23 comments

Issue Description

I am not presented with a first-time setup to create an admin user when I first open the app on a local Docker installation. This is similar to https://github.com/OpenSignLabs/OpenSign/issues/973, but I am on 2.2.0 (have also tried main).

Expected Behavior

Judging from comments (https://github.com/OpenSignLabs/OpenSign/issues/1080#issue-2476655525). I am meant to see a user registration screen the first time I use the app.

Current Behavior

I am presented with a login screen that reads Welcome back!, but there are not registered users.

Steps to reproduce

Follow the instructions to self-host from https://docs.opensignlabs.com/docs/self-host/docker/run-locally

export HOST_URL=https://opensign.yourdomain.com && curl --remote-name-all https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/docker-compose.yml https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/Caddyfile https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/.env.local_dev && mv .env.local_dev .env.prod && docker compose up --force-recreate`

I also tried tagging a specific version (2.2.0):

export HOST_URL=https://opensign.saltares.dev && curl --remote-name-all https://raw.githubusercontent.com/OpenSignLabs/OpenSign/v2.2.0/docker-compose.yml https://raw.githubusercontent.com/OpenSignLabs/OpenSign/v2.2.0/Caddyfile https://raw.githubusercontent.com/OpenSignLabs/OpenSign/v2.2.0/.env.local_dev && mv .env.local_dev .env.prod && docker compose up --force-recreate

Screenshots of the issue(optional)

image

Operating System [e.g. MacOS Sonoma 14.1, Windows 11]

MacOS Ventura 13.6.7

What browsers are you seeing the problem on?

Chrome

What version of OpenSignâ„¢ are you seeing this issue on? [e.g. 1.0.6]

2.2.0 I used the Docker main and docker_beta versions.

What environment are you seeing the problem on?

Hosted (app.yourdomain.com)

Please check the boxes that apply to this issue report.

  • [X] I have searched the existing issues & discussions to make sure that this is not a duplicate.

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] I have searched the existing issues & discussions to make sure that this is not a duplicate.

dsaltares avatar Sep 04 '24 09:09 dsaltares

Same for me - I have been through every document on the website and it seems like the initialisation is something that is normal process but not happening in the latest build.

rick-hmc avatar Sep 04 '24 12:09 rick-hmc

I initially thought a user would be automatically created and it wasn't documented, so I opened Mongo Compass and inspected the db. However, the _Users collection had no documents at all.

dsaltares avatar Sep 05 '24 08:09 dsaltares

I have the same Problem and it seems to be a duplicate of #1115 . Couldn't find anything in the docs ether.

useahawk avatar Sep 05 '24 10:09 useahawk

@useahawk that's right, my bad for not finding that one although it doesn't say how it was fixed.

dsaltares avatar Sep 05 '24 11:09 dsaltares

I got it solved for my env. Testing localhost:3000 showed welcome page Testing localhost:3001 showed not available Testing localhost:443 showed register page

Looing at the Caddyfile it makes sense, so i tweaked my ports in live env as needed (cant use any of the 3000, 3001, 8080, 80 or 443 ports) and fixed my own reverse proxy with the rules from the Caddyfile.

Finally it's working!

useahawk avatar Sep 05 '24 14:09 useahawk

With a fresh installation of opensign this is what I get.

localhost:3000 image

localhost:3001 image

https://localhost:443 image

What modifications did you make exactly?

dsaltares avatar Sep 06 '24 12:09 dsaltares

just try https://localhost

In live I changed all docker ports as needed and used apache reverse proxy

# Reverse Proxy for the client-side (front-end)
    ProxyPass "/" "http://client:3000/"
    ProxyPassReverse "/" "http://client:3000/"

    # Handle specific path /app/*
    <Location /app/>
        # URL Rewrite to ensure /app is passed correctly to the backend
        RewriteEngine On
        RewriteRule ^/app/(.*)$ /app/$1 [PT]

        # Reverse Proxy for the server-side (back-end)
        ProxyPass "http://server:8080/app/"
        ProxyPassReverse "http://server:8080/app/"
    </Location>

    # Required for reverse proxy functionality
    ProxyPreserveHost On

Had also problems with minio s3 storage and smtp mail, so for now i'm switching to another solution.

useahawk avatar Sep 06 '24 12:09 useahawk

@useahawk https://localhost shows me the protocol error message.

dsaltares avatar Sep 06 '24 13:09 dsaltares

hey @dsaltares , please checkout this updated documentation and let us know if you still encounter any issues.

prafull-opensignlabs avatar Sep 11 '24 07:09 prafull-opensignlabs

hey @dsaltares , please checkout this updated documentation and let us know if you still encounter any issues.

I just came across this issue setting up a fresh project. I followed the linked docs, but https://localhost:3001 still showed the "welcome back" page instead of allowing me to register.

Turns out, theres an easy mistake in the .env files for MOGODB_URI

https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/.env.local_dev
https://raw.githubusercontent.com/OpenSignLabs/OpenSign/docker_beta/.env.local_dev

The value provided by the copied envs is mongodb://mongo-container:27017/OpenSignDB, but it should be mongodb://mongo:27017/OpenSignDB

Docker uses the service name for the in-network host, not the container name.

davisk4rpi avatar Sep 11 '24 22:09 davisk4rpi

hey @dsaltares , please checkout this updated documentation and let us know if you still encounter any issues.

I just came across this issue setting up a fresh project. I followed the linked docs, but https://localhost:3001 still showed the "welcome back" page instead of allowing me to register.

Turns out, theres an easy mistake in the .env files for MOGODB_URI


https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/.env.local_dev

https://raw.githubusercontent.com/OpenSignLabs/OpenSign/docker_beta/.env.local_dev

The value provided by the copied envs is mongodb://mongo-container:27017/OpenSignDB, but it should be mongodb://mongo:27017/OpenSignDB

Docker uses the service name for the in-network host, not the container name.

What OS are you using? For most of us container name works instead of service name.

andrew-opensignlabs avatar Sep 12 '24 02:09 andrew-opensignlabs

macOS

As far as I am aware service name works on all systems on the latest docker

davisk4rpi avatar Sep 12 '24 05:09 davisk4rpi

@andrew-opensignlabs If using the service name is problematic, maybe network alias's would work to straighten this out?

https://docs.docker.com/reference/compose-file/services/#aliases

davisk4rpi avatar Sep 12 '24 17:09 davisk4rpi

The problem also concerns me, I wanted to try opensign, but unfortunately I can't because I get directly to the login form

My Compose:

services:
  server:
    image: opensign/opensignserver:main  # Überprüfe die Nutzung stabiler Tags
    container_name: OpenSignServer-container
    ports:
      - "8991:8080"
    depends_on:
      - mongo
    env_file: .env.prod  # Stelle sicher, dass diese Datei existiert
    environment:
      - NODE_ENV=production
      - SERVER_URL=${HOST_URL-https://localhost:3001/app}  # Standard war hier direkt
    networks:
      - opensign-network

  mongo:
    image: mongo:latest
    container_name: mongo-container
    volumes:
      - /Container/opensign/db:/data/db
    ports:
      - "27018:27017"
    networks:
      - opensign-network

  client:
    image: opensign/opensign:main  # Überprüfe auch hier die Nutzung stabiler Tags
    container_name: OpenSign-container
    depends_on:
      - server
    env_file: .env.prod  # Überprüfe auch diese Datei
    ports:
      - "3000:3001"
    networks:
      - opensign-network


networks:
  opensign-network:
    driver: bridge

reddexx avatar Sep 13 '24 07:09 reddexx

Same issue with my installation as well.

santosh2494 avatar Sep 16 '24 06:09 santosh2494

Hello, I have the same problem, do you know which container it could come from ? This is a new installation.

D3Dgroupe avatar Sep 22 '24 09:09 D3Dgroupe

@andrew-opensignlabs please allow setup on the PUBLIC_URL, with headless servers we can't access localhost, much less localhost:3001 which opensign needs

parasiteoflife avatar Sep 23 '24 06:09 parasiteoflife

I just noticed the issue is that (at least in my case) I get:

POST
https://localhost:3001/app/functions/getlogobydomain
[HTTP/2 403  5ms]

err in getlogo  Error: unauthorized

In the console, because of this OpenSign returns that there is an admin already (trying accessing /addadmin) https://github.com/OpenSignLabs/OpenSign/blob/76f5136073333479ff72d40b608bf9580c88f343/apps/OpenSign/src/constant/Utils.js#L1936-L1938 The 403 is not coming from mongo since I've tested stopping the mongo container and upon reloading I get the same 403 error.

I think it needs to use the master key?

Yes, it needs the master key, using curl I get:

curl -k -X POST https://localhost:3001/app/functions/getlogobydomain -H "X-Parse-Application-Id: opensign" -H "X-Parse-Master-Key: JtkN64wecdjS"
{"result":{"logo":"","user":"not_exist"}}

parasiteoflife avatar Sep 24 '24 01:09 parasiteoflife

For me this was caused by not using opensign as the APP_ID.

bobvandevijver avatar Sep 24 '24 19:09 bobvandevijver

For me this was caused by not using opensign as the APP_ID.

thank you, that was it! But why?

parasiteoflife avatar Sep 24 '24 20:09 parasiteoflife

thank you, that was it! But why?

See #1256, that would be my guess

bobvandevijver avatar Sep 24 '24 21:09 bobvandevijver

Hello, after a lot of modification of the docker-compose file and the environment file I managed to deploy the server on Portainer and it is accessible from the internet. I think my problem came from the fact that I had forgotten in the docker-compose the lines "volumes":

  server:
    image: opensign/opensignserver:main
    container_name: OpenSignServer-container
    volumes:
      - opensign-files:/usr/src/app/files

and its declaration in the volumes

D3Dgroupe avatar Oct 02 '24 10:10 D3Dgroupe

Hum, this seems to be a very common error with multiple sources.

I am facing this issue too and I guess it is related to network configuration but I cannot seem to find what I did wrong...
I've tried quite a lot of stuff on premise, but keptfacing the error message that state I already have an admin configured. I decided to stop trying on premise and try using Digital Ocean as the deployment was supposedly easy.

Here's the URL from Digital Ocean : https://opensign-nxppm.ondigitalocean.app/addadmin

Here's the trace from firefox's console: err in getlogo Error: XMLHttpRequest failed: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data" c ParseError.js:27 handleError RESTController.js:300 promise callback*request RESTController.js:284 run Cloud.js:114 run Cloud.js:60 jy Utils.js:2062 z AddAdmin.js:51 h AddAdmin.js:45

The request payload: {"domain":"opensign-nxppm.ondigitalocean.app","_ApplicationId":"opensign","_ClientVersion":"js5.3.0","_InstallationId":"79dafa96-57c3-4e3d-baa2-dc29a300cef1"}

The response:

...Loading

It seems like this should be offloaded to the opensign server @ 8080 (because when I request that directly to the opensign server, it states, on my on premise server : sysadmin@opensignqualif:~$ curl -X POST http://localhost:8080/app/functions/getlogobydomain -H "X-Parse-Application-Id: opensign" {"result":{"logo":"","appname":"OpenSignâ„¢","user":"not_exist"}}

Both DigitalOcean and on premise install are failing in the same way (same error message).

There also seems to be a second error which prevents me from using chrome based browsers (it fails loading the page).

Image

I suspect the on premise install fails for another reason (not web accessible ==> no let's encrypt ==> no working https out of the box ==> may annoy the app, but not sure). But have to say that since I do not know react and all, I'm having a hard time to debug.

OvoiDs avatar Mar 14 '25 18:03 OvoiDs