@akash-chowdhury-24/deployhub 1.0.16 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +264 -59
- package/package.json +4 -3
- package/src/commands/doctor.js +168 -170
- package/src/commands/init.js +80 -371
- package/src/commands/rollback.js +1 -1
- package/src/core/config.js +17 -13
- package/src/core/stages.js +0 -11
- package/src/deployment/deployment-env.js +625 -0
- package/src/deployment/index.js +0 -72
- package/src/deployment/init-helpers.js +389 -0
- package/src/deployment/init-prompts.js +432 -0
- package/src/deployment/providers/azure-vm.js +85 -2
- package/src/deployment/providers/docker.js +101 -8
- package/src/deployment/providers/ec2.js +88 -2
- package/src/deployment/providers/gcp-vm.js +89 -2
- package/src/deployment/providers/kubernetes.js +104 -7
- package/src/deployment/providers/ssh.js +21 -4
- package/src/utils/github-actions.js +28 -131
- package/src/utils/rollback/engine.js +69 -0
- package/src/deployment/providers/platforms/_shared.js +0 -167
- package/src/deployment/providers/platforms/aws-amplify.js +0 -367
- package/src/deployment/providers/platforms/azure-static-web-apps.js +0 -68
- package/src/deployment/providers/platforms/cloudflare-pages.js +0 -103
- package/src/deployment/providers/platforms/firebase-app-hosting.js +0 -95
- package/src/deployment/providers/platforms/firebase-hosting.js +0 -99
- package/src/deployment/providers/platforms/index.js +0 -44
- package/src/deployment/providers/platforms/netlify.js +0 -102
- package/src/deployment/providers/platforms/vercel.js +0 -92
- package/src/rollback/engine.js +0 -102
- package/src/utils/firebase-config-generator.js +0 -35
- package/src/utils/init-platform.js +0 -236
- package/src/utils/platform-env.js +0 -132
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Zero-configuration deployment and artifact manager for Node.js projects. When you push to GitHub, DeployHub automatically detects your project type, builds it, creates a versioned artifact, uploads to cloud storage, and optionally deploys to your server.
|
|
4
4
|
|
|
5
|
+
**Supported deployment targets:** SSH, Docker, EC2, Azure VM, GCP VM, and Kubernetes — self-hosted and cloud VM only.
|
|
6
|
+
|
|
7
|
+
DeployHub no longer integrates with managed platforms like Vercel or Netlify — those tools already offer superior native git-push deployment. DeployHub instead focuses on artifact-first backups and self-hosted/server deployment, where no equivalent native solution exists.
|
|
8
|
+
|
|
5
9
|
## Installation
|
|
6
10
|
|
|
7
11
|
DeployHub can be installed via **npm** (requires Node.js 18+) or as a **standalone binary** (no Node.js required).
|
|
@@ -80,7 +84,7 @@ This interactive wizard will:
|
|
|
80
84
|
- Detect your framework (React, Vue, Next.js, Node, Python, etc.)
|
|
81
85
|
- Configure build commands and output directory
|
|
82
86
|
- Set up storage providers (AWS, Google Drive, Azure, GCP, Dropbox, Local)
|
|
83
|
-
- Optionally configure deployment targets (SSH, Docker, EC2,
|
|
87
|
+
- Optionally configure deployment targets (SSH, Docker, EC2, Azure VM, GCP VM, Kubernetes)
|
|
84
88
|
- Generate `deployhub.config.json`
|
|
85
89
|
- Generate `.github/workflows/deployhub.yml`
|
|
86
90
|
- Generate `.env.example`
|
|
@@ -132,7 +136,7 @@ When you run `deployhub build` (locally or in GitHub Actions), DeployHub runs th
|
|
|
132
136
|
| **verify** | Hit your health-check URL — **only if configured** |
|
|
133
137
|
| **notify** | Slack / email / webhook — **only if enabled** |
|
|
134
138
|
|
|
135
|
-
**Storage only** means you answer **No** to *Configure deployment?* during `init`. You still get builds and cloud backups; nothing is pushed to a server
|
|
139
|
+
**Storage only** means you answer **No** to *Configure deployment?* during `init`. You still get builds and cloud backups; nothing is pushed to a server.
|
|
136
140
|
|
|
137
141
|
**Storage + deployment** means you answer **Yes**, pick targets, and add the matching secrets. Deploy always runs **after** storage upload succeeds.
|
|
138
142
|
|
|
@@ -181,7 +185,6 @@ The wizard asks the same core questions for every setup:
|
|
|
181
185
|
- `.github/workflows/deployhub.yml` — CI pipeline
|
|
182
186
|
- `.env.example` — list of env vars you may need
|
|
183
187
|
- `nginx.conf` — auto-generated if frontend deploys to SSH
|
|
184
|
-
- `firebase.json` — auto-generated if you pick Firebase Hosting
|
|
185
188
|
|
|
186
189
|
---
|
|
187
190
|
|
|
@@ -301,53 +304,39 @@ If **Yes** to deployment:
|
|
|
301
304
|
|
|
302
305
|
| Prompt | Options |
|
|
303
306
|
|--------|---------|
|
|
304
|
-
|
|
|
307
|
+
| Deployment type | **ssh**, docker, ec2, azure-vm, gcp-vm, kubernetes |
|
|
308
|
+
| Host, user, deploy path | SSH credentials and remote directory |
|
|
305
309
|
|
|
306
|
-
####
|
|
310
|
+
#### Self-hosted server (SSH, Docker, EC2, …)
|
|
307
311
|
|
|
308
|
-
Best
|
|
312
|
+
Best when you serve static files from your own VPS or cloud VM. DeployHub uploads the built `dist/` (or your output dir) over SSH and can generate `nginx.conf`.
|
|
309
313
|
|
|
310
|
-
|
|
|
311
|
-
|
|
312
|
-
|
|
|
313
|
-
|
|
|
314
|
-
|
|
|
315
|
-
|
|
|
316
|
-
|
|
|
317
|
-
| Firebase Hosting | SPAs | `FIREBASE_TOKEN`, `FIREBASE_PROJECT_ID` |
|
|
318
|
-
| Firebase App Hosting | Next.js / Angular SSR | `FIREBASE_TOKEN`, `FIREBASE_PROJECT_ID`, `FIREBASE_APP_HOSTING_BACKEND` |
|
|
314
|
+
| Deploy type | You provide |
|
|
315
|
+
|-------------|-------------|
|
|
316
|
+
| **ssh** | `SSH_HOST`, `SSH_USER`, `SSH_KEY`, deploy path |
|
|
317
|
+
| **docker** | Docker host access / image registry per your setup |
|
|
318
|
+
| **ec2** | SSH credentials to EC2 instance |
|
|
319
|
+
| **azure-vm** / **gcp-vm** | SSH to VM |
|
|
320
|
+
| **kubernetes** | Cluster credentials (via env / kubeconfig) |
|
|
319
321
|
|
|
320
|
-
**Example: Vue → Google Drive +
|
|
322
|
+
**Example: Vue → Google Drive + SSH**
|
|
321
323
|
|
|
322
324
|
```bash
|
|
323
325
|
deployhub init
|
|
324
326
|
# Frontend only → Vue
|
|
325
327
|
# Storage: Local + Google Drive
|
|
326
|
-
# Configure deployment? Yes
|
|
327
|
-
#
|
|
328
|
-
# Site ID: (from Netlify dashboard)
|
|
328
|
+
# Configure deployment? Yes → ssh
|
|
329
|
+
# Host, user, deploy path: /var/www/my-app
|
|
329
330
|
```
|
|
330
331
|
|
|
331
332
|
```bash
|
|
332
333
|
cp .env.example .env
|
|
333
|
-
# GDRIVE_* and
|
|
334
|
+
# GDRIVE_* and SSH_HOST, SSH_USER, SSH_KEY
|
|
334
335
|
|
|
335
336
|
deployhub doctor
|
|
336
337
|
git push origin main
|
|
337
338
|
```
|
|
338
339
|
|
|
339
|
-
#### Option B — Self-hosted server (SSH, Docker, EC2, …)
|
|
340
|
-
|
|
341
|
-
Best when you serve static files from your own VPS. DeployHub uploads the built `dist/` (or your output dir) over SSH and can generate `nginx.conf`.
|
|
342
|
-
|
|
343
|
-
| Deploy type | You provide |
|
|
344
|
-
|-------------|-------------|
|
|
345
|
-
| **ssh** | `SSH_HOST`, `SSH_USER`, `SSH_KEY`, deploy path |
|
|
346
|
-
| **docker** | Docker host access / image registry per your setup |
|
|
347
|
-
| **ec2** | SSH credentials to EC2 instance |
|
|
348
|
-
| **azure-vm** / **gcp-vm** | SSH to VM |
|
|
349
|
-
| **kubernetes** | Cluster credentials (via env / kubeconfig) |
|
|
350
|
-
|
|
351
340
|
**Example: Angular → Azure Blob + SSH**
|
|
352
341
|
|
|
353
342
|
```bash
|
|
@@ -368,7 +357,7 @@ Add `AZURE_*`, `SSH_HOST`, `SSH_USER`, `SSH_KEY` to `.env` and GitHub Secrets. R
|
|
|
368
357
|
| React | `npm run build` | `dist` or `build` | Create React App uses `build` |
|
|
369
358
|
| Vue | `npm run build` | `dist` | Vite default |
|
|
370
359
|
| Angular | `ng build` | `dist` | |
|
|
371
|
-
| Next.js | `npm run build` | `.next` |
|
|
360
|
+
| Next.js | `npm run build` | `.next` | Use Vercel/Netlify native deploy for managed hosting |
|
|
372
361
|
| Svelte | `npm run build` | `public` | |
|
|
373
362
|
| Astro | `astro build` | `dist` | |
|
|
374
363
|
| Vanilla JS | *(none)* | `.` | Copies static files as-is |
|
|
@@ -377,7 +366,7 @@ Add `AZURE_*`, `SSH_HOST`, `SSH_USER`, `SSH_KEY` to `.env` and GitHub Secrets. R
|
|
|
377
366
|
|
|
378
367
|
## Walkthrough: Backend only
|
|
379
368
|
|
|
380
|
-
Backends always deploy to a **self-hosted target** (SSH, Docker, EC2, Azure VM, GCP VM, or Kubernetes).
|
|
369
|
+
Backends always deploy to a **self-hosted target** (SSH, Docker, EC2, Azure VM, GCP VM, or Kubernetes).
|
|
381
370
|
|
|
382
371
|
### Init choices
|
|
383
372
|
|
|
@@ -453,10 +442,10 @@ Choose **Both (monorepo / fullstack)** when frontend and backend live in the **s
|
|
|
453
442
|
2. **Backend** — framework, start command, port.
|
|
454
443
|
3. **Storage** — one or more providers.
|
|
455
444
|
4. **Configure deployment?** → Yes.
|
|
456
|
-
5. **Frontend deploy
|
|
457
|
-
6. **Backend deploy** —
|
|
445
|
+
5. **Frontend deploy path** — self-hosted SSH (static files + nginx).
|
|
446
|
+
6. **Backend deploy** — SSH, Docker, EC2, etc.
|
|
458
447
|
|
|
459
|
-
DeployHub runs **both** builds, packs them into one artifact, uploads once, then deploys frontend and backend to their respective targets.
|
|
448
|
+
DeployHub runs **both** builds, packs them into one artifact, uploads once, then deploys frontend and backend to their respective server targets.
|
|
460
449
|
|
|
461
450
|
### Example: React + Express monorepo
|
|
462
451
|
|
|
@@ -467,11 +456,11 @@ deployhub init
|
|
|
467
456
|
# Backend: Express, npm start, port 3000
|
|
468
457
|
# Storage: AWS S3 + Local
|
|
469
458
|
# Configure deployment? Yes
|
|
470
|
-
# Frontend:
|
|
459
|
+
# Frontend: ssh → /var/www/my-app/public
|
|
471
460
|
# Backend: ssh → api.example.com, path /var/www/my-app/api, PM2 name my-app-api
|
|
472
461
|
```
|
|
473
462
|
|
|
474
|
-
**Secrets:** AWS + `
|
|
463
|
+
**Secrets:** AWS + `SSH_*`
|
|
475
464
|
|
|
476
465
|
**Layout tip:** Keep `package.json` scripts for both apps at the repo root, or ensure build commands point to the correct paths (edit `deployhub.config.json` after init if your monorepo uses subfolders).
|
|
477
466
|
|
|
@@ -489,7 +478,7 @@ DeployHub generates `nginx.conf` to serve static files and proxy API requests.
|
|
|
489
478
|
|
|
490
479
|
### Example: Next.js API routes only
|
|
491
480
|
|
|
492
|
-
Use **Frontend only** with **Next.js** and deploy
|
|
481
|
+
Use **Frontend only** with **Next.js** and deploy via **SSH** or your platform's native git-push workflow — no separate backend entry needed.
|
|
493
482
|
|
|
494
483
|
---
|
|
495
484
|
|
|
@@ -585,9 +574,9 @@ You can enable **multiple providers** — DeployHub uploads to all of them in pa
|
|
|
585
574
|
|
|
586
575
|
| Project type | Frontend deploy options | Backend deploy options |
|
|
587
576
|
|--------------|-------------------------|------------------------|
|
|
588
|
-
| Frontend only |
|
|
577
|
+
| Frontend only | SSH/Docker/EC2/Azure VM/GCP VM/K8s | — |
|
|
589
578
|
| Backend only | — | SSH/Docker/EC2/Azure VM/GCP VM/K8s |
|
|
590
|
-
| Full stack |
|
|
579
|
+
| Full stack | SSH (static + nginx) | SSH/Docker/EC2/K8s (always) |
|
|
591
580
|
|
|
592
581
|
| Mode | Storage | Deploy | When to use |
|
|
593
582
|
|------|---------|--------|-------------|
|
|
@@ -596,6 +585,207 @@ You can enable **multiple providers** — DeployHub uploads to all of them in pa
|
|
|
596
585
|
|
|
597
586
|
---
|
|
598
587
|
|
|
588
|
+
## Choosing a deployment method
|
|
589
|
+
|
|
590
|
+
DeployHub supports six deployment targets. Pick based on what infrastructure you already have — DeployHub does not provision servers, VMs, or clusters for you.
|
|
591
|
+
|
|
592
|
+
| Method | Best for | You need already |
|
|
593
|
+
|--------|----------|------------------|
|
|
594
|
+
| **ssh** | Any Linux VPS or bare-metal server you control | Server with SSH, key pair, app runtime |
|
|
595
|
+
| **docker** | Containerized apps (Dockerfile or docker-compose.yml) | Docker locally or on a remote host |
|
|
596
|
+
| **ec2** | AWS users with an existing EC2 instance | Running EC2 instance, security group, key pair |
|
|
597
|
+
| **azure-vm** | Azure users with an existing virtual machine | Running Azure VM, NSG allowing SSH |
|
|
598
|
+
| **gcp-vm** | GCP users with an existing Compute Engine VM | Running VM, firewall rule for SSH, metadata SSH key |
|
|
599
|
+
| **kubernetes** | Teams with an existing K8s cluster | Cluster, kubectl access, manifests in repo |
|
|
600
|
+
|
|
601
|
+
---
|
|
602
|
+
|
|
603
|
+
## Deployment method guides
|
|
604
|
+
|
|
605
|
+
Each method below follows the same structure: **prerequisites** (before `deployhub init`), **what DeployHub automates**, **after init** (matches terminal output), and a **variable reference**.
|
|
606
|
+
|
|
607
|
+
### SSH
|
|
608
|
+
|
|
609
|
+
**Prerequisites (before `deployhub init`):**
|
|
610
|
+
- [ ] A Linux server with SSH enabled
|
|
611
|
+
- [ ] Private SSH key file (.pem/.key) and public key in `authorized_keys`
|
|
612
|
+
- [ ] Port 22 open in firewall for your IP
|
|
613
|
+
- [ ] App runtime on server (Node.js, Python, etc.) for backends
|
|
614
|
+
|
|
615
|
+
**What DeployHub automates:**
|
|
616
|
+
- Complete `.env.example` with commented variables
|
|
617
|
+
- SSH key permission check (offers to `chmod 600`)
|
|
618
|
+
- SSH connectivity test during `init`
|
|
619
|
+
- Artifact upload, extract, app restart (PM2, gunicorn, etc.)
|
|
620
|
+
|
|
621
|
+
**After `init`:**
|
|
622
|
+
1. Ensure port 22 is open in your server firewall
|
|
623
|
+
2. Copy `.env.example` → `.env`; set `SSH_HOST`, `SSH_USER`, `SSH_KEY_PATH`
|
|
624
|
+
3. Add GitHub Secrets: `SSH_HOST`, `SSH_USER`, `SSH_KEY` (paste private key for CI)
|
|
625
|
+
4. Run `deployhub doctor`
|
|
626
|
+
5. `git push origin main`
|
|
627
|
+
|
|
628
|
+
| Variable | Description | Example | Where to get it |
|
|
629
|
+
|----------|-------------|---------|-----------------|
|
|
630
|
+
| `SSH_HOST` | Server IP or hostname | `203.0.113.10` | Your hosting provider dashboard |
|
|
631
|
+
| `SSH_USER` | SSH login user | `ubuntu` | AMI/image docs (Ubuntu→ubuntu, Amazon Linux→ec2-user) |
|
|
632
|
+
| `SSH_KEY_PATH` | Path to private key file | `~/.ssh/my-key.pem` | Downloaded when server was created |
|
|
633
|
+
| `SSH_SSH_PORT` | SSH port (optional) | `22` | Server SSH config |
|
|
634
|
+
| `SSH_DEPLOY_PATH` | Remote deploy directory | `/var/www/my-app` | Your server layout |
|
|
635
|
+
| `SSH_APP_NAME` | PM2 process name (backend) | `my-api` | Your choice |
|
|
636
|
+
| `SSH_PORT` | App listen port (backend) | `3000` | Your app config |
|
|
637
|
+
| `SSH_KEY` | Private key contents (CI only) | `-----BEGIN...` | Same key as `SSH_KEY_PATH` |
|
|
638
|
+
|
|
639
|
+
### Docker
|
|
640
|
+
|
|
641
|
+
**Prerequisites:**
|
|
642
|
+
- [ ] Docker installed (`docker --version` works)
|
|
643
|
+
- [ ] `Dockerfile` or `docker-compose.yml` in project
|
|
644
|
+
- [ ] Registry account if pushing private images
|
|
645
|
+
|
|
646
|
+
**What DeployHub automates:**
|
|
647
|
+
- `.env.example` for image name, registry, remote `DOCKER_HOST`
|
|
648
|
+
- Docker daemon connectivity test during `init`
|
|
649
|
+
- `docker compose up` or build/push/run during deploy
|
|
650
|
+
|
|
651
|
+
**After `init`:**
|
|
652
|
+
1. Set `DOCKER_IMAGE_NAME` in `.env`
|
|
653
|
+
2. For private registries: set `DOCKER_REGISTRY_USERNAME` and `DOCKER_REGISTRY_TOKEN`
|
|
654
|
+
3. For remote Docker: set `DOCKER_HOST` (e.g. `ssh://ubuntu@203.0.113.10`)
|
|
655
|
+
4. Run `deployhub doctor`, then `git push origin main`
|
|
656
|
+
|
|
657
|
+
| Variable | Description | Example | Where to get it |
|
|
658
|
+
|----------|-------------|---------|-----------------|
|
|
659
|
+
| `DOCKER_IMAGE_NAME` | Image repository path | `myorg/myapp` | Your registry naming |
|
|
660
|
+
| `DOCKER_IMAGE_TAG` | Image tag | `latest` | Version or `latest` |
|
|
661
|
+
| `DOCKER_REGISTRY_URL` | Registry URL (optional) | `https://ghcr.io` | Registry docs |
|
|
662
|
+
| `DOCKER_REGISTRY_USERNAME` | Registry user | `myuser` | Registry account |
|
|
663
|
+
| `DOCKER_REGISTRY_TOKEN` | Registry password/token | *(secret)* | Docker Hub / GHCR PAT |
|
|
664
|
+
| `DOCKER_HOST` | Remote daemon (optional) | `ssh://ubuntu@host` | Remote Docker setup |
|
|
665
|
+
|
|
666
|
+
### AWS EC2
|
|
667
|
+
|
|
668
|
+
**Prerequisites:**
|
|
669
|
+
- [ ] EC2 instance launched in AWS Console (DeployHub does not create it)
|
|
670
|
+
- [ ] Key pair `.pem` downloaded at launch
|
|
671
|
+
- [ ] Security group: inbound SSH (22) from your IP
|
|
672
|
+
- [ ] App runtime on instance for backends
|
|
673
|
+
|
|
674
|
+
**What DeployHub automates:**
|
|
675
|
+
- EC2-specific `.env.example` (SSH + optional AWS API vars)
|
|
676
|
+
- SSH key validation and connectivity test
|
|
677
|
+
- OS user suggestion from AMI hint (ubuntu, ec2-user)
|
|
678
|
+
- Optional public IP lookup via `EC2_INSTANCE_ID` + AWS CLI
|
|
679
|
+
|
|
680
|
+
**After `init`:**
|
|
681
|
+
1. AWS Console → EC2 → Security Groups → Inbound rules → SSH port 22 from My IP
|
|
682
|
+
2. Copy `.env.example` → `.env`; set `SSH_KEY_PATH`, `SSH_HOST` (or `EC2_INSTANCE_ID` + AWS creds)
|
|
683
|
+
3. GitHub Secrets: `SSH_HOST`, `SSH_USER`, `SSH_KEY`, plus `AWS_*` if using instance ID lookup
|
|
684
|
+
4. Run `deployhub doctor`, then `git push origin main`
|
|
685
|
+
|
|
686
|
+
| Variable | Description | Example | Where to get it |
|
|
687
|
+
|----------|-------------|---------|-----------------|
|
|
688
|
+
| `SSH_HOST` | Instance public IP/DNS | `54.123.45.67` | EC2 Console → Instances |
|
|
689
|
+
| `SSH_USER` | SSH user for AMI | `ec2-user` | AMI documentation |
|
|
690
|
+
| `SSH_KEY_PATH` | Path to .pem key | `~/.ssh/ec2-key.pem` | Downloaded at instance launch |
|
|
691
|
+
| `EC2_INSTANCE_ID` | Instance ID (optional) | `i-0abc123...` | EC2 Console |
|
|
692
|
+
| `AWS_ACCESS_KEY_ID` | AWS key for API lookup | `AKIA...` | IAM → Users → Security credentials |
|
|
693
|
+
| `AWS_SECRET_ACCESS_KEY` | AWS secret | *(secret)* | Same as above |
|
|
694
|
+
| `AWS_REGION` | Instance region | `us-east-1` | EC2 Console top bar |
|
|
695
|
+
|
|
696
|
+
### Azure VM
|
|
697
|
+
|
|
698
|
+
**Prerequisites:**
|
|
699
|
+
- [ ] Azure VM created in Portal (DeployHub does not provision it)
|
|
700
|
+
- [ ] NSG rule allowing inbound SSH (port 22)
|
|
701
|
+
- [ ] SSH public key on the VM
|
|
702
|
+
- [ ] App runtime for backends
|
|
703
|
+
|
|
704
|
+
**What DeployHub automates:**
|
|
705
|
+
- Azure VM `.env.example` with SSH + optional Azure API vars
|
|
706
|
+
- Auto-detects subscription ID via `az` CLI if logged in
|
|
707
|
+
- SSH key validation and connectivity test
|
|
708
|
+
|
|
709
|
+
**After `init`:**
|
|
710
|
+
1. Azure Portal → VM → Networking → allow SSH (22) from your IP
|
|
711
|
+
2. Copy `.env.example` → `.env`; set `SSH_HOST`, `SSH_USER`, `SSH_KEY_PATH`
|
|
712
|
+
3. For CI: add `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET` as GitHub Secrets
|
|
713
|
+
4. Run `deployhub doctor`, then `git push origin main`
|
|
714
|
+
|
|
715
|
+
| Variable | Description | Example | Where to get it |
|
|
716
|
+
|----------|-------------|---------|-----------------|
|
|
717
|
+
| `SSH_HOST` | VM public IP | `20.1.2.3` | Azure Portal → VM overview |
|
|
718
|
+
| `SSH_USER` | SSH username | `azureuser` | Chosen at VM creation |
|
|
719
|
+
| `SSH_KEY_PATH` | Private key path | `~/.ssh/azure.pem` | Your key file |
|
|
720
|
+
| `AZURE_SUBSCRIPTION_ID` | Subscription (optional) | `uuid` | `az account show` |
|
|
721
|
+
| `AZURE_RESOURCE_GROUP` | Resource group | `my-app-rg` | Portal → Resource groups |
|
|
722
|
+
| `AZURE_VM_NAME` | VM name | `my-vm` | Portal → Virtual machines |
|
|
723
|
+
|
|
724
|
+
### GCP VM
|
|
725
|
+
|
|
726
|
+
**Prerequisites:**
|
|
727
|
+
- [ ] Compute Engine VM created (DeployHub does not create it)
|
|
728
|
+
- [ ] Firewall rule allowing `tcp:22` (default `default-allow-ssh` may exist)
|
|
729
|
+
- [ ] SSH public key in **Metadata → SSH Keys** (GCP uses metadata keys, not launch key pairs like AWS)
|
|
730
|
+
- [ ] App runtime for backends
|
|
731
|
+
|
|
732
|
+
**What DeployHub automates:**
|
|
733
|
+
- GCP VM `.env.example` with SSH + optional GCP API vars
|
|
734
|
+
- Auto-detects project ID via `gcloud` if authenticated
|
|
735
|
+
- SSH key validation and connectivity test
|
|
736
|
+
|
|
737
|
+
**After `init`:**
|
|
738
|
+
1. GCP Console → VPC → Firewall → ensure SSH (tcp:22) allowed from your IP
|
|
739
|
+
2. Add SSH public key: Console → Compute Engine → Metadata → SSH Keys
|
|
740
|
+
3. Copy `.env.example` → `.env`; set `SSH_HOST`, `SSH_USER`, `SSH_KEY_PATH`
|
|
741
|
+
4. Run `deployhub doctor`, then `git push origin main`
|
|
742
|
+
|
|
743
|
+
| Variable | Description | Example | Where to get it |
|
|
744
|
+
|----------|-------------|---------|-----------------|
|
|
745
|
+
| `SSH_HOST` | External IP | `34.56.78.90` | Compute Engine → VM instances |
|
|
746
|
+
| `SSH_USER` | SSH username | `your_google_username` | GCP OS Login or metadata |
|
|
747
|
+
| `SSH_KEY_PATH` | Private key path | `~/.ssh/gcp-key` | Your local key pair |
|
|
748
|
+
| `SSH_SSH_PORT` | SSH connection port (optional) | `22` | Server SSH config |
|
|
749
|
+
| `SSH_DEPLOY_PATH` | Remote deploy directory (optional) | `/var/www/my-app` | Your server layout |
|
|
750
|
+
| `SSH_APP_NAME` | PM2 process name (backend) | `my-api` | Your choice |
|
|
751
|
+
| `SSH_PORT` | App listen port (backend) | `3000` | Your app config |
|
|
752
|
+
| `SSH_KEY` | Private key contents (CI only) | `-----BEGIN...` | Same key as `SSH_KEY_PATH` |
|
|
753
|
+
| `GCP_PROJECT_ID` | Project ID (optional) | `my-project-123` | `gcloud config get-value project` |
|
|
754
|
+
| `GCP_ZONE` | VM zone (optional) | `us-central1-a` | VM instance details |
|
|
755
|
+
| `GCP_INSTANCE_NAME` | Instance name (optional) | `my-vm` | Compute Engine list |
|
|
756
|
+
| `GCP_KEY_FILE` | Service account JSON (optional, CI) | `/path/to/key.json` | IAM → Service Accounts → Keys |
|
|
757
|
+
|
|
758
|
+
### Kubernetes
|
|
759
|
+
|
|
760
|
+
**Prerequisites:**
|
|
761
|
+
- [ ] Existing Kubernetes cluster (DeployHub does not provision clusters)
|
|
762
|
+
- [ ] `kubectl` installed and configured
|
|
763
|
+
- [ ] Kubernetes manifests (`.yaml` or `k8s/` directory) in your repo
|
|
764
|
+
- [ ] Cluster reachable from CI (kubeconfig secret or cloud auth)
|
|
765
|
+
|
|
766
|
+
**What DeployHub automates:**
|
|
767
|
+
- Lists `kubectl` contexts during `init` for easy selection
|
|
768
|
+
- Auto-detects `~/.kube/config`
|
|
769
|
+
- Complete `.env.example` for kubeconfig, context, namespace
|
|
770
|
+
- Cluster connectivity test during `init`
|
|
771
|
+
|
|
772
|
+
**After `init`:**
|
|
773
|
+
1. Verify context: `kubectl config get-contexts`
|
|
774
|
+
2. Create namespace if needed: `kubectl create namespace my-app`
|
|
775
|
+
3. For private registries: create `imagePullSecret` and set `KUBE_IMAGE_PULL_SECRET`
|
|
776
|
+
4. Copy `.env.example` → `.env`; add kubeconfig/auth to GitHub Secrets for CI
|
|
777
|
+
5. Run `deployhub doctor`, then `git push origin main`
|
|
778
|
+
|
|
779
|
+
| Variable | Description | Example | Where to get it |
|
|
780
|
+
|----------|-------------|---------|-----------------|
|
|
781
|
+
| `KUBECONFIG` | Path to kubeconfig | `~/.kube/config` | Default kubectl config |
|
|
782
|
+
| `KUBE_CONTEXT` | Context name | `my-cluster` | `kubectl config get-contexts` |
|
|
783
|
+
| `KUBE_NAMESPACE` | Target namespace | `my-app` | `kubectl get namespaces` |
|
|
784
|
+
| `DOCKER_IMAGE_NAME` | Container image | `ghcr.io/org/app` | Your registry |
|
|
785
|
+
| `KUBE_IMAGE_PULL_SECRET` | Pull secret name | `regcred` | `kubectl create secret docker-registry` |
|
|
786
|
+
|
|
787
|
+
---
|
|
788
|
+
|
|
599
789
|
## Minimal `deployhub.config.json` examples
|
|
600
790
|
|
|
601
791
|
### Storage only — React
|
|
@@ -651,10 +841,9 @@ Prefer `deployhub init` over hand-writing config — it sets adapters, workflow,
|
|
|
651
841
|
|---------|-----|
|
|
652
842
|
| `Deploy requires storage upload` | Add at least one storage provider in config |
|
|
653
843
|
| AWS / GDrive check fails in `doctor` | Run `deployhub storage add <provider>` and match GitHub Secrets |
|
|
654
|
-
| SSH deploy fails | Verify `
|
|
844
|
+
| SSH deploy fails | Verify `SSH_KEY_PATH` points to your private `.pem` file (or `SSH_KEY` in CI); user can write to deploy path; port 22 open |
|
|
655
845
|
| Wrong output uploaded | Fix `buildOutput` in config (`dist` vs `build` vs `.next`) |
|
|
656
846
|
| Tests fail in CI | Set `"pipeline": { "test": false }` temporarily, or fix tests |
|
|
657
|
-
| Platform deploy missing CLI | Install platform CLI in CI (workflow does this for Vercel, Netlify, etc.) |
|
|
658
847
|
| Monorepo subfolders | Edit `buildCommand` paths in `deployhub.config.json` after init |
|
|
659
848
|
|
|
660
849
|
Run `deployhub doctor` after any config change.
|
|
@@ -704,28 +893,25 @@ Add these secrets in your repository (Settings → Secrets and variables → Act
|
|
|
704
893
|
| `DROPBOX_ACCESS_TOKEN` | Dropbox |
|
|
705
894
|
| `FTP_HOST`, `FTP_USER`, `FTP_PASSWORD` | FTP storage |
|
|
706
895
|
|
|
707
|
-
### Server deployment (SSH, EC2, VMs)
|
|
896
|
+
### Server deployment (SSH, EC2, VMs, Docker, Kubernetes)
|
|
708
897
|
|
|
709
898
|
| Secret | Used for |
|
|
710
899
|
|--------|----------|
|
|
711
|
-
| `SSH_HOST` | Target server hostname |
|
|
900
|
+
| `SSH_HOST` | Target server hostname or IP |
|
|
712
901
|
| `SSH_USER` | SSH username |
|
|
713
|
-
| `
|
|
902
|
+
| `SSH_KEY_PATH` | Local path to private key (`.env` only) |
|
|
903
|
+
| `SSH_KEY` | Private key contents (GitHub Actions / CI) |
|
|
904
|
+
| `SSH_SSH_PORT` | SSH connection port (default 22) |
|
|
714
905
|
| `SSH_DEPLOY_PATH` | Remote directory (optional if set in config) |
|
|
715
906
|
| `SSH_APP_NAME` | PM2 process name for backends |
|
|
716
|
-
| `SSH_PORT` | App port on server (
|
|
907
|
+
| `SSH_PORT` | App port on server (backend) |
|
|
908
|
+
| `EC2_INSTANCE_ID`, `AWS_*` | Optional EC2 dynamic IP lookup |
|
|
909
|
+
| `AZURE_SUBSCRIPTION_ID`, `AZURE_RESOURCE_GROUP`, `AZURE_VM_NAME` | Optional Azure VM IP lookup |
|
|
910
|
+
| `GCP_PROJECT_ID`, `GCP_ZONE`, `GCP_INSTANCE_NAME`, `GCP_KEY_FILE` | Optional GCP VM IP lookup |
|
|
911
|
+
| `DOCKER_IMAGE_NAME`, `DOCKER_REGISTRY_*`, `DOCKER_HOST` | Docker deployment |
|
|
912
|
+
| `KUBECONFIG`, `KUBE_CONTEXT`, `KUBE_NAMESPACE` | Kubernetes deployment |
|
|
717
913
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
| Secret | Platform |
|
|
721
|
-
|--------|----------|
|
|
722
|
-
| `VERCEL_TOKEN`, `VERCEL_ORG_ID`, `VERCEL_PROJECT_ID` | Vercel |
|
|
723
|
-
| `NETLIFY_AUTH_TOKEN`, `NETLIFY_SITE_ID` | Netlify |
|
|
724
|
-
| `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID`, `CF_PROJECT_NAME` | Cloudflare Pages |
|
|
725
|
-
| `AMPLIFY_APP_ID` (+ `AWS_*` if not already set) | AWS Amplify |
|
|
726
|
-
| `AZURE_STATIC_WEB_APPS_TOKEN` | Azure Static Web Apps |
|
|
727
|
-
| `FIREBASE_TOKEN`, `FIREBASE_PROJECT_ID` | Firebase Hosting |
|
|
728
|
-
| `FIREBASE_APP_HOSTING_BACKEND` | Firebase App Hosting |
|
|
914
|
+
See [Deployment method guides](#deployment-method-guides) for full per-method variable tables with examples.
|
|
729
915
|
|
|
730
916
|
## `deployhub doctor` Output
|
|
731
917
|
|
|
@@ -773,6 +959,25 @@ artifact/
|
|
|
773
959
|
README.md
|
|
774
960
|
```
|
|
775
961
|
|
|
962
|
+
`deployment.json` records server deployment metadata per environment:
|
|
963
|
+
|
|
964
|
+
```json
|
|
965
|
+
{
|
|
966
|
+
"targets": ["production"],
|
|
967
|
+
"deployedAt": "2026-07-01T12:00:00.000Z",
|
|
968
|
+
"deployments": [
|
|
969
|
+
{
|
|
970
|
+
"environmentName": "production",
|
|
971
|
+
"serverAddress": "203.0.113.10",
|
|
972
|
+
"processId": "my-api",
|
|
973
|
+
"timestamp": "2026-07-01T12:00:00.000Z"
|
|
974
|
+
}
|
|
975
|
+
]
|
|
976
|
+
}
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
Rollback redeploys a previous artifact to the configured server targets using this metadata.
|
|
980
|
+
|
|
776
981
|
## Configuration
|
|
777
982
|
|
|
778
983
|
`deployhub.config.json` is generated by `init`. Credentials are **never** stored in this file — only in `.env` or GitHub Secrets.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akash-chowdhury-24/deployhub",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Zero-configuration deployment and artifact manager",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/cli/index.js",
|
|
@@ -35,8 +35,9 @@
|
|
|
35
35
|
"scripts": {
|
|
36
36
|
"start": "node src/cli/index.js",
|
|
37
37
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"verify:bundle-sources": "node scripts/verify-bundle-sources.mjs",
|
|
39
|
+
"prepublishOnly": "npm test && npm run verify:bundle-sources",
|
|
40
|
+
"build:bundle": "node scripts/verify-bundle-sources.mjs && node scripts/build-bundle.mjs",
|
|
40
41
|
"build:binaries": "npm run build:bundle && node scripts/prefetch-pkg-cache.mjs && pkg dist/deployhub.cjs --targets node20-linux-x64,node20-macos-x64,node20-macos-arm64,node20-win-x64 --output dist/deployhub --compress GZip"
|
|
41
42
|
},
|
|
42
43
|
"pkg": {
|