caprover-lite
v1.0.2
Published
A lightweight, zero-dependency Node.js webhook server for automated deployments.
Maintainers
Readme
CapRover Lite
A lightweight, zero-dependency Node.js webhook server for automated deployments. Think of it as a localized "poor man's CapRover" or a simple CI/CD receiver that executes shell commands upon receiving a webhook.
Features
- Zero External Dependencies: Uses only standard Node.js modules (
http,child_process,fs,path). - Hot Config Reload: Configuration is re-read on every request, allowing you to update projects without restarting the server.
- Multi-App Support: proper routing of webhooks to different project deployment scripts.
- Flexible: Define custom build and reload commands for each project.
Prerequisites
- Node.js (v14+ recommended)
- Git
- PM2 (optional, but recommended for process management)
Global Installation (Recommended)
# Install globally
npm install -g caprover-liteConfiguration
Create a configuration file named .caprover-lite.json in your home directory:
# Copy example to home directory
cp project.example.json ~/.caprover-lite.jsonThen edit ~/.caprover-lite.json to define your projects.
Usage
Simply run the command from anywhere:
caprover-liteManual Installation (Local Dev)
Clone the repository
git clone <your-repo-url> cd caprover-lite npm install npm link # Optional: to make 'caprover-lite' command available globally from sourceSetup Configuration
Create a
project.jsonfile in your deployment directory. You can copy the example:cp project.example.json project.jsonNote:
project.json(or.caprover-lite.json) is sensitive, so handle it with care.Edit Configuration Open
project.jsonand configure your projects:{ "port": 8000, "apps": [ { "name": "my-api-service", "path": "/path/to/local/repo", "branch": "main", "build": "git pull origin main && npm install && npm run build", "reload": "pm2 reload my-api-service" } ] }| Field | Description | | -------- | ----------------------------------------------------------- | |
port| Port for the webhook server to listen on. | |name| Unique identifier for the project (used in webhook URL). | |path| Absolute path to the project directory on the server. | |branch| The git branch to pull (default:main). | |build| Shell command(s) to run for building/updating the app. | |reload| Shell command(s) to restart/reload the application service. |
Usage
Starting the Server
Run in the directory containing your project.json:
caprover-liteOr if you haven't installed it globally:
npx caprover-liteSetting up Webhooks
Configure your Git provider (GitHub, GitLab, Bitbucket, etc.) to send a POST request to:
http://<your-server-ip>:8000/webhook?project=<project-name>Replace <project-name> with the name defined in your config file.
Alternative Payload Support:
If you cannot set query parameters, the server also attempts to parse the JSON body of the webhook to find a projectName or repository.name field.
Security Note
This tool does not currently implement authentication/secret validation for webhooks. It is recommended to:
- Run this service on a private network or restrict incoming IPs.
- Use a reverse proxy (Nginx/Apache) to handle SSL and basic auth if exposed publicly.
