Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .sc-mvp/checkpoints/sc-mvp-02-app-deploy.yaml
Original file line number Diff line number Diff line change
@@ -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: <SHA256-MICROSOFT-PLACEHOLDER>

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
12 changes: 12 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
12 changes: 12 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
61 changes: 61 additions & 0 deletions app/server.js
Original file line number Diff line number Diff line change
@@ -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}`);
});
54 changes: 54 additions & 0 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 16 additions & 0 deletions k8s/service.yaml
Original file line number Diff line number Diff line change
@@ -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
89 changes: 89 additions & 0 deletions sanity-desk/HOTEL RESERVATION APP MICROSERVICE ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -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)
Loading