No description
- JavaScript 53.2%
- HTML 19.6%
- Shell 14.5%
- Dockerfile 12.7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| public | ||
| src | ||
| test | ||
| .dockerignore | ||
| .gitignore | ||
| deploy.sh | ||
| docker-compose.yml | ||
| Dockerfile | ||
| package.json | ||
| README.md | ||
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:
-
test: installs dependencies and runs
npm test. -
build (pushes to
mainonly, after tests pass): builds the image and pushes it togit.sphenica.com/sphenica/express-demotaggedlatestand with the short commit hash. -
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