Kalenuxer Guide

Deployment

How Kalenuxer syncs built output to production servers using SSH and SCP, and the three deploy modes explained.

How deployment works

Kalenuxer deployment is a three-step process. After the build pipeline writes output to dist/release/, a sync script copies the output into the API project directory, and then a deploy script uploads the result to the production server over SSH and SCP.

All deploy operations are performed by the scripts in the api/ directory. No git push or CI/CD pipeline is involved.

Warning: Never run git push to deploy. Changes are deployed exclusively through deploy.cjs. Using git push will not update the production server.

Deploy steps

1

Build

Run the Kalenuxer build from the repository root. Use the -unsafe flag if you do not have FTP configured locally.

Terminal
node run.js <site> prepare release -unsafe
2

Sync

Copy the built output from dist/release/ into the API project directory. Run from inside the api/ directory.

Terminal
node sync-dist.js
3

Deploy

Upload to the production server. Choose the deploy mode that matches what changed. Run from inside the api/ directory.

Terminal
node deploy.cjs <mode>

The three deploy modes

The deploy script accepts one of three mode arguments. Each mode determines which assets are uploaded and whether the Docker containers are restarted on the server.

ModeWhat it doesUse when
frontendUploads CSS, JS, and HTML files only. No container restart.Only templates, styles, or scripts changed. Fastest deploy.
apiRebuilds the Go binary, transfers it, and restarts Docker containers.Go source code changed but frontend assets did not.
fullRebuilds the Go binary, uploads dist output, and performs a full Docker rebuild.First deploy, major changes, or both frontend and API changed.
Terminal — example commands
node deploy.cjs frontend # CSS/JS/HTML only, no restartnode deploy.cjs api # Go binary rebuild + Docker restartnode deploy.cjs full # Everything: binary + dist + Docker rebuild

SSH key setup

The deploy script connects to the production server using SSH key authentication. The key must be placed at a path the script expects. By convention, the key is named after the site:

Key path — Linux / macOS
~/.ssh/<site-name>_key
Key path — Windows (PowerShell)
$env:USERPROFILE\.ssh\<site-name>_key
Windows note: On Windows, always use $env:USERPROFILE\.ssh\ to reference the SSH directory in PowerShell. The tilde shorthand ~/.ssh/ may not resolve correctly in all PowerShell contexts.

The key must have the correct permissions. On Linux and macOS, run chmod 600 ~/.ssh/<site-name>_key to restrict access to the owner only. SSH will refuse to use the key if permissions are too open.

Forcing a rebuild before deploy

If you want to guarantee all CSS or JS files are freshly rebuilt before a deploy — for example after a configuration change that does not touch source files — write an empty JSON object to the relevant timestamp file before running the build:

Terminal — force CSS and JS rebuild
echo {} > store/times/release/css.jsonecho {} > store/times/release/js.jsonnode run.js <site> prepare release -unsafe

Then run the sync and deploy steps as normal. This ensures that whatever you upload was produced from a complete build of all current source files.

Environment variables

The .env file in the api/ directory controls server-side configuration. It is read by the deploy script and by the Go API server at runtime:

Variable groupControls
DatabasePostgreSQL connection string, database name, user, password, host, port.
CORS originsAllowed origin domains for cross-origin requests to the API.
Email configSMTP host, port, sender address, and credentials for transactional email.
RedisRedis connection URL used for session and cache storage.
Warning: Never commit the .env file to version control. It contains secrets. Add it to .gitignore and manage it out-of-band.

Want a custom build pipeline?

We can design and implement custom build and deployment systems tailored to your specific stack and workflow requirements.