@akash-chowdhury-24/deployhub 2.0.10 → 2.0.11

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.
Files changed (2) hide show
  1. package/README.md +46 -18
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -675,6 +675,8 @@ DeployHub detects whether the server uses Debian-style `sites-available` or RHEL
675
675
 
676
676
  ### Docker
677
677
 
678
+ **Verification:** Real-world verified (local and CI Docker deploys).
679
+
678
680
  **Prerequisites:**
679
681
  - [ ] Docker installed (`docker --version` works)
680
682
  - [ ] Registry account if pushing private images
@@ -682,20 +684,25 @@ DeployHub detects whether the server uses Debian-style `sites-available` or RHEL
682
684
 
683
685
  **What DeployHub automates:**
684
686
  - Starter `Dockerfile` at project root when none exists (framework-aware; skipped if you already have one)
687
+ - `.dockerignore` when missing (never overwrites an existing one)
685
688
  - `.env.example` for image name, registry, remote `DOCKER_HOST`
686
689
  - Docker daemon connectivity test during `init`
690
+ - Reuses the image built in the pipeline `docker` stage when present; otherwise builds from the artifact
691
+ - Registry login + push when `DOCKER_REGISTRY_USERNAME` / `DOCKER_REGISTRY_TOKEN` are set
692
+ - Auto-generates a unique image tag per build when `DOCKER_IMAGE_TAG` is unset (git SHA → CI run id → timestamp)
687
693
  - `docker compose up` or build/push/run during deploy
688
694
 
689
695
  **After `init`:**
690
- 1. Set `DOCKER_IMAGE_NAME` in `.env`
691
- 2. For private registries: set `DOCKER_REGISTRY_USERNAME` and `DOCKER_REGISTRY_TOKEN`
692
- 3. For remote Docker: set `DOCKER_HOST` (e.g. `ssh://ubuntu@203.0.113.10`)
693
- 4. Run `deployhub doctor`, then `git push origin main`
696
+ 1. Set `DOCKER_IMAGE_NAME` in `.env` (e.g. `myuser/myapp` for Docker Hub)
697
+ 2. For private registries (or any push): set `DOCKER_REGISTRY_USERNAME` and `DOCKER_REGISTRY_TOKEN`
698
+ 3. Leave `DOCKER_IMAGE_TAG` unset for a unique tag each build — set it only if you intentionally want a fixed tag
699
+ 4. For remote Docker: set `DOCKER_HOST` (e.g. `ssh://ubuntu@203.0.113.10`)
700
+ 5. Run `deployhub doctor`, then `git push origin main`
694
701
 
695
702
  | Variable | Description | Example | Where to get it |
696
703
  |----------|-------------|---------|-----------------|
697
704
  | `DOCKER_IMAGE_NAME` | Image repository path | `myorg/myapp` | Your registry naming |
698
- | `DOCKER_IMAGE_TAG` | Image tag | `latest` | Version or `latest` |
705
+ | `DOCKER_IMAGE_TAG` | Optional fixed tag (unset → unique per build) | `latest` | Your choice; prefer unset |
699
706
  | `DOCKER_REGISTRY_URL` | Registry URL (optional) | `https://ghcr.io` | Registry docs |
700
707
  | `DOCKER_REGISTRY_USERNAME` | Registry user | `myuser` | Registry account |
701
708
  | `DOCKER_REGISTRY_TOKEN` | Registry password/token | *(secret)* | Docker Hub / GHCR PAT |
@@ -813,34 +820,55 @@ DeployHub detects whether the server uses Debian-style `sites-available` or RHEL
813
820
 
814
821
  ### Kubernetes
815
822
 
823
+ **Verification:** Real-world verified (including k3s and CI deploys).
824
+
816
825
  **Prerequisites:**
817
826
  - [ ] Existing Kubernetes cluster (DeployHub does not provision clusters)
818
827
  - [ ] `kubectl` installed and configured on your **local machine** (for `deployhub doctor` / manual `deployhub deploy`)
