Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Cloudron Forum

Apps | Demo | Docs | Install

Custom node app not starting

Scheduled Pinned Locked Moved App Packaging & Development
14 Posts 3 Posters 59 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine App Dev
    wrote last edited by
    #1

    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 thick

    Sep 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}
    S
    

    Will post a repo once I have it working

    girishG 1 Reply Last reply
    0
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine App Dev
    wrote last edited by
    #2

    Values coming from an .env file added iin the Dockerfile

    DB = '${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'
    
    KubernetesK girishG 2 Replies Last reply
    0
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine App Dev
    wrote last edited by
    #3

    The app's code reads the port from the .env config 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)
    
    1 Reply Last reply
    0
  • KubernetesK Offline
    KubernetesK Offline
    Kubernetes App Dev
    replied to timconsidine last edited by
    #4

    @timconsidine For PORT the ' characters are missing? Is that ok?

    timconsidineT 1 Reply Last reply
    1
  • girishG Do not disturb
    girishG Do not disturb
    girish Staff
    replied to timconsidine last edited by
    #5

    @timconsidine said in Custom node app not starting:

    PORT = ${CLOUDRON_MONGODB_PORT}

    Is this correct? Why is the app listening on MONGODB's port?

    timconsidineT 1 Reply Last reply
    0
  • girishG Do not disturb
    girishG Do not disturb
    girish Staff
    replied to timconsidine last edited by girish
    #6

    @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: -1

    Per 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.

    timconsidineT 1 Reply Last reply
    1
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine App Dev
    replied to Kubernetes last edited by
    #7

    @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

    1 Reply Last reply
    0
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine App Dev
    replied to girish last edited by
    #8

    @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.

    1 Reply Last reply
    0
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine App Dev
    replied to girish last edited by
    #9

    @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 .env file and populate values in the Dockerfile ?

    1 Reply Last reply
    0
  • girishG Do not disturb
    girishG Do not disturb
    girish Staff
    wrote last edited by
    #10

    We generate env files usually in start.sh like:

        cat > /app/data/env << EOF
    # Add custom environment variables in this file
    
    NEXT_PUBLIC_APP_NAME="${CLOUDRON_APP_DOMAIN}"
    NEXT_PUBLIC_COMPANY_NAME="${CLOUDRON_APP_DOMAIN}"
    EOF
    
    1 Reply Last reply
    2
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine App Dev
    wrote last edited by
    #11

    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 @girish

    And thank you @Kubernetes

    Exactly the pointers I needed.

    1 Reply Last reply
    1
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine App Dev
    wrote last edited by
    #12

    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.

    1 Reply Last reply
    0
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine App Dev
    wrote last edited by
    #13

    Update :
    Custom app now installed and working - thanks again @girish and @Kubernetes
    Will make a repo and share link

    1 Reply Last reply
    3
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine App Dev
    wrote last edited by
    #14

    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.

    1 Reply Last reply
    3

  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Login

  • Don't have an account? Register

  • Login or register to search.