OpenSignLabs / OpenSign

🔥 The free & Open Source DocuSign alternative
https://www.opensignlabs.com
GNU Affero General Public License v3.0
3.32k stars 261 forks source link

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

Open dsaltares opened 2 months ago

dsaltares commented 2 months ago

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.

Code of Conduct

rick-hmc commented 2 months ago

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.

dsaltares commented 2 months ago

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.

useahawk commented 2 months ago

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

dsaltares commented 2 months ago

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

useahawk commented 2 months ago

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!

dsaltares commented 2 months ago

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?

useahawk commented 2 months ago

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.

dsaltares commented 2 months ago

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

prafull-opensignlabs commented 2 months ago

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

davisk4rpi commented 2 months ago

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.

andrew-opensignlabs commented 2 months ago

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.

davisk4rpi commented 2 months ago

macOS

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

davisk4rpi commented 2 months ago

@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

reddexx commented 2 months ago

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
santosh2494 commented 2 months ago

Same issue with my installation as well.

D3Dgroupe commented 1 month ago

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

parasiteoflife commented 1 month ago

@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 commented 1 month ago

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"}}
bobvandevijver commented 1 month ago

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

parasiteoflife commented 1 month ago

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

thank you, that was it! But why?

bobvandevijver commented 1 month ago

thank you, that was it! But why?

See #1256, that would be my guess

D3Dgroupe commented 1 month ago

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