OpenSignLabs / OpenSign

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

[Bug]: Migration fails on Docker build #868

Open kevinroleke opened 2 weeks ago

kevinroleke commented 2 weeks ago

Issue Description

Migrations fail to run from the jump, which causes most endpoints to be broken, giving errors like Error:exception in query,Result not Found.

OpenSignServer-container  | Command output:                                                                                                       OpenSignServer-container  | Parse DBTool v1.2.0 - Parse server tool for data migration and seeding.                                               OpenSignServer-container  |                                                                                                                       
OpenSignServer-container  | Run migration on parse-server at http://localhost:8080/app                                                            OpenSignServer-container  |                                                                                                                       OpenSignServer-container  |  ⠶ Migrating 20231110174122-update_setclp.cjs                                                                         OpenSignServer-container  |  ERROR  Class contracts_Users does not exist.                                          
OpenSignServer-container  |                                              
OpenSignServer-container  |  SUCCESS  Successfully run migrations.
OpenSignServer-container  | 
OpenSignServer-container  | 

Here are my configs

.env

# Frontend config ************************************************************************************************************************************************************************************************

# Set it to the URL form where the app home page will be accessed
PUBLIC_URL=https://DOMAIN/
# Set it to true if you want to generate the Sourcemap for debugging
GENERATE_SOURCEMAP=false
# Set it to the URL from where APIs will be accessible, for local development it should be localhost:3000/api/app (use your local port number instead)
REACT_APP_SERVERURL=https://DOMAIN/app
# A 12 character long random app identifier. The value of this should be same as APP_ID which is a variable used by backend API.
REACT_APP_APPID=[redacted]
# Google tag manager container id for configuring GTM on all pages of the app
REACT_APP_GTM=

# Backend ExpressJS config ****************************************************************************************************************************************************************************************
# A 12 character long random app identifier. The value of this should be same as REACT_APP_APPID which is a variable used by Frontend React App.
APP_ID=[redacted]
# Name of the app. It will be visible in the verification emails sent out.
appName=My App Name
# A 12 character long random secret key that allows access to all the data. It is used in Parse dashboard config to view all the data in the database.
MASTER_KEY=[redacted]
# Mongodb URI to connect to
MONGODB_URI=mongodb://mongo:27017/opensign
# Path on which APIs should be mounted. Do not change this. This variable shall be removed & value hardcoded in the source code in coming versions.
PARSE_MOUNT=/app
# Set it to the URL from where APIs will be accessible to the NodeJS functions, for local development it should be localhost:3000/api/app (use your local port number instead)
SERVER_URL=https://DOMAIN/app

# Storage config ************************************************************************************************************************************************************************************************
# Digital ocean space name or AWS S3 bucket name for uploading documents
DO_SPACE=[redacted]
# Digital ocean spaces endpoint or AWS S3 endpoint for uploading documents
DO_ENDPOINT=ams3.digitaloceanspaces.com
# Digital ocean baseurl or AWS S3 base URL
DO_BASEURL=[redacted]
# Digital ocean spaces access key ID or AWS s3 Access key ID for uploading the docs
DO_ACCESS_KEY_ID=[redacted]
# Digital ocean spaces secret access key or AWS s3 secret access key for uploading the docs
DO_SECRET_ACCESS_KEY=[redacted]
# Digital ocean spaces region or AWS s3 region
DO_REGION=sfo3
# Set this to true id you are using local storage instead of s3 compatible storage
# USE_LOCAL=TRUE

# Email mailgun or set SMTP_ENABLE true to use SMTP config (The app will not initialize if any of these 3 variables are not set) *********************************************************************************************************************
MAILGUN_API_KEY=[redacted]
MAILGUN_DOMAIN=DOMAIN
MAILGUN_SENDER=signserver@DOMAIN
SMTP_ENABLE=
SMTP_HOST=
SMTP_PORT=
SMTP_USER_EMAIL=
SMTP_PASS=

# Base64 encoded PFX or p12 document signing certificate file *********************************************************************************************************************
PFX_BASE64=[redacted]
PASS_PHRASE=[redacted]

nginx

server {
    server_name DOMAIN;
    listen 443;

    location / {
        proxy_pass http://localhost:3000;
    }

    location /app {
        proxy_pass http://localhost:8080;
    }
}

Expected Behavior

Migrations should run successfully and the app should work

Current Behavior

First migration fails and the app is entirely broken

Steps to reproduce

  1. Clone the repo
  2. Edit .env
  3. make build

Screenshots of the issue(optional)

No response

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

Debian 12

What browsers are you seeing the problem on?

Chrome, Firefox, Safari, Microsoft Edge

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

1.4.0

What environment are you seeing the problem on?

Hosted (app.yourdomain.com), Dev (localhost or vercel)

Please check the boxes that apply to this issue report.

Code of Conduct

andrew-opensignlabs commented 2 weeks ago

Hi Kevin, Our team is checking into this, will let you know as soon as I have an update. In the meantime, I suggest you to join our discord server. You will find a great community that can help you resolve any self-hosting related issues.

kevinroleke commented 2 weeks ago

The exact same steps run on my PC (Debian 12) work perfectly. However, on a fresh digitalocean VPS (Debian 12) the migrations fail!

I can get half of the application to work by transplanting a database dump from my PC to the server, but then document creation breaks.

So weird.

Lavhumo commented 1 day ago

I have the same challenge

arse DBTool v1.2.0 - Parse server tool for data migration and seeding. OpenSignServer-container | OpenSignServer-container | Run migration on parse-server at http://localhost:8080/app OpenSignServer-container | OpenSignServer-container | ⠶ Migrating 20231110174122-update_setclp.cjs OpenSignServer-container | ERROR Class contracts_Users does not exist. OpenSignServer-container | OpenSignServer-container | SUCCESS Successfully run migrations.

Any help