@akash-chowdhury-24/deployhub 2.0.39 → 2.0.40

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 CHANGED
@@ -765,7 +765,7 @@ SSH-based deploys (`ssh`, `ec2`, `azure-vm`, `gcp-vm`, and `docker` with `remote
765
765
 
766
766
  Commands run over the **existing** SSH session (not a second connection), unless a successful hook sets `"reconnect": true`. Kubernetes and Docker `local` / `raw` modes do not support hooks (no persistent remote shell session); configuring them there fails loudly at deploy/rollback.
767
767
 
768
- On docker-ssh, `postDeploy` runs **after** the port-publish inspect check (`docker inspect` confirms `0.0.0.0:<port>->`). A hook that curls the app's published port therefore sees a container DeployHub already treated as published. If that inspect fails, `postDeploy` does not run.
768
+ On docker-ssh, `preDeploy` / `rollback` run **before** remote registry login and `docker stop`/`run`, so a hook can install Docker on a bare host. `postDeploy` runs **after** the port-publish inspect check (`docker inspect` confirms `0.0.0.0:<port>->`). A hook that curls the app's published port therefore sees a container DeployHub already treated as published. If that inspect fails, `postDeploy` does not run.
769
769
 
770
770
  Hook `command` strings are raw remote shell — there is **no** `{{buildId}}` / `{{containerName}}` / `{{port}}` / `{{environment}}` substitution. Hardcode values per environment (or read them from the remote environment). Extra Docker environments use an env-scoped container name (`{project}-{env}`; the first/grandfathered env stays `{project}`), so a hook that `docker exec myapp …` on staging will miss `myapp-staging`.
771
771
 
@@ -853,6 +853,8 @@ sudo usermod -aG docker your-ssh-user
853
853
 
854
854
  Then **reconnect** (group membership applies on the next login). `deployhub doctor` reports this if missing (it prints the exact `usermod` line). See [Docker](#docker) below.
855
855
 
856
+ You can also put that bootstrap in **preDeploy hooks** on a bare host (install Docker, `usermod`, `"reconnect": true`). Registry login runs **after** preDeploy, so those hooks get a chance to install `docker` before `docker login`. Failed login used to abort first (`docker: command not found`) and skip the hooks.
857
+
856
858
  ### SSH
857
859
 
858
860
  **Verification:** Real-world verified DEPLOY and ROLLBACK.
@@ -902,7 +904,7 @@ Then **reconnect** (group membership applies on the next login). `deployhub doct
902
904
  - [ ] Docker installed (`docker --version` works) — on this machine / CI for **local** and **raw**; on the remote Linux host for **ssh**
903
905
  - [ ] Registry account if pushing private images
904
906
  - [ ] `docker-compose.yml` in project if you use multi-service Compose (not auto-generated)
905
- - [ ] **SSH mode only:** [one-time server setup](#one-time-server-setup-before-your-first-deploy) — Docker on the host and the SSH user in the `docker` group (`sudo usermod -aG docker <user>`, then reconnect)
907
+ - [ ] **SSH mode only:** [one-time server setup](#one-time-server-setup-before-your-first-deploy) — Docker on the host and the SSH user in the `docker` group (`sudo usermod -aG docker <user>`, then reconnect). A `preDeploy` hook can install Docker and run that `usermod` with `"reconnect": true`; registry login happens after preDeploy.
906
908
 
907
909
  `init` and `env add` ask **Where should the container run?**
908
910
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akash-chowdhury-24/deployhub",
3
- "version": "2.0.39",
3
+ "version": "2.0.40",
4
4
  "description": "Zero-configuration deployment and artifact manager",
5
5
  "type": "module",
6
6
  "main": "./src/cli/index.js",
@@ -167,6 +167,13 @@ export function createDockerProvider(config, envName, env = process.env) {
167
167
  const registryToken = imageEnv.DOCKER_REGISTRY_TOKEN || '';
168
168
  const registryUrl = imageEnv.DOCKER_REGISTRY_URL || '';
169
169
 
170
+ ssh = await runDeployHooks({
171
+ session,
172
+ ssh,
173
+ settings,
174
+ stage: isRollback ? 'rollback' : 'preDeploy',
175
+ });
176
+
170
177
  if (registryUser && registryToken) {
171
178
  const registry = registryUrl || 'https://index.docker.io/v1/';
172
179
  log.info('Logging in to container registry on remote host...');
@@ -177,13 +184,6 @@ export function createDockerProvider(config, envName, env = process.env) {
177
184
  );
178
185
  }
179
186
 
180
- ssh = await runDeployHooks({
181
- session,
182
- ssh,
183
- settings,
184
- stage: isRollback ? 'rollback' : 'preDeploy',
185
- });
186
-
187
187
  await session.exec(ssh, cmds.stop);
188
188
  await session.exec(ssh, cmds.rm);
189
189
  await session.exec(ssh, cmds.pull, {