Custom node app not starting
-
Values coming from an
.envfile added iin the DockerfileDB = '${CLOUDRON_MONGODB_HOST}://${CLOUDRON_MONGODB_USERNAME}:${CLOUDRON_MONGODB_PASSWORD}@${CLOUDRON_MONGODB_URL}/{CLOUDRON_MONGODB_DATABASE}' BASE_URL = '${CLOUDRON_APP_DOMAIN}' PORT = ${CLOUDRON_MONGODB_PORT} COOKIE_KEY = 4c5h3sve45yte55rgae984hvs4780gtsRH5ygrs54r5Hr4adRSjgg66y8634 SIGNUPS = on NODE_OPTIONS = --max_old_space_size=460 HTTPS = false APPDIRECTORY = 'voip' -
The app's code reads the port from the
.envconfig file.
But doesn't seem to like what I wrote (above)app.get('/get-base-url', function(req, res) { res.status(200).json({url: process.env.BASE_URL.trim()}); }); server.listen(process.env.PORT) -
Values coming from an
.envfile added iin the DockerfileDB = '${CLOUDRON_MONGODB_HOST}://${CLOUDRON_MONGODB_USERNAME}:${CLOUDRON_MONGODB_PASSWORD}@${CLOUDRON_MONGODB_URL}/{CLOUDRON_MONGODB_DATABASE}' BASE_URL = '${CLOUDRON_APP_DOMAIN}' PORT = ${CLOUDRON_MONGODB_PORT} COOKIE_KEY = 4c5h3sve45yte55rgae984hvs4780gtsRH5ygrs54r5Hr4adRSjgg66y8634 SIGNUPS = on NODE_OPTIONS = --max_old_space_size=460 HTTPS = false APPDIRECTORY = 'voip'@timconsidine For PORT the ' characters are missing? Is that ok?
-
Values coming from an
.envfile added iin the DockerfileDB = '${CLOUDRON_MONGODB_HOST}://${CLOUDRON_MONGODB_USERNAME}:${CLOUDRON_MONGODB_PASSWORD}@${CLOUDRON_MONGODB_URL}/{CLOUDRON_MONGODB_DATABASE}' BASE_URL = '${CLOUDRON_APP_DOMAIN}' PORT = ${CLOUDRON_MONGODB_PORT} COOKIE_KEY = 4c5h3sve45yte55rgae984hvs4780gtsRH5ygrs54r5Hr4adRSjgg66y8634 SIGNUPS = on NODE_OPTIONS = --max_old_space_size=460 HTTPS = false APPDIRECTORY = 'voip'@timconsidine said in Custom node app not starting:
PORT = ${CLOUDRON_MONGODB_PORT}
Is this correct? Why is the app listening on MONGODB's port?
-
Been staring at screens and can't see wood for trees, so asking here
I'm building a custom app for cloudron which packages a nodejs app using a mongodb connection (app to provide SMS messaging from browser using a Twilio/Telnyx virtual number)
Failing healthcheck and not clear why.
Is it a DB connection issue?
Did I not specify the mongodb port correctly?
Or is it EROFS read only error (but it's a port value, not a file) ?
Apologies if I'm being thickSep 06 13:14:25Node.js v18.12.1 Sep 06 13:14:27=> Healtheck error: Error: Timeout of 7000ms exceeded Sep 06 13:14:37=> Healtheck error: Error: Timeout of 7000ms exceeded Sep 06 13:14:39Starting Node.js app Sep 06 13:14:40=> Healtheck error: Error: connect ECONNREFUSED 172.18.19.244:80 Sep 06 13:14:40node:events:491 Sep 06 13:14:40throw er; // Unhandled 'error' event Sep 06 13:14:40^ Sep 06 13:14:40 Sep 06 13:14:40Error: listen EROFS: read-only file system ${CLOUDRON_MONGODB_PORT} Sep 06 13:14:40 at Server.setupListenHandle [as _listen2] (node:net:1468:21) Sep 06 13:14:40 at listenInCluster (node:net:1533:12) Sep 06 13:14:40 at Server.listen (node:net:1632:5) Sep 06 13:14:40at Object.<anonymous> (/app/code/VoIP/app.js:165:8) Sep 06 13:14:40 at Module._compile (node:internal/modules/cjs/loader:1159:14) Sep 06 13:14:40 at Module._extensions..js (node:internal/modules/cjs/loader:1213:10) Sep 06 13:14:40 at Module.load (node:internal/modules/cjs/loader:1037:32) Sep 06 13:14:40 at Module._load (node:internal/modules/cjs/loader:878:12) Sep 06 13:14:40 at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) Sep 06 13:14:40 at node:internal/main/run_main_module:23:47 Sep 06 13:14:40Emitted 'error' event on Server instance at: Sep 06 13:14:40 at emitErrorNT (node:net:1512:8) Sep 06 13:14:40 at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { Sep 06 13:14:40code: 'EROFS', Sep 06 13:14:40errno: -30, Sep 06 13:14:40syscall: 'listen', Sep 06 13:14:40address: '${CLOUDRON_MONGODB_PORT}', Sep 06 13:14:40port: -1 Sep 06 13:14:40} SWill post a repo once I have it working
@timconsidine said in Custom node app not starting:
Sep 06 13:14:40 at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
Sep 06 13:14:40code: 'EROFS',
Sep 06 13:14:40errno: -30,
Sep 06 13:14:40syscall: 'listen',
Sep 06 13:14:40address: '${CLOUDRON_MONGODB_PORT}',
Sep 06 13:14:40port: -1Per the above error, it looks like the app is trying to listen literally on the string
${CLOUDRON_MONGODB_PORT}. i.e there is no environment variable expansion happenning. BTW, you might be wrongly assuming that you can even use environment variable in that .env file. -
@timconsidine For PORT the ' characters are missing? Is that ok?
@Kubernetes said in Custom node app not starting:
For PORT the ' characters are missing? Is that ok?
I assumed as numeric value they are not needed, but it's sure worth a try.
Thank you -
@timconsidine said in Custom node app not starting:
PORT = ${CLOUDRON_MONGODB_PORT}
Is this correct? Why is the app listening on MONGODB's port?
@girish said in Custom node app not starting:
Is this correct? Why is the app listening on MONGODB's port?
Hmmm, very good point.
I think I just assumed it was Mongo's port, but looking at the original repo, maybe it is not. Probably entirely my error. -
@timconsidine said in Custom node app not starting:
Sep 06 13:14:40 at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
Sep 06 13:14:40code: 'EROFS',
Sep 06 13:14:40errno: -30,
Sep 06 13:14:40syscall: 'listen',
Sep 06 13:14:40address: '${CLOUDRON_MONGODB_PORT}',
Sep 06 13:14:40port: -1Per the above error, it looks like the app is trying to listen literally on the string
${CLOUDRON_MONGODB_PORT}. i.e there is no environment variable expansion happenning. BTW, you might be wrongly assuming that you can even use environment variable in that .env file.@girish said in Custom node app not starting:
BTW, you might be wrongly assuming that you can even use environment variable in that .env file.
Err, yes I was assuming and didn't start to think how they would be interpolated ! Thank you.
So what is best practice in this case ?
Construct the.envfile and populate values in the Dockerfile ? -
Ah !
Yes, I guess Dockerfile doesn't know these when the image is built.
Apologies, brain definitely slow.
Not sure if I should blame the heat or old age !
Thank you @girishAnd thank you @Kubernetes
Exactly the pointers I needed.
-
Yay !
Those corrections got me past the initial issue.
Some other problem now that I will investigate before sharing a repo in case useful to someone. -
Update :
Custom app now installed and working - thanks again @girish and @Kubernetes
Will make a repo and share link -
I have now created a repo for my custom package : https://git.cloudron.io/timconsidine/smsvoip-cloudron/
This packages a "desktop SMS" app which allows you to send/receive SMS on a virtual number (not your phone's number).
It is also useful for "fake" registrations for things like WhatsApp etc.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login