Apps and software
Node.js and Python apps
Run Node.js and Python applications next to PHP, on the whole site or a path, with per-app Node.js versions, zero-downtime restarts, health checks, background workers, resource limits and a Laravel toolkit.
On this page
Besides PHP, a Berth website can run its own long-running processes: a Next.js or Nuxt front end, an Express or NestJS API, a Flask or FastAPI service, or a background worker that processes a queue. Each app is its own process, run by the server as the subscription's system user, and nginx sends the site (or one path) to it.
Apps are available when the package allows them: Node.js and Python apps in the package (berth plan set --name dev --apps).
How an app runs
- Each app is a separate service that the root agent starts as the subscription's system user, inside the subscription's resource slice. It counts towards the package's CPU, memory and process limits, together with PHP, cron and SSH.
- The panel picks a free local port and passes it in the environment variable
PORT. Your app listens on that port on127.0.0.1. - nginx is the only way in. It forwards the chosen path to the app, with HTTPS, the WAF, per-visitor limits and the domain's other settings in front. App ports are reachable only from the server itself, and only for the app's own subscription.
- An app can take over the whole site (
/) or one path such as/api/. The rest of the site is served as usual, so a PHP site and a Node API can share one domain. - Background workers have no web address at all: a queue worker, a scheduler, a bot.
Add an app
On the domain page, open Apps and click Add app:
- Choose Node.js or Python, or a template.
- Choose the folder in the webspace that holds the code (default
app) and the start command. Without a command, Node.js runsnpm startand Python runspython app.py. - Choose the path on the website:
/for the whole site, or for example/api/. Leave it out for a background worker. - Optionally add a build step (such as
npm run build) and a health check path (such as/health). - Install the dependencies and start the app.
berth app add --domain example.com --name web --template nextjs --rolling
berth app install --domain example.com --name web
berth app start --domain example.com --name webInstall runs npm ci (or npm install without a lock file) for Node.js, and creates a virtual environment with pip install -r requirements.txt for Python. The build step runs after the dependencies.
A background worker:
berth app add --domain example.com --name queue --runtime node --command "node worker.js" --worker --startTemplates
Templates fill in runtime, start command, build step and health check for common frameworks:
| Template | Runtime | Start command |
|---|---|---|
nextjs | Node.js | npx next start -p $PORT -H 127.0.0.1 |
nuxt | Node.js | node .output/server/index.mjs |
astro | Node.js (Node adapter) | node ./dist/server/entry.mjs |
express | Node.js | npm start |
nestjs | Node.js | node dist/main |
flask | Python (gunicorn) | gunicorn -b 127.0.0.1:$PORT app:app |
fastapi | Python (uvicorn) | uvicorn main:app --host 127.0.0.1 --port $PORT |
berth app templates --domain example.comNode.js versions
Every app picks its own Node.js major version, for example 22 or 24. Berth downloads the official builds from nodejs.org, verifies their signatures, and keeps each major version up to date with the latest release daily; apps on it are restarted after an update.
| Value | Meaning |
|---|---|
22, 24, … | That major version, always the newest release |
auto | Read from .nvmrc, .node-version or engines.node in package.json |
system | The Node.js of the operating system |
berth app set --domain example.com --name web --node auto
berth app node-update # fetch the newest releases now and restart the affected appsZero-downtime restarts
With --rolling, a restart or deploy starts the new instance next to the old one, waits until it answers healthy, and only then switches traffic over. Visitors never see a gap. Without it, the app is stopped and started, which takes a moment.
berth app set --domain example.com --name web --rolling
berth app restart --domain example.com --name webHealth checks and the watchdog
With a health check path set, the panel regularly requests that path. An app that keeps running but stops answering is restarted automatically by the watchdog, a limited number of times; each restart is recorded in the activity log and sent as a notification. An app process that exits with an error is restarted by systemd.
Status, logs and usage
The Apps page shows each app's state, the latest log lines and Watch live. Usage history for CPU, memory and restarts is available per app:
berth app list --domain example.com
berth app logs --domain example.com --name web
berth app metrics --domain example.com --name web --period 7dLimits per app
All apps of a subscription share its budget. To keep one app with a memory leak or a heavy job from affecting the others and the website, give it its own lower limits under Limits at the app:
- CPU, in percent of one core,
- memory, in MB,
- tasks (processes and threads),
- disk throughput in MB/s and operations per second.
Empty means no own limit. A limit cannot be higher than the subscription's, and memory can be at most 90 % of it; the panel shows what the subscription allows. New limits apply immediately without a restart, unless the app already uses more memory than the new limit; then the app is restarted. At the memory limit the kernel stops a process of the app and the panel starts it again (a hard limit, without swap). The page shows usage against each limit and how often the app hit it since its last start. Installing and building are not counted against the app's own limits, only against the subscription's.
berth app limits --domain example.com --name web --cpu 50 --memory 256 --tasks 64
berth app limits --domain example.com --name web --clearDisk space used by an app counts towards the subscription's quota; there is no separate disk quota per app. See Isolation for the subscription-level limits.
Environment variables and secrets
Put configuration in the app's own .env in its folder, or, for secrets you do not want in the code, in the domain's environment: Developers → Environment (variables and secrets). Those values are available to PHP, to the domain's apps and background processes, and to scheduled tasks that load the environment. After saving, a value cannot be read back in the panel; the previous five values of each variable are kept so you can restore one.
printf '%s' "$API_KEY" | berth domain env --domain example.com --set API_KEY
berth domain env --domain example.com # names only, no values
berth domain env --domain example.com --history API_KEY
berth domain env --domain example.com --restore API_KEY --version 3You can also set variables on the app itself with --env NAME=value on berth app add or berth app set; --env on set replaces the whole list.
Laravel toolkit
For Laravel sites, the domain has a Laravel page with the things a Laravel app needs on a server:
- Artisan commands from an allow-list, such as
migrate --force,optimize,cache:clear,downandup, - the scheduler (
schedule:runevery minute), - queue workers as background processes running
queue:work, - an editor for the
.envfile.
berth laravel show --domain example.com
berth laravel artisan --domain example.com -- migrate --force
berth laravel scheduler --domain example.com --on
berth laravel worker --domain example.com --name queueLaravel itself runs on PHP; set the document root to httpdocs/public (see Domains and subscriptions).
Deploying code
Code reaches the app folder over SFTP, SSH with rsync or git, or through Git deploy, which can build and restart on every push. For applications that come as a container image instead, see Containers.
System apps
Some software belongs to the server rather than to a customer: an internal dashboard, a webhook receiver, a small API. Under System → System apps an administrator runs such an app without a domain or subscription:
- An app (Node.js or Python) is built from a public Git repository over https and runs as its own systemd unit, in a sandbox under its own system user.
- A container runs rootless with Podman under its own user, from an image of an allowed registry.
Both listen only on the server itself (127.0.0.1) until you publish them. Publishing sets an address, a port and a matching firewall rule, optionally limited to certain addresses or networks, and can put the app on a host name of its own behind the panel's nginx, with a certificate from Let's Encrypt. Unpublishing takes it back to the server only. Installing and building run as a system job you can follow live.
berth sysapp create dashboard --runtime node --source https://git.example.com/ops/dashboard.git \
--health /health --memory 512 --install
berth sysapp create status --kind container --image docker.io/library/nginx:alpine --container-port 80
berth sysapp publish dashboard --hostname dashboard.example.nl --email ops@example.nl
berth sysapp list
berth sysapp logs dashboard
berth sysapp unpublish dashboardDeleting a system app removes its unit or container, host name and firewall rule; its code and data stay unless you add --purge.