819
- - [ ] Cluster reachable from CI (kubeconfig secret or cloud auth)
828
+ - [ ] Cluster reachable from CI (kubeconfig **secret contents** or cloud auth — see `KUBECONFIG` below)
829
+ - [ ] Container registry credentials so the cluster can pull the image you push
830
+
831
+ **Init prompts (what `deployhub init` asks for Kubernetes):**
832
+ 1. Path to kubeconfig file (e.g. `~/.kube/config`)
833
+ 2. Kubernetes context
834
+ 3. Namespace (defaults to project name)
835
+ 4. Container image name
836
+ 5. Registry URL (leave empty for Docker Hub)
837
+ 6. Registry username (required to push)
838
+ 7. Registry token/password (required to push)
839
+ 8. Health check URL (optional)
820
840
 
821
841
  **What DeployHub automates:**
822
842
  - Starter `k8s/deployment.yaml` and `k8s/service.yaml` when no manifests exist (skipped if you already have a `k8s/` directory or root-level Kubernetes YAML files)
823
843
  - GitHub Actions installs `kubectl` on the CI runner and writes kubeconfig from secrets (no local `kubectl` required for the automated push-to-main deploy path)
824
844
  - Lists `kubectl` contexts during `init` for easy selection
825
845
  - Auto-detects `~/.kube/config`
826
- - Complete `.env.example` for kubeconfig, context, namespace
846
+ - Complete `.env.example` for kubeconfig, context, namespace, and registry settings
827
847
  - Cluster connectivity test during `init`
848
+ - On deploy: registry login → reuse or build image → push (unique tag unless `DOCKER_IMAGE_TAG` is set) → ensure namespace exists (prompt locally / auto-create in CI) → `kubectl apply` → `kubectl set image` with the full resolved image ref → `kubectl rollout restart` when that ref is unchanged so pods pick up a new digest
828
849
 
829
850
  **After `init`:**
830
851
  1. Verify context: `kubectl config get-contexts`
831
- 2. Create namespace if needed: `kubectl create namespace my-app`
832
- 3. For private registries: create `imagePullSecret` and set `KUBE_IMAGE_PULL_SECRET`
833
- 4. Copy `.env.example` `.env`; add kubeconfig/auth to GitHub Secrets for CI
834
- 5. Run `deployhub doctor`, then `git push origin main`
852
+ 2. Copy `.env.example` `.env`; set `DOCKER_IMAGE_NAME`, registry username/token, and (for local deploys) `KUBECONFIG` / `KUBE_CONTEXT` / `KUBE_NAMESPACE` as needed
853
+ 3. Leave `DOCKER_IMAGE_TAG` unset for a unique tag each build — set it only if you want a fixed tag (DeployHub will still rollout-restart when the full image ref is unchanged)
854
+ 4. Namespace is created on first deploy if missing (you will be prompted locally; CI auto-creates). Or create it yourself: `kubectl create namespace my-app`
855
+ 5. For private registries: create an `imagePullSecret` and set `KUBE_IMAGE_PULL_SECRET`
856
+ 6. Add GitHub Secrets for CI (see table — **`KUBECONFIG` must be the file contents, not a path**)
857
+ 7. Run `deployhub doctor`, then `git push origin main`
858
+
859
+ > **Warning — Service `targetPort`:** the default `targetPort` in generated `k8s/service.yaml` may not match your app's actual exposed port (e.g. a static nginx image serves on port **80**, not the config's default like 3000). Verify and adjust `k8s/service.yaml`'s `targetPort` (and the Deployment `containerPort` if needed) before your first deploy.
835
860
 
836
861
  | Variable | Description | Example | Where to get it |
837
862
  |----------|-------------|---------|-----------------|
838
- | `KUBECONFIG` | Path to kubeconfig | `~/.kube/config` | Default kubectl config |
863
+ | `KUBECONFIG` | **Local:** path to kubeconfig. **CI (GitHub Secret):** full kubeconfig **file contents** (or base64) — not a path | `~/.kube/config` locally; paste file contents in CI | `~/.kube/config` |
839
864
  | `KUBE_CONTEXT` | Context name | `my-cluster` | `kubectl config get-contexts` |
