From bc63f33c441c685e5f6a8417c555aab291595fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?abstract=E2=81=B7?= Date: Fri, 16 Jan 2026 17:22:22 +0800 Subject: [PATCH 1/8] Create HOTEL RESERVATION APP MICROSERVICE ARCHITECTURE.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## SC-MVP-02: Checkpoint Definition — App Deployment & Rollout Verification ### Branch `sc-mvp/app-deploy` ### Commit Message Define app deployment checkpoint with idempotent rollout verification ### Snippet **SC-MVP-02: Deploy Hotel Reservation App** - Deploy **hotel reservation app** into `sc-mvp-test` namespace - Ensure **idempotent deployment** (safe re-apply with no side effects) - Use declarative manifests (Deployment, Service, optional Ingress) - Verify successful rollout via: - `kubectl rollout status` - Pod readiness & availability checks - Service endpoint accessibility - Capture deployment metadata: - Timestamps (apply/start/ready) - Pod status & restart count - Image digest / tag used - Log stdout/stderr and rollout results in **CSV/JSON** (SQLite-ready ETL) - Failure handling: - Automatic rollback or explicit failure state - Preserve logs and cluster state for audit - Documentation includes: - Deployment manifests - Rollout verification steps - Re-run / idempotency validation notes ### Artifact Integrity - **SHA256 (Original Artifact):** `` - **SHA256 (Microsoft Official):** `` ### Commit Email `vitrixlabph@gmail.com` --- ...SERVATION APP MICROSERVICE ARCHITECTURE.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sanity-desk/HOTEL RESERVATION APP MICROSERVICE ARCHITECTURE.md diff --git a/sanity-desk/HOTEL RESERVATION APP MICROSERVICE ARCHITECTURE.md b/sanity-desk/HOTEL RESERVATION APP MICROSERVICE ARCHITECTURE.md new file mode 100644 index 00000000..5c9b9cb6 --- /dev/null +++ b/sanity-desk/HOTEL RESERVATION APP MICROSERVICE ARCHITECTURE.md @@ -0,0 +1,89 @@ +# Super MVP — sc-mvp/app-deploy + +## 1️⃣ Goal +Deploy a **hotel reservation application** onto the SC-MVP Kubernetes cluster and validate that the deployment is **idempotent, observable, and verifiably successful**, forming **Checkpoint SC-MVP-02** in the pipeline. + +--- + +## 2️⃣ Requirements + +| Requirement | Details | +| ----------- | ------- | +| **Target Cluster** | Existing SC-MVP cluster (from SC-MVP-01) | +| **Namespace** | `sc-mvp-test` | +| **Deployment Method** | Declarative Kubernetes manifests | +| **Idempotency** | Re-applying manifests must not cause errors or drift | +| **Verification Tools** | kubectl | +| **Logging Format** | CSV / JSON (SQLite ETL compatible) | +| **Rollback Strategy** | Automatic or manual rollback on failure | + +--- + +## 3️⃣ Deployment Steps + +### 3.1 Application Manifests +- Kubernetes **Deployment** manifest for the hotel reservation app +- Kubernetes **Service** manifest for internal/external access +- Optional **Ingress** manifest (environment-dependent) + +--- + +### 3.2 Apply Deployment +- Apply manifests to the `sc-mvp-test` namespace +- Ensure repeated `kubectl apply` operations are safe and consistent + +--- + +### 3.3 Rollout Verification +- Validate rollout completion using: + - `kubectl rollout status` + - Pod readiness and availability checks +- Confirm service endpoint accessibility + +--- + +### 3.4 Idempotency Validation +- Re-apply manifests +- Confirm: + - No unintended restarts + - No configuration drift + - Stable pod state + +--- + +## 4️⃣ Logging & Verification +- Capture stdout/stderr from deployment commands +- Record: + - Deployment timestamps (apply / start / ready) + - Pod status and restart counts + - Image tag and/or digest used +- Store logs in **CSV/JSON** format for SQLite ingestion +- Mark checkpoint as **PASS** only if rollout completes successfully + +--- + +## 5️⃣ Failure Handling & Safety +- On failure: + - Trigger rollback or enter explicit failed state + - Preserve cluster state and logs for audit +- Do not auto-delete resources unless explicitly configured + +--- + +## 6️⃣ Deliverables +- Application deployment manifests +- Rollout verification logs (CSV/JSON) +- Idempotency validation evidence +- Documentation describing: + - Deployment procedure + - Verification steps + - Re-run behavior and constraints + +--- + +## Checkpoint Summary + +**Checkpoint ID:** SC-MVP-02 +**Branch:** `sc-mvp/app-deploy` +**Purpose:** App Deployment & Rollout Verification +**Status:** ☐ PASS / ☐ FAIL (to be recorded during execution) From 9a2175f0205a857044eaa51712730d7521dfe059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?abstract=E2=81=B7?= Date: Fri, 30 Jan 2026 07:18:23 +0800 Subject: [PATCH 2/8] Create sc-mvp-02-app-deploy.yaml --- .sc-mvp/checkpoints/sc-mvp-02-app-deploy.yaml | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .sc-mvp/checkpoints/sc-mvp-02-app-deploy.yaml diff --git a/.sc-mvp/checkpoints/sc-mvp-02-app-deploy.yaml b/.sc-mvp/checkpoints/sc-mvp-02-app-deploy.yaml new file mode 100644 index 00000000..86e63a81 --- /dev/null +++ b/.sc-mvp/checkpoints/sc-mvp-02-app-deploy.yaml @@ -0,0 +1,102 @@ +checkpoint: + id: SC-MVP-02 + name: App Deployment & Rollout Verification + description: > + Deploy and verify the Hotel Reservation App with idempotent rollout + validation, readiness checks, and artifact metadata capture. + branch: sc-mvp/app-deploy + commit_message: Define app deployment checkpoint with idempotent rollout verification + owner_email: vitrixlabph@gmail.com + +artifact_integrity: + sha256_original: SHA256-f465ef5a9022bb7d10c7bf324e816192c20493d5 + sha256_microsoft_official: + +environment: + platform: kubernetes + namespace: sc-mvp-test + kube_context: default + idempotent: true + +deployment: + application: hotel-reservation-app + manifests: + - k8s/deployment.yaml + - k8s/service.yaml + - k8s/ingress.yaml # optional + apply_strategy: + type: declarative + command: kubectl apply -f k8s/ + safe_reapply: true + +rollout_verification: + steps: + - name: rollout_status + command: > + kubectl rollout status deployment/hotel-reservation-app + -n sc-mvp-test + timeout_seconds: 300 + + - name: pod_readiness + command: > + kubectl get pods -n sc-mvp-test + -l app=hotel-reservation-app + -o json + + - name: pod_availability + command: > + kubectl wait --for=condition=Available + deployment/hotel-reservation-app + -n sc-mvp-test + --timeout=300s + + - name: service_accessibility + command: > + kubectl get svc hotel-reservation-app + -n sc-mvp-test + -o json + +metadata_capture: + timestamps: + apply_start: true + rollout_ready: true + pod_metrics: + status: true + restart_count: true + image_details: + tag: true + digest: true + output_formats: + - json + - csv + storage: + etl_ready: true + sqlite_compatible: true + path: artifacts/deployments/sc-mvp-02/ + +logging: + capture: + stdout: true + stderr: true + kubectl_events: true + retention_policy: + preserve_on_success: true + preserve_on_failure: true + +failure_handling: + on_failure: + action: rollback + rollback_command: > + kubectl rollout undo deployment/hotel-reservation-app + -n sc-mvp-test + audit: + preserve_cluster_state: true + preserve_logs: true + mark_checkpoint_failed: true + +documentation: + included: + - deployment_manifests + - rollout_verification_steps + - idempotency_notes + - rerun_procedure From 8cd72cd26f0739e258ccf25bc54638946e75d8bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?abstract=E2=81=B7?= Date: Fri, 30 Jan 2026 07:22:42 +0800 Subject: [PATCH 3/8] Create deployment.yaml --- k8s/deployment.yaml | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 k8s/deployment.yaml diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml new file mode 100644 index 00000000..4678ceab --- /dev/null +++ b/k8s/deployment.yaml @@ -0,0 +1,54 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: hotel-reservation-app + namespace: sc-mvp-test + labels: + app: hotel-reservation-app + app.kubernetes.io/name: hotel-reservation-app + app.kubernetes.io/component: backend + app.kubernetes.io/part-of: sc-mvp +spec: + replicas: 2 + revisionHistoryLimit: 5 + selector: + matchLabels: + app: hotel-reservation-app + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 + maxUnavailable: 0 + template: + metadata: + labels: + app: hotel-reservation-app + spec: + containers: + - name: hotel-reservation-app + image: ghcr.io/example/hotel-reservation-app:latest + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8080 + name: http + readinessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 10 + timeoutSeconds: 2 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /health + port: 8080 + initialDelaySeconds: 15 + periodSeconds: 20 + resources: + requests: + cpu: "100m" + memory: "128Mi" + limits: + cpu: "500m" + memory: "256Mi" From 2fa6ce92f69380de24273482a9397c3327863b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?abstract=E2=81=B7?= Date: Fri, 30 Jan 2026 07:23:06 +0800 Subject: [PATCH 4/8] Create service.yaml --- k8s/service.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 k8s/service.yaml diff --git a/k8s/service.yaml b/k8s/service.yaml new file mode 100644 index 00000000..9e57d5b7 --- /dev/null +++ b/k8s/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: hotel-reservation-app + namespace: sc-mvp-test + labels: + app: hotel-reservation-app +spec: + type: ClusterIP + selector: + app: hotel-reservation-app + ports: + - name: http + port: 80 + targetPort: 8080 + protocol: TCP From 236e38bdf335792628d276054cc528509333cd59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?abstract=E2=81=B7?= Date: Fri, 30 Jan 2026 07:24:58 +0800 Subject: [PATCH 5/8] Create package.json --- app/package.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/package.json diff --git a/app/package.json b/app/package.json new file mode 100644 index 00000000..001c65b0 --- /dev/null +++ b/app/package.json @@ -0,0 +1,12 @@ +{ + "name": "hotel-reservation-app", + "version": "0.1.0", + "description": "SC-MVP Hotel Reservation App", + "main": "server.js", + "scripts": { + "start": "node server.js" + }, + "dependencies": { + "express": "^4.19.2" + } +} From cd488b98edacdbb6dfbedb7caeefe8956d2e3956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?abstract=E2=81=B7?= Date: Fri, 30 Jan 2026 07:25:37 +0800 Subject: [PATCH 6/8] Create server.js --- app/server.js | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 app/server.js diff --git a/app/server.js b/app/server.js new file mode 100644 index 00000000..32860fd7 --- /dev/null +++ b/app/server.js @@ -0,0 +1,61 @@ +const express = require("express"); +const app = express(); + +app.use(express.json()); + +const PORT = process.env.PORT || 8080; + +// In-memory store (MVP only) +const reservations = []; + +/** + * Health check + * Required for Kubernetes readiness/liveness probes + */ +app.get("/health", (req, res) => { + res.status(200).json({ + status: "ok", + uptime: process.uptime(), + timestamp: new Date().toISOString() + }); +}); + +/** + * List reservations + */ +app.get("/reservations", (req, res) => { + res.json({ + count: reservations.length, + data: reservations + }); +}); + +/** + * Create a reservation + */ +app.post("/reservations", (req, res) => { + const { guestName, roomNumber, fromDate, toDate } = req.body; + + if (!guestName || !roomNumber || !fromDate || !toDate) { + return res.status(400).json({ + error: "Missing required fields" + }); + } + + const reservation = { + id: reservations.length + 1, + guestName, + roomNumber, + fromDate, + toDate, + createdAt: new Date().toISOString() + }; + + reservations.push(reservation); + + res.status(201).json(reservation); +}); + +app.listen(PORT, () => { + console.log(`Hotel Reservation App running on port ${PORT}`); +}); From 78642f6fa3e26c042bfe4eea24889eab8c923515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?abstract=E2=81=B7?= Date: Fri, 30 Jan 2026 07:25:59 +0800 Subject: [PATCH 7/8] Create Dockerfile --- app/Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/Dockerfile diff --git a/app/Dockerfile b/app/Dockerfile new file mode 100644 index 00000000..e9db8dc4 --- /dev/null +++ b/app/Dockerfile @@ -0,0 +1,12 @@ +FROM node:20-alpine + +WORKDIR /app + +COPY package.json ./ +RUN npm install --production + +COPY server.js ./ + +EXPOSE 8080 + +CMD ["npm", "start"] From 162b6b396318e22c3e9435395f9d3a55aae7e506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?abstract=E2=81=B7?= Date: Fri, 30 Jan 2026 08:13:52 +0800 Subject: [PATCH 8/8] Create SC-MVP-02.md --- sanity-desk/docs/SC-MVP-02.md | 119 ++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 sanity-desk/docs/SC-MVP-02.md diff --git a/sanity-desk/docs/SC-MVP-02.md b/sanity-desk/docs/SC-MVP-02.md new file mode 100644 index 00000000..73006c99 --- /dev/null +++ b/sanity-desk/docs/SC-MVP-02.md @@ -0,0 +1,119 @@ +--- +title: "SC-MVP-02: Hotel Reservation App Deployment & Rollout" +branch: "sc-mvp/app-deploy" +commit: "Define app deployment checkpoint with idempotent rollout verification" +author: "vitrixlabph@gmail.com" +status: "Code and manifests included" +--- + +# SC-MVP-02: Hotel Reservation App Deployment & Rollout Documentation + +## 1. Purpose + +This document captures the **planning, checkpoint, and implementation** of SC-MVP-02: + +- Deploy the **Hotel Reservation App** into the `sc-mvp-test` namespace +- Ensure **idempotent deployment** (safe re-apply with no side effects) +- Include both **documentation and code** for review and mapping + +--- + +## 2. Components + +### 2.1 Checkpoint Documentation +- Defines **deployment goals** and **rollout verification steps** +- Includes **metadata capture**, logging, and failure handling +- Serves as **control contract** for automation pipelines + +### 2.2 Application Code +- Language: **Node.js + Express** +- Functionality: + - `GET /health` → Kubernetes liveness/readiness probe + - `GET /reservations` → List reservations (in-memory) + - `POST /reservations` → Add reservation (in-memory) +- Location: `app/` folder +- Dockerized via `Dockerfile` (port 8080) + +### 2.3 Kubernetes Manifests +- Location: `k8s/` folder +- Files: + - `deployment.yaml` → Deployment configuration + - `service.yaml` → Service configuration +- Features: + - Rolling update strategy + - Probes matching `/health` endpoint + - Idempotent, replayable deployment + +--- + +## 3. Deployment Instructions + +**Local/Kind Testing Steps:** + +```bash +# 1. Ensure kind is installed +kind version + +# 2. Create cluster +kind create cluster --name sc-mvp + +# 3. Create namespace +kubectl create namespace sc-mvp-test + +# 4. Build and load Docker image +docker build -t hotel-reservation-app:mvp ./app +kind load docker-image hotel-reservation-app:mvp --name sc-mvp + +# 5. Apply Kubernetes manifests +kubectl apply -f k8s/ + +# 6. Verify rollout +kubectl rollout status deployment/hotel-reservation-app -n sc-mvp-test + +# 7. Test service (port-forward) +kubectl port-forward svc/hotel-reservation-app 8080:80 -n sc-mvp-test +curl http://localhost:8080/health +``` +## 4. Rollout Verification + +- **kubectl rollout status confirms deployment** + +- **Pod readiness and availability verified via probes** + +- **Service accessibility confirmed via port-forward** + +- **Logs and metadata captured for audit:** + +- - Pod status & restart count + +- - Image digest / tag + +- - Timestamps (apply/start/ready) + +- **Failure handling:** + +- - Automatic rollback or explicit failure state + +- - Logs preserved for auditing + +## 5. Artifact Integrity + +**Artifact: SHA256** +- Original: f465ef5a9022bb7d10c7bf324e816192c20493d5 +- Microsoft Official: + +## 6. Notes + +- Both documentation and code are included in this PR + +- Keeps planning, checkpoint, and execution in a single reviewable bundle + +- Supports future automation via SC-MVP-02 checkpoint YAML and GitHub Actions + + + + + + + +