gemstone-nexus · Phase 6

GemStone Deploy Procedure (Stage 2)

← Documents

Metadata

iddoc_idtitlecategorysource_pathsummarycontent_hashindexed_at
10DOC-DEPLOY-PIPELINEGemStone Deploy Procedure (Stage 2)referenceDevResources/docs/DOC-Deploy-Pipeline.md| Role | Where | |------|--------| | Author / edit | Windows workstation (this repo) | | Git | Local commit → `git push` with PAT (from `DATARIGHT_DEV_SECRETS`, never stored in repo) | | Build / run / test | T4 GoldenAMI EC2 Ohio (`i-04333dae160ab0daa`) over plink/SSH | | Local Docker | **Not used** on the co-dev PC |111e509f7bf55afdd91587117a17bce0366d69e72026-07-22 18:33:18

Content

# GemStone Deploy Procedure (Stage 2)

**Status:** Operating model wired; host half verified against T4 EC2.  
**No commit required for Stage 2** — first full Deploy of product code waits until Stage 3 bootstrap content is committed and pushed.

## Operating model

| Role | Where |
|------|--------|
| Author / edit | Windows workstation (this repo) |
| Git | Local commit → `git push` with PAT (from `DATARIGHT_DEV_SECRETS`, never stored in repo) |
| Build / run / test | T4 GoldenAMI EC2 Ohio (`i-04333dae160ab0daa`) over plink/SSH |
| Local Docker | **Not used** on the co-dev PC |

**Deploy** = commit → push → pull-on-host → `docker compose up` → restart/health.

## Fixed paths / hosts (Stage 2 verify)

| Item | Value |
|------|--------|
| Instance | `i-04333dae160ab0daa` (us-east-2) |
| Public IP (verified) | `18.116.188.14` (re-check after stop/start if no EIP sticky) |
| SSH (primary) | `dr` + `DR_SSH_PASSWORD` via plink; host key pinned |
| SSH (break-glass) | `ubuntu` + `C:\Users\Mark\.ssh\gemstone-nexus-key.pem` |
| Host key (ED25519) | `SHA256:TSExVVo9lcc48zJsQSrpXxEIHe8Wv7+qDTBl1MHCilw` |
| `DEVELOPMENT_DIRECTORY` | `/home/dr/AppDev/gemstone-nexus` |
| Git remote on host | `https://github.com/mfuriate/GemStone-Nexus-StackOne.git` (clean URL; PAT only at pull time via Basic auth) |
| Compose nginx | Container `gemstone-nginx` publishes host `80`/`443` |
| Supervisor | Stage 3 — inside API image / `supervisor/` scaffold; not host-level in Stage 2 |

## Scripts

| Script | Purpose |
|--------|---------|
| `scripts/remote-exec.ps1` | Ad-hoc plink/OpenSSH command; `-RefreshHostKey` after instance replace |
| `scripts/ensure-ec2-dev-dir.ps1` | Clone/pull `DEVELOPMENT_DIRECTORY`; PAT from Secrets Manager |
| `scripts/run-remote-docker-deploy.ps1` | Host half of Deploy (pull → compose up → health) |
| `scripts/aws/deploy.sh` | Same contract when already SSH'd onto the host as `dr` |

Config template: `DevResources/project.env.example` → copy to `DevResources/project.env` (gitignored).

## Practitioner Deploy steps

1. **Commit** locally (when you intend to ship a change set). Do not commit secrets.
2. **Push** to `origin` (`git push`). PAT stays in credential helper / Secrets Manager — not in `.git/config` on the EC2.
3. **Pull + compose on host** from Windows:
   ```powershell
   .\scripts\run-remote-docker-deploy.ps1
   ```
   Or on the host:
   ```bash
   export GITHUB_PAT=...   # from Secrets Manager session
   ./scripts/aws/deploy.sh
   ```
4. Confirm `docker compose ps` and `/healthz` (full green expected after Stage 3). Optional host gates:
   ```bash
   make phase0-gates   # healthz + WS echo <200ms
   make rollback       # restore prior SHA + compose; budget <5 min
   make soak-start     # 10-min healthy soak in background
   ```

Optional: `-PushLocal` pushes current `HEAD` before the host pull.

## Host key hygiene

After EIP reuse or AMI relaunch, fingerprints change:

```powershell
.\scripts\remote-exec.ps1 -RefreshHostKey
# then update DR_SSH_HOSTKEY in DevResources/project.env
```

OpenSSH: `StrictHostKeyChecking=accept-new` only after removing the stale `known_hosts` line for that IP (`ssh-keygen -R <ip>`).

## Cost schedule (do not disable casually)

EventBridge Scheduler (us-east-2), both **ENABLED**:

- `gemstone-nexus-stop` — `cron(0 1 * * ? *)` America/New_York  
- `gemstone-nexus-start` — `cron(0 9 * * ? *)` America/New_York  

Terraform: `launch_instance = true` is intentional while this host is live — see `infra/terraform/ohio/README.md`.

**Spot capacity note (2026-07-21):** After Stage 2 connectivity verify, the instance entered `stopped` with spot request status `marked-for-stop` ("no Spot capacity available"). `StartInstances` returns `IncorrectSpotRequestState` until capacity returns. Worktree `/home/dr/AppDev/gemstone-nexus` was cloned before the stop; re-run `ensure-ec2-dev-dir.ps1` after the next successful start. Do **not** destroy/recreate via Terraform without approval.

## Local secondary

`GemStone-Golden` at `D:\Virtual Machines\GemStone-Golden\` — last IP `10.0.0.224`, `dr` contract PASSED (see `DOC-GemStone-Golden-Host-Verify.md`). Offline secondary; not the Deploy target.