840
- | `KUBE_NAMESPACE` | Target namespace | `my-app` | `kubectl get namespaces` |
841
- | `DOCKER_IMAGE_NAME` | Container image | `ghcr.io/org/app` | Your registry |
842
- | `DOCKER_IMAGE_TAG` | Image tag | `1.0.0` or `latest` | Project version or your choice |
843
- | `KUBE_IMAGE_PULL_SECRET` | Pull secret name | `regcred` | `kubectl create secret docker-registry` |
865
+ | `KUBE_NAMESPACE` | Target namespace (optional; defaults to project name) | `my-app` | Your choice |
866
+ | `DOCKER_IMAGE_NAME` | Container image repository | `myuser/myapp` or `ghcr.io/org/app` | Your registry |
867
+ | `DOCKER_IMAGE_TAG` | Optional fixed tag (unset unique per build) | `latest` | Prefer unset |
868
+ | `DOCKER_REGISTRY_URL` | Registry URL (optional; empty = Docker Hub) | `https://ghcr.io` | Registry docs |
869
+ | `DOCKER_REGISTRY_USERNAME` | Registry user (required to push) | `myuser` | Registry account |
870
+ | `DOCKER_REGISTRY_TOKEN` | Registry password/token (required to push) | *(secret)* | Docker Hub token / GHCR PAT |
871
+ | `KUBE_IMAGE_PULL_SECRET` | Pull secret name (optional, private registries) | `regcred` | `kubectl create secret docker-registry` |
844
872
 
845
873
  ---
846
874
 
@@ -966,8 +994,8 @@ Add these secrets in your repository (Settings → Secrets and variables → Act
966
994
  | `EC2_INSTANCE_ID`, `AWS_*` | Optional EC2 dynamic IP lookup |
967
995
  | `AZURE_SUBSCRIPTION_ID`, `AZURE_RESOURCE_GROUP`, `AZURE_VM_NAME` | Optional Azure VM IP lookup |
968
996
  | `GCP_PROJECT_ID`, `GCP_ZONE`, `GCP_INSTANCE_NAME`, `GCP_KEY_FILE` | Optional GCP VM IP lookup |
969
- | `DOCKER_IMAGE_NAME`, `DOCKER_REGISTRY_*`, `DOCKER_HOST` | Docker deployment |
970
- | `KUBECONFIG`, `KUBE_CONTEXT`, `KUBE_NAMESPACE` | Kubernetes deployment |
997
+ | `DOCKER_IMAGE_NAME`, `DOCKER_REGISTRY_USERNAME`, `DOCKER_REGISTRY_TOKEN`, `DOCKER_REGISTRY_URL`, `DOCKER_HOST` | Docker deployment (`DOCKER_IMAGE_TAG` optional) |
998
+ | `KUBECONFIG`, `KUBE_CONTEXT`, `KUBE_NAMESPACE`, `DOCKER_IMAGE_NAME`, `DOCKER_REGISTRY_USERNAME`, `DOCKER_REGISTRY_TOKEN`, `DOCKER_REGISTRY_URL`, `DOCKER_IMAGE_TAG`, `KUBE_IMAGE_PULL_SECRET` | Kubernetes **`KUBECONFIG` in GitHub Secrets must be the kubeconfig file contents (or base64), not a filesystem path**. `DOCKER_IMAGE_TAG`, `KUBE_NAMESPACE`, `DOCKER_REGISTRY_URL`, and `KUBE_IMAGE_PULL_SECRET` are optional |
971
999
 
972
1000
  See [Deployment method guides](#deployment-method-guides) for full per-method variable tables with examples.
973
1001
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akash-chowdhury-24/deployhub",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "description": "Zero-configuration deployment and artifact manager",
5
5
  "type": "module",
6
6
  "main": "./src/cli/index.js",