FORM.IO : attempting custom package
-
So I decided to have a bash at packaging an app.
I have previously installed what others have built but not myself packaged from scratch. So standby for some dumb questions, sorry.I decided to try to package FORM.IO as i think it would be popular with others, as well as useful to myself. I got it working as a docker-compose installation on another VPS.
I have blundered through changes to their Dockerfile and package.json, and have got to a point where it installs but hangs in healthcheck because of failed connection to mongodb (specified as an addon in CloudronManifest.json). I believe I fixed this by editing
src/db/index.js
to saylet db = ${CLOUDRON_MONGODB_URL};
But on install, the logs show what seems to be a race condition.
Needy to investigate more, but wondering if anyone has seen this? -
@timconsidine It seems some node module got compromised somewhere. We are seeing this when using surfer CLI as well . See also https://github.com/compodoc/compodoc/issues/1171 and https://github.com/aws/aws-cdk/issues/18323
-
-
So my build is still failing to make a db connection
In the original app config/default.json, they have this :"mongo": "mongodb://localhost:27017/formioapp",
I converted this to :
"mongo": "mongodb://${CLOUDRON_MONGODB_HOST}:${CLOUDRON_MONGODB_PORT}/${CLOUDRON_MONGODB_DATABASE}",
But it doesn't connect and logs say :
(node:1) UnhandledPromiseRejectionWarning: Error: Could not connect to the given Database for server updates: mongodb://${CLOUDRON_MONGODB_HOST}:${CLOUDRON_MONGODB_PORT}/${CLOUDRON_MONGODB_DATABASE}.
That suggests to me that the variables' values are not being passed through.
How should I be referencing the cloudron mongodb variables?
The config file is .json so plain text file. -
@timconsidine JSON does not have any notion of environment variables by default, probably easiest if you sed/replace them via start.sh and just enter the actual values from
env | grep MONGO
. -
@msbt thank you
I've decided to 'step over' adjusting them in the config file (because I can't) and adjusted the app code to read the config file
e.g.process.env.CLOUDRON_MONGODB_HOST
as it is nodejs app
Not there yet but making progress