Skip to content

Biogasbottle/odeploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ODeploy

Universal deployment toolkit for managing multiple projects on a single server with GitHub webhook support — built with TypeScript/Node.js.

ODeply automates system setup, PM2 process management, Nginx reverse proxy, SSL certificates, firewall configuration, and GitHub webhook auto-deployment — all driven by simple Bash-style config files.


Requirements

  • Ubuntu / Debian server (apt-based)
  • Node.js 18+ (installed automatically via nvm)
  • Git

Installation

Option A: Global install (recommended)

git clone <your-repo> odeploy && cd odeploy
./scripts/install.sh

This installs odeploy as a global CLI command. You can then use it anywhere.

Option B: Direct script

git clone <your-repo> odeploy && cd odeploy
# Use directly with node (after building)
node dist/cli.js <project> deploy

Quick Start

1. Configure

# Server-wide settings
cp system.example.sh config/system.sh
nano config/system.sh

# Your project
cp config/example.sh config/apps/your-app.sh
nano config/apps/your-app.sh

2. Install system dependencies

sudo odeploy system install

3. Deploy your project

sudo odeploy your-app deploy

Your application is live. Subsequent deploy commands pull the latest code, rebuild, and restart services automatically.


Adding a New Project

  1. Create a config file:
cp config/example.sh config/apps/your-new-app.sh
nano config/apps/your-new-app.sh
  1. Deploy:
sudo odeploy your-new-app deploy

ODeploy Commands

Per-project commands

Command Description
odeploy <app> deploy Deploy (auto-installs on first run)
odeploy <app> status Show PM2 + Nginx status
odeploy <app> logs Tail PM2 logs
odeploy <app> logs --service web Logs for specific service
odeploy <app> restart Restart PM2 services
odeploy <app> stop Stop all services
odeploy <app> rollback Restore previous backup
odeploy <app> clean Remove project (destructive)

System commands

Command Description
sudo odeploy system install Install system dependencies
sudo odeploy system webhook Install/configure webhook server
odeploy list List all configured projects

Project Configuration

Each project has its own config file in config/apps/<name>.sh:

PROJECT_NAME="myapp"
INSTALL_DIR="/home/deployer/apps/myapp"
GIT_REPO="git@github.com:your-org/your-repo.git"
GIT_BRANCH="main"
RUNTIME="node"           # node | python | go | rust | custom
PKG_MANAGER="pnpm"       # pnpm | npm | yarn
BUILD_CMD=""             # e.g. "pnpm build"
START_CMD="pnpm start"   # required

SERVICES='[
  {"name": "web", "port": 3000, "domain": "example.com", "extra_domains": ["www.example.com"]}
]'

declare -A ENV_VARS
ENV_VARS["NODE_ENV"]="production"
ENV_VARS["DATABASE_URL"]="postgresql://..."

Webhook Auto-Deploy

When system webhook is installed, you can trigger deployments via HTTP:

# Deploy a project
curl -X POST https://deploy.example.com/deploy/myapp \
  -H "X-Hub-Signature-256: sha256=<your-secret>"

Set up GitHub webhooks pointing to https://deploy.example.com/deploy/<project-name>.


Architecture

odeploy (TypeScript CLI)
├── src/cli.ts              # Commander-based entry point
├── src/commands/            # Per-project commands
│   ├── deploy.ts           # First-time + update deploy
│   ├── status.ts           # PM2 + Nginx status
│   ├── logs.ts             # Log tailing
│   ├── restart.ts          # Process restart
│   ├── stop.ts             # Process stop
│   ├── rollback.ts         # Backup restore
│   ├── clean.ts            # Project removal
│   ├── system-install.ts   # System setup
│   └── system-webhook.ts   # Webhook server install
├── src/lib/                # Core libraries
│   ├── shell.ts            # Shell exec + logging
│   ├── config/loader.ts    # Bash config parser
│   ├── nginx.ts            # Nginx config generation
│   ├── pm2.ts              # PM2 process management
│   ├── git.ts              # Git operations
│   ├── build.ts            # Build + dependency install
│   └── firewall.ts         # UFW management
└── src/webhook/server.ts   # Express webhook server

Tech Stack

  • CLI: TypeScript + Node.js + Commander
  • Webhook: Express.js
  • Process Manager: PM2
  • Reverse Proxy: Nginx
  • SSL: Let's Encrypt (Certbot)
  • Firewall: UFW

About

Universal deployment toolkit for managing multiple projects on a single server with GitHub webhook support

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors