No description
  • JavaScript 53.2%
  • HTML 19.6%
  • Shell 14.5%
  • Dockerfile 12.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Sphenica 495fe2cba9
All checks were successful
Test, build and deploy / test (push) Successful in 7s
Test, build and deploy / build (push) Successful in 8s
Test, build and deploy / deploy (push) Successful in 7s
.
2026-10-09 00:07:11 +01:00
.forgejo/workflows Add auto-deploy 2026-10-08 22:46:42 +01:00
public Initial commit 2026-10-08 21:59:06 +01:00
src . 2026-10-09 00:07:11 +01:00
test Initial commit 2026-10-08 21:59:06 +01:00
.dockerignore Initial commit 2026-10-08 21:59:06 +01:00
.gitignore Initial commit 2026-10-08 21:59:06 +01:00
deploy.sh Add auto-deploy 2026-10-08 22:46:42 +01:00
docker-compose.yml Use git.sphenica.com 2026-10-08 22:11:27 +01:00
Dockerfile Initial commit 2026-10-08 21:59:06 +01:00
package.json Initial commit 2026-10-08 21:59:06 +01:00
README.md Add auto-deploy 2026-10-08 22:46:42 +01:00

express-demo

A small Express.js app that runs in Docker. Every push to main is tested and built into an image by Forgejo Actions, then pushed to the Forgejo container registry.

Routes

Route What it does
/ Demo page
/health Health check (used by Docker)
/api/hello?name=you Returns a greeting
/api/info App version, Node version, environment

Run locally

npm install
npm run dev     # restarts when you save
npm test

Then open http://localhost:3000.

Run with Docker

docker compose up -d --build

Then open http://localhost:3001.

CI/CD

.forgejo/workflows/build.yml runs on every push:

  1. test: installs dependencies and runs npm test.

  2. build (pushes to main only, after tests pass): builds the image and pushes it to git.sphenica.com/sphenica/express-demo tagged latest and with the short commit hash.

  3. deploy (after a successful build): SSHes into the VPS and runs deploy.sh, which pulls the new image, restarts the container and checks /health.

Repository secrets

Secret What it is
REGISTRY_TOKEN Forgejo access token with package: read and write
DEPLOY_KEY Private SSH key for deploys (locked to deploy.sh on the VPS)
DEPLOY_HOST VPS IP or hostname
DEPLOY_USER Linux user on the VPS
DEPLOY_PORT Optional, SSH port if it isn't 22

Deploy the latest image

On the server:

docker compose pull && docker compose up -d