Centralized deployment for repositories that should not need to know they are being deployed.
Cenfra is a lightweight self-hosted deployment platform that sits between GitHub and your Docker host.
A project repository does not need its own CI/CD pipeline. You register it once in Cenfra, and Cenfra takes care of the rest:
GitHub
│
┌────────┴────────┐
│ │
Repository Push Current HEAD
│ │
└────────┬────────┘
▼
┌─────────┐
│ Cenfra │
└────┬────┘
│
repository_dispatch
│
▼
GitHub Actions
│
self-hosted runner
│
docker build
│
docker compose
▼
Running App
The result is a simple hosting workflow:
Register → Start → Running
↑ │
│ ↓
Start Stop
│ │
└── Stopped → Deregister
Cenfra is designed around one central idea:
Application repositories should contain application code, not infrastructure orchestration.
Instead of putting deployment configuration in every project, Cenfra owns the deployment logic centrally.
A source repository such as:
ProElecttro/dropsend
ProElecttro/testapp1
ProElecttro/testapp2
does not need to contain a Cenfra-specific workflow.
Cenfra stores the deployment configuration, creates the GitHub webhook, resolves the exact commit to deploy, and sends the deployment event to the central Cenfra workflow.
All deployment logic lives in the Cenfra repository instead of being duplicated across every application repository.
Cenfra reacts to GitHub push events. It does not continuously poll repositories for changes.
A registered repository can be started directly from the dashboard. Cenfra resolves the current branch HEAD and deploys that exact commit.
Running applications can be stopped from the dashboard without deregistering them.
A repository must be stopped before it can be deregistered. Deregistration removes the GitHub webhook and Cenfra's deployment state.
Cenfra allocates an available host port from the configured range.
By default:
3001 - 3030
The dashboard can attempt to detect the container's application port automatically.
Detection currently checks, in order:
EXPOSEinDockerfileENV PORTinDockerfile- A port declared in
package.jsonscripts - Next.js default:
3000 - Vite default:
5173
If no port can be detected, enter it manually.
The dashboard reconciles deployment status with the actual Docker container state. A running container is shown as Running, even if an earlier deployment state was still Deploying.
Multiple repositories can run on the same self-hosted machine while remaining separated by Docker containers and independent host ports.
Cenfra has four main pieces.
┌─────────────────────┐
│ Application Repos │
│ │
│ DropSend │
│ TestApp1 │
│ TestApp2 │
└──────────┬──────────┘
│ GitHub Webhooks
▼
┌─────────────────────┐
│ Cenfra Server │
│ Node.js + Express │
│ │
│ Dashboard │
│ Registry │
│ Webhook receiver │
│ GitHub API client │
└──────────┬──────────┘
│ repository_dispatch
▼
┌─────────────────────┐
│ Cenfra GitHub Repo │
│ │
│ deploy.yml │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Self-hosted Runner │
│ │
│ Docker │
│ Docker Compose │
└──────────┬──────────┘
│
▼
┌───────────┐
│ Containers│
└───────────┘
The application repository triggers an event, but the deployment workflow belongs to Cenfra.
That keeps the source repository free of CI/CD configuration while still allowing Cenfra to deploy an exact commit SHA.
A typical Cenfra installation looks like:
cenfra/
├── server.js
├── package.json
├── package-lock.json
├── .env
├── .gitignore
├── data/
│ └── deployments.json
│
├── public/
│ ├── index.html
│ ├── app.js
│ └── style.css
│
└── .github/
└── workflows/
└── deploy.yml
| File | Purpose |
|---|---|
server.js |
Cenfra API, dashboard backend, GitHub integration, webhook receiver, Docker control |
public/index.html |
Dashboard UI |
public/app.js |
Dashboard behavior and API calls |
public/style.css |
Dashboard styling |
data/deployments.json |
Local deployment registry |
.env |
GitHub/webhook configuration and secrets |
.github/workflows/deploy.yml |
Central deployment workflow |
Cenfra expects the hosting machine to have:
- Node.js
- npm
- Docker / Docker Desktop
- Git
- A GitHub account with access to the repositories you want to host
- A GitHub self-hosted runner configured for the Cenfra repository
- A publicly reachable HTTPS URL for GitHub webhooks
For the current local setup, the webhook endpoint is exposed through a Cloudflare Quick Tunnel.
git clone git@github.com:ProElecttro/cenfra.git
cd cenfraInstall dependencies:
npm installThe server uses Node.js packages including Express and dotenv.
Create a .env file in the root of Cenfra:
GITHUB_OWNER=ProElecttro
CENFRA_REPO=cenfra
GITHUB_TOKEN=YOUR_GITHUB_TOKEN
WEBHOOK_SECRET=YOUR_WEBHOOK_SECRET
PUBLIC_WEBHOOK_URL=https://YOUR_PUBLIC_HOSTThe GitHub account or organization that owns the Cenfra repository.
Example:
GITHUB_OWNER=ProElecttroThe central repository containing the Cenfra deployment workflow.
Example:
CENFRA_REPO=cenfraToken used by the Cenfra Node.js server to communicate with GitHub.
It is used for:
- Listing repositories
- Inspecting repositories
- Reading repository files
- Creating GitHub webhooks
- Updating GitHub webhooks
- Deleting GitHub webhooks during deregistration
- Triggering
repository_dispatchon the Cenfra repository
For private repositories, the token needs access to the repositories Cenfra manages.
For a fine-grained token, give the minimum repository access required by your setup. At minimum, the source repositories need repository metadata/content access and webhook management, while the Cenfra repository needs permission to receive the dispatch event.
Never commit this token.
A shared secret used to verify that incoming GitHub webhook requests were actually generated by GitHub.
Generate one locally, for example:
openssl rand -hex 32Then put the generated value in .env.
The public base URL that GitHub can reach.
Cenfra automatically appends:
/webhooks/github
So if:
PUBLIC_WEBHOOK_URL=https://example.comthe final webhook URL becomes:
https://example.com/webhooks/github
For the current Quick Tunnel setup:
PUBLIC_WEBHOOK_URL=https://sue-troubleshooting-wheel-liver.trycloudflare.comA Cloudflare Quick Tunnel URL is temporary. If the tunnel URL changes, restart the tunnel and update .env, then restart Cenfra. Existing GitHub webhooks may need to be recreated/updated so they point to the new URL.
For the current local setup, a Cloudflare Quick Tunnel can expose port 3100:
cloudflared tunnel --url http://localhost:3100You will receive a URL similar to:
https://something.trycloudflare.com
Put that value in .env:
PUBLIC_WEBHOOK_URL=https://something.trycloudflare.comKeep the tunnel process running while you expect GitHub to deliver webhooks.
node server.jsThe current server listens on:
http://localhost:3100
Open the dashboard at:
http://localhost:3100/
Health check:
http://localhost:3100/health
The central deployment workflow runs on a self-hosted machine, because Cenfra needs access to the local Docker daemon.
The runner should have:
- Docker installed and running
- Git installed
- GitHub Actions runner installed
- Permission to execute Docker commands
The current workflow expects the labels:
runs-on: [self-hosted, cenfra-runner]self-hosted is automatically present on GitHub self-hosted runners.
cenfra-runner is a custom label identifying the machine intended for Cenfra deployments.
Start the runner on the machine with the GitHub runner's run.sh.
The Cenfra repository needs a workflow such as:
.github/workflows/deploy.yml
The workflow is triggered centrally:
on:
repository_dispatch:
types: [deploy]It may also expose workflow_dispatch for manual testing.
The deployment event contains:
repository
branch
sha
app_port
host_port
For example:
{
"repository": "ProElecttro/dropsend",
"branch": "main",
"sha": "<exact-commit-sha>",
"app_port": "5050",
"host_port": "3001"
}The workflow then:
- Checks out the source repository at the exact SHA.
- Verifies that a
Dockerfileexists. - Creates a Cenfra-managed Docker Compose definition.
- Builds the image locally on the self-hosted runner.
- Starts the container with the allocated host port.
- Verifies the resulting container.
A deployment should use the exact SHA sent by Cenfra rather than simply checking out whatever happens to be at main when the workflow runs.
The central deployment workflow uses:
HOSTING_GH_TOKEN
as a GitHub Actions repository secret in the Cenfra repository.
This token is used by actions/checkout to read the source repository when the source repository is private.
For least privilege, give this token read-only access to the source repositories it needs to deploy.
Keep this separate from the server-side .env token when practical:
GITHUB_TOKEN → Cenfra server → GitHub API
HOSTING_GH_TOKEN → GitHub Actions runner → source repository checkout
A source repository needs a Dockerfile.
Example:
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]The important part for Cenfra's port detector is:
EXPOSE 3000If your application listens on another port, declare that port instead.
Open:
http://localhost:3100
Then:
Cenfra loads repositories available to the configured GitHub token.
The repository's default branch is populated automatically.
Cenfra verifies that the selected branch contains a Dockerfile.
Click:
Fetch Port
Cenfra attempts to detect the port automatically.
Cenfra then:
- Verifies the repository
- Verifies the Dockerfile
- Allocates a host port
- Creates/updates the GitHub push webhook
- Stores the deployment configuration
Registration itself does not start the container.
After registration, the repository appears in the dashboard as stopped and can be started from the UI.
Click:
Start
No GitHub push is necessary.
Cenfra:
1. Finds the registered repository
2. Resolves the current branch HEAD SHA
3. Sends repository_dispatch to Cenfra
4. GitHub Actions starts on the self-hosted runner
5. Docker builds the image
6. Docker Compose starts the application
7. Dashboard detects the live container state
The important detail is that the deployment targets the current branch HEAD at the time Start was pressed.
Once a repository is registered, Cenfra also installs a GitHub push webhook.
A push to the configured branch follows this path:
Git push
↓
GitHub webhook
↓
Cenfra /webhooks/github
↓
Signature verification
↓
Repository lookup
↓
repository_dispatch
↓
Cenfra deploy workflow
↓
Docker build + run
A push to another branch does not deploy if that branch is not the registered branch.
When a repository is running, click:
Stop
Cenfra stops the Docker Compose application on the self-hosted host.
The deployment registration remains intact.
The repository becomes:
Stopped
It can be started again later without re-registering.
Deregistration is intentionally stricter.
A running application cannot be deregistered.
The intended flow is:
Running
↓
Stop
↓
Stopped
↓
Deregister
Deregistration removes:
- The Cenfra deployment record
- The GitHub webhook created by Cenfra
- Cenfra's local deployment directory
- The Docker Compose deployment stack when present
After deregistration, the repository is no longer managed by Cenfra.
These are deliberately different concepts.
The port the application listens on inside the container.
Example:
DropSend → 5050
TestApp2 → 3000
The port exposed by the machine running Docker.
Example:
DropSend → 3001
TestApp2 → 3003
The resulting mapping is:
localhost:3001 → container:5050
localhost:3003 → container:3000
Two containers may use the same application port because they are isolated, but their host ports must be different on the same machine.
Cenfra currently allocates host ports from:
3001 - 3030
The allocation logic avoids ports already assigned to registered deployments.
To change the range, edit these constants in server.js:
const HOST_PORT_START = 3001;
const HOST_PORT_END = 3030;Restart Cenfra after changing them.
Cenfra stores repository registrations in:
data/deployments.json
Docker deployment files are stored under:
~/.cenfra/deployments/<repository-name>/
Cenfra uses a sanitized repository name for Docker/Compose resources.
For example:
ProElecttro/dropsend
becomes a deployment name similar to:
proelecttro-dropsend
and the container name is derived from that deployment name.
deployments.json is local state. Back it up if Cenfra's registrations need to survive machine loss or filesystem cleanup.
The backend exposes a small API used by the dashboard.
| Endpoint | Purpose |
|---|---|
GET /api/repos |
List GitHub repositories accessible to Cenfra |
GET /api/inspect |
Validate repository and inspect Dockerfile/port information |
GET /api/detect-port |
Detect the application port |
POST /api/register |
Register a repository and create its webhook |
GET /api/deployments |
Return registered deployments and live Docker state |
POST /api/deployments/:repository/start |
Start/deploy the current branch HEAD |
POST /api/deployments/:repository/stop |
Stop the running application |
DELETE /api/deployments/:repository |
Deregister a stopped repository |
POST /webhooks/github |
Receive GitHub webhook events |
GET /health |
Service health check |
Cenfra sits between GitHub and a machine with Docker access, so treat it as infrastructure software rather than a normal web demo.
Never commit:
.env
GITHUB_TOKEN
WEBHOOK_SECRET
HOSTING_GH_TOKEN
Add .env to .gitignore.
GitHub webhook requests are checked using WEBHOOK_SECRET and the X-Hub-Signature-256 header before Cenfra processes the event.
A self-hosted runner executes workflow code on a real machine. For public repositories, untrusted workflow changes can become a host-level security problem.
Keep the Cenfra deployment workflow under a repository and access model you trust, and be especially careful about executing arbitrary code from pull requests.
Use the narrowest GitHub permissions that satisfy the operations you actually need.
Check:
node server.jsThen open:
http://localhost:3100
If the page looks unstyled, verify that:
public/index.html
public/app.js
public/style.css
exist and that Express is serving public/.
Check:
GITHUB_TOKEN=...Then verify that the token can read the repositories you expect.
Restart Cenfra after changing .env.
Check the Cenfra GitHub Actions run.
Then inspect Docker on the runner:
docker ps -a
docker imagesAlso verify that the GitHub Actions runner is online and has the expected label:
runs-on: [self-hosted, cenfra-runner]Add an explicit line to the application's Dockerfile:
EXPOSE 3000Then use Fetch Port again.
If automatic detection still does not fit the application, enter the correct container port manually.
Check all four pieces:
1. Repository is registered
2. GitHub webhook exists
3. Public webhook URL is reachable
4. Cenfra can call repository_dispatch
Cenfra logs should show the incoming push and the resulting deployment trigger.
Check GitHub's repository webhook delivery history as well.
Quick Tunnel URLs can change.
Start a new tunnel:
cloudflared tunnel --url http://localhost:3100Update:
PUBLIC_WEBHOOK_URL=https://new-url.trycloudflare.comRestart Cenfra.
Repositories whose webhook URL points to the old tunnel may need to be re-registered or have their webhook updated.
For normal application development:
Code change
↓
git add .
git commit
git push
↓
GitHub
↓
Webhook
↓
Cenfra
↓
Central deploy workflow
↓
Self-hosted runner
↓
Docker rebuild
For a manual deployment without changing GitHub:
Dashboard → Start
For taking an application offline temporarily:
Dashboard → Stop
For removing Cenfra management completely:
Dashboard → Stop → Deregister
Suppose DropSend listens on container port 5050.
Cenfra may allocate host port 3001:
DropSend
Application port: 5050
Host port: 3001
http://localhost:3001
Docker mapping:
3001:5050
A GitHub push to the registered branch triggers a redeployment.
A dashboard Start deploys the current branch HEAD without requiring a new push.
Suppose TestApp2 listens on 3000.
Cenfra can assign another host port, for example 3003:
Application port: 3000
Host port: 3003
http://localhost:3003
Both applications can run simultaneously because their host ports are different:
localhost:3001 → DropSend → 5050
localhost:3003 → TestApp2 → 3000
Cenfra deliberately separates three states:
Registered
│
├── stopped
│
└── running
Registration answers:
Should Cenfra manage this repository?
Start answers:
Should its application be running now?
Stop answers:
Keep the registration, but take the application offline.
Deregister answers:
Remove this repository from Cenfra entirely.
This separation is what allows a project to be stopped and later started again without recreating its webhook or port allocation.
Cenfra's current architecture provides a foundation for adding things such as:
- Deployment history and rollback
- Build logs in the dashboard
- Health checks and automatic recovery
- Per-repository environment variables
- Custom domains
- HTTPS termination and reverse proxying
- Multiple deployment hosts
- Machine capacity awareness
- Deployment queues
- Versioned releases
- Zero-downtime replacement strategies
The important piece is already in place: the application repository does not need to own the deployment system. Cenfra does.
Add the license that applies to your Cenfra repository.