Run a Node.js application
Want to run a Node.js application on Cyberfusion?
There are two paths depending on whether the application needs to be reachable over the web or just runs in the background. This article covers both.
Prerequisites
Whichever path you take, the cluster needs the Node.js node group on the nodes that will run the application — and Passenger as well if the application is web-accessible.
Add these node groups via 'Servers' > 'Nodes' > the node > 'Groups'. See Add a node group for the steps.
You also need a UNIX user with a Node.js version set as its 'Default NodeJS Version' — the application runs as that user and inherits that version. If you don't have a suitable UNIX user yet, create one at 'Advanced' > 'UNIX Users' > 'Create UNIX User' and set 'Default NodeJS Version' in the create form. See All about UNIX users for the full create flow.
Web-accessible (via Passenger)
For an application that serves HTTP requests — an SSR framework (Next.js, Nuxt, Astro), a custom API, or any other Node app behind a domain — Cyberfusion runs it via Phusion Passenger. Cyberfusion supervises the worker pool, restarts workers on memory limits, and routes traffic to the right backend.
The flow is:
- Create a Passenger app on the UNIX user. See All about Passenger apps for the create flow, the app-root constraint, and the sizing fields.
- Attach the Passenger app to a virtual host. Pick 'NodeJS' as the language on the virtual host and select your Passenger app from the dropdown. See All about virtual hosts for the language picker.
- Point DNS for the virtual host's domain at the cluster; Let's Encrypt issues a certificate automatically. See Let's Encrypt certificates.
The app is now reachable at the virtual host's domain over HTTPS.
Background only (as a daemon)
For a script that doesn't serve HTTP requests — a queue worker, a long-poller, a scheduled job dispatcher — create a daemon on the UNIX user. A daemon runs continuously; if it dies or hits its memory limit, the cluster restarts it.
Navigate to 'Advanced' > 'UNIX Users' > pick a UNIX user > 'Daemons' section > '+'. Enter the command to run (e.g. node /home/user/worker.js) and the nodes the daemon should run on.
See Daemons for the field reference and the restart trigger file you can use from a deploy script.