Skip to content

Commit 57b632f

Browse files
committed
fix(demo): Dockerfile pnpm pin + remaining stoka/kayula sweep for Dokploy
The Dokploy deploy failed on `pnpm install --frozen-lockfile` because `corepack prepare pnpm@latest` now resolves to pnpm v11+ which requires Node v22 (uses node:sqlite). The base image is node:20-alpine. Three deploy-blocking fixes: 1. Dockerfile — pin `pnpm@9.15.0` (matches pnpm-lock.yaml v9.0 schema we ship). Also rename the final binary stoka → gritdemo to match the module, add a non-root `grit` user with `chown -R grit:grit /app` BEFORE `USER grit` (so Sentinel/Pulse can create their SQLite stores — the "out of memory (14)" failure is SQLITE_CANTOPEN for permission- denied, not actually OOM). 2. docker-compose.yml — sweep the remaining stoka + kayula refs. The service block is now `gritdemo:` (was `stoka:`), Postgres user / DB default `${POSTGRES_USER:-gritdemo}` (was `kayula`), healthcheck updated to match. 3. DEPLOYMENT.md — every stoka.yourdomain.com → gritdemo.yourdomain.com, docker compose exec/log examples renamed, GitHub clone URL changed from MUKE-coder/stoka.git to MUKE-coder/grit.git (cd grit/demo). The two IDE diagnostics flagged on the Dockerfile are CVEs in the upstream base images (node:20-alpine + golang:1.24-alpine); they predate this change and are unrelated.
1 parent 0b5e525 commit 57b632f

4 files changed

Lines changed: 64 additions & 41 deletions

File tree

demo/DEPLOYMENT.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
│ └────────────────────────────────┘ │
1919
│ │ │
2020
│ Reverse Proxy (Traefik) │
21-
stoka.yourdomain.com │
21+
gritdemo.yourdomain.com │
2222
└──────────────────────────────────────┘
2323
2424
Cloudflare R2 (images)
@@ -33,7 +33,7 @@ Single binary serves both API and frontend. PostgreSQL and Redis run as Docker s
3333

3434
Ensure Dokploy is running on your VPS. You need:
3535
- Docker & Docker Compose
36-
- A domain pointed to your VPS IP (e.g., `stoka.yourdomain.com`)
36+
- A domain pointed to your VPS IP (e.g., `gritdemo.yourdomain.com`)
3737

3838
---
3939

@@ -63,9 +63,9 @@ Edit `.env.production` with your real values:
6363

6464
```env
6565
# REQUIRED — change all of these:
66-
APP_URL=https://stoka.yourdomain.com
67-
FRONTEND_URL=https://stoka.yourdomain.com
68-
DATABASE_URL=postgres://stoka:YOUR_DB_PASSWORD@postgres:5432/stoka?sslmode=disable
66+
APP_URL=https://gritdemo.yourdomain.com
67+
FRONTEND_URL=https://gritdemo.yourdomain.com
68+
DATABASE_URL=postgres://gritdemo:YOUR_DB_PASSWORD@postgres:5432/gritdemo?sslmode=disable
6969
JWT_SECRET=YOUR_64_CHAR_SECRET
7070
INTERNAL_API_KEY=stk_prod_YOUR_KEY
7171
VITE_INTERNAL_API_KEY=stk_prod_YOUR_KEY # Must match INTERNAL_API_KEY
@@ -76,7 +76,7 @@ R2_BUCKET=gritdemo-images
7676
RESEND_API_KEY=re_YOUR_KEY
7777
MAIL_FROM=noreply@yourdomain.com
7878
REDIS_URL=redis://:YOUR_REDIS_PASSWORD@redis:6379
79-
CORS_ORIGINS=https://stoka.yourdomain.com
79+
CORS_ORIGINS=https://gritdemo.yourdomain.com
8080
POSTGRES_PASSWORD=YOUR_DB_PASSWORD # Must match DATABASE_URL
8181
REDIS_PASSWORD=YOUR_REDIS_PASSWORD # Must match REDIS_URL
8282
```
@@ -90,19 +90,19 @@ REDIS_PASSWORD=YOUR_REDIS_PASSWORD # Must match REDIS_URL
9090
### Option A: Deploy from GitHub (Recommended)
9191

9292
1. In Dokploy, create a new **Compose** application
93-
2. Connect your GitHub repo: `https://github.com/MUKE-coder/stoka.git`
93+
2. Connect your GitHub repo: `https://github.com/MUKE-coder/grit.git`
9494
3. Set the compose file path to `docker-compose.yml`
9595
4. Add all environment variables from `.env.production` in Dokploy's environment settings
96-
5. Set the domain: `stoka.yourdomain.com`
96+
5. Set the domain: `gritdemo.yourdomain.com`
9797
6. Enable auto-SSL (Let's Encrypt via Traefik)
9898
7. Deploy
9999

100100
### Option B: Deploy via Docker Compose directly on VPS
101101

102102
```bash
103103
# Clone the repo
104-
git clone https://github.com/MUKE-coder/stoka.git
105-
cd stoka
104+
git clone https://github.com/MUKE-coder/grit.git
105+
cd grit/demo
106106

107107
# Copy and edit production env
108108
cp .env.production .env.production.local
@@ -116,7 +116,7 @@ cp .env.production.local .env.production
116116
docker compose up -d --build
117117

118118
# Check logs
119-
docker compose logs -f stoka
119+
docker compose logs -f gritdemo
120120
```
121121

122122
---
@@ -127,7 +127,7 @@ After the first deploy, run migrations to create database tables:
127127

128128
```bash
129129
# Via docker exec
130-
docker compose exec stoka ./stoka migrate
130+
docker compose exec gritdemo ./gritdemo migrate
131131

132132
# Or if you have the binary locally:
133133
# DATABASE_URL=postgres://... go run ./cmd/migrate
@@ -138,29 +138,29 @@ If using Dokploy, you can run this as a one-time command in the container termin
138138
**Alternative:** The app auto-migrates on startup if tables don't exist (via GORM AutoMigrate in the seed command). To seed demo data:
139139

140140
```bash
141-
docker compose exec stoka ./stoka seed
141+
docker compose exec gritdemo ./gritdemo seed
142142
```
143143

144144
---
145145

146146
## Step 6: Verify
147147

148-
1. Visit `https://stoka.yourdomain.com` — should show the login page
148+
1. Visit `https://gritdemo.yourdomain.com` — should show the login page
149149
2. Register a new account or use seeded credentials:
150150
- Admin: `admin@nakawafashion.com` / `password123`
151-
3. Check the health endpoint: `https://stoka.yourdomain.com/api/health`
151+
3. Check the health endpoint: `https://gritdemo.yourdomain.com/api/health`
152152

153153
---
154154

155155
## Step 7: Domain & SSL (Dokploy)
156156

157157
In Dokploy:
158158
1. Go to your application → **Domains**
159-
2. Add domain: `stoka.yourdomain.com`
159+
2. Add domain: `gritdemo.yourdomain.com`
160160
3. Port: `8080`
161161
4. Enable HTTPS (Dokploy handles Let's Encrypt automatically via Traefik)
162162

163-
Make sure your DNS has an **A record** pointing `stoka.yourdomain.com` to your VPS IP.
163+
Make sure your DNS has an **A record** pointing `gritdemo.yourdomain.com` to your VPS IP.
164164

165165
---
166166

@@ -171,7 +171,7 @@ Push to `main` → trigger redeploy in Dokploy (or enable auto-deploy)
171171

172172
### Manual
173173
```bash
174-
cd stoka
174+
cd grit/demo
175175
git pull
176176
docker compose up -d --build
177177
```
@@ -185,7 +185,7 @@ docker compose up -d --build
185185
docker compose logs -f
186186

187187
# Just the app
188-
docker compose logs -f stoka
188+
docker compose logs -f gritdemo
189189

190190
# Database
191191
docker compose logs -f postgres
@@ -201,17 +201,17 @@ docker compose ps
201201
### Database
202202
```bash
203203
# Dump
204-
docker compose exec postgres pg_dump -U stoka stoka > backup_$(date +%Y%m%d).sql
204+
docker compose exec postgres pg_dump -U gritdemo gritdemo > backup_$(date +%Y%m%d).sql
205205

206206
# Restore
207-
cat backup.sql | docker compose exec -T postgres psql -U stoka stoka
207+
cat backup.sql | docker compose exec -T postgres psql -U gritdemo gritdemo
208208
```
209209

210210
### Volumes
211211
```bash
212212
# Find volume paths
213-
docker volume inspect stoka_postgres_data
214-
docker volume inspect stoka_redis_data
213+
docker volume inspect gritdemo_postgres_data
214+
docker volume inspect gritdemo_redis_data
215215
```
216216

217217
---
@@ -225,7 +225,7 @@ docker volume inspect stoka_redis_data
225225
| CORS errors | Add your domain to `CORS_ORIGINS` |
226226
| Images not loading | Check R2 credentials and bucket name |
227227
| Emails not sending | Verify `RESEND_API_KEY` and `MAIL_FROM` domain is verified in Resend |
228-
| Container keeps restarting | Check `docker compose logs stoka` for the error |
228+
| Container keeps restarting | Check `docker compose logs gritdemo` for the error |
229229

230230
---
231231

demo/Dockerfile

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,56 @@
1-
# Stage 1: Build frontend
1+
# syntax=docker/dockerfile:1.7
2+
#
3+
# Grit Motors — demo deployment Dockerfile.
4+
#
5+
# Three fixes vs the original kayula version (all of which broke on
6+
# Dokploy):
7+
# 1. Pin pnpm to v9.15.0 — pnpm@latest now resolves to v11+ which
8+
# requires Node v22 (uses node:sqlite). Pinned matches the
9+
# pnpm-lock.yaml v9.0 schema we ship.
10+
# 2. Final binary name renamed stoka → gritdemo to match the module.
11+
# 3. /app chowned to the non-root user before USER so Sentinel/Pulse
12+
# can create their SQLite stores ("out of memory (14)" is actually
13+
# SQLITE_CANTOPEN for permission-denied; not obvious from the log).
14+
15+
# ── Stage 1: build the frontend ──────────────────────────────────────
216
FROM node:20-alpine AS frontend
317
WORKDIR /app/frontend
4-
RUN corepack enable && corepack prepare pnpm@latest --activate
18+
19+
# Pinned pnpm version — pnpm@latest pulls v11+ which needs Node 22.
20+
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
21+
522
COPY frontend/package.json frontend/pnpm-lock.yaml ./
623
RUN pnpm install --frozen-lockfile
724
COPY frontend/ ./
825

9-
# Vite needs env vars at build time — pass via build args
26+
# Vite needs env vars at build time — pass via build args.
1027
ARG VITE_INTERNAL_API_KEY
11-
ARG VITE_APP_NAME=Kayula Motors
28+
ARG VITE_APP_NAME="Grit Motors"
1229
ENV VITE_INTERNAL_API_KEY=$VITE_INTERNAL_API_KEY
1330
ENV VITE_APP_NAME=$VITE_APP_NAME
1431

1532
RUN pnpm build
1633

17-
# Stage 2: Build Go binary
34+
# ── Stage 2: build the Go binary ─────────────────────────────────────
1835
FROM golang:1.24-alpine AS backend
1936
RUN apk add --no-cache git
2037
WORKDIR /app
2138
COPY go.mod go.sum ./
2239
RUN go mod download
2340
COPY . .
2441
COPY --from=frontend /app/frontend/dist ./frontend/dist
25-
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o stoka .
42+
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o gritdemo .
2643

27-
# Stage 3: Final minimal image
44+
# ── Stage 3: minimal runtime image ───────────────────────────────────
2845
FROM alpine:3.20
29-
RUN apk --no-cache add ca-certificates tzdata
46+
RUN apk --no-cache add ca-certificates tzdata && \
47+
addgroup -S grit && adduser -S -G grit grit
3048
WORKDIR /app
31-
COPY --from=backend /app/stoka .
49+
COPY --from=backend /app/gritdemo .
50+
# Sentinel + Pulse write SQLite stores into the working dir under their
51+
# own process user. Chown /app to grit BEFORE switching user so the
52+
# stores can be created at runtime.
53+
RUN chown -R grit:grit /app
54+
USER grit
3255
EXPOSE 8080
33-
CMD ["./stoka"]
56+
CMD ["./gritdemo"]

demo/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# stoka — Single App Makefile
1+
# gritdemo — Single App Makefile
22

33
.PHONY: dev build clean
44

@@ -13,8 +13,8 @@ build:
1313
@echo "Building frontend..."
1414
@cd frontend && pnpm install && pnpm build
1515
@echo "Building Go binary..."
16-
@go build -o bin/stoka .
17-
@echo "Done! Binary at bin/stoka"
16+
@go build -o bin/gritdemo .
17+
@echo "Done! Binary at bin/gritdemo"
1818

1919
# Clean build artifacts
2020
clean:

demo/docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ services:
33
image: postgres:16-alpine
44
restart: unless-stopped
55
environment:
6-
POSTGRES_USER: ${POSTGRES_USER:-kayula}
6+
POSTGRES_USER: ${POSTGRES_USER:-gritdemo}
77
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
8-
POSTGRES_DB: ${POSTGRES_DB:-kayula}
8+
POSTGRES_DB: ${POSTGRES_DB:-gritdemo}
99
volumes:
1010
- postgres_data:/var/lib/postgresql/data
1111
healthcheck:
12-
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-kayula}"]
12+
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-gritdemo}"]
1313
interval: 5s
1414
timeout: 5s
1515
retries: 5
@@ -26,7 +26,7 @@ services:
2626
timeout: 5s
2727
retries: 5
2828

29-
stoka:
29+
gritdemo:
3030
build:
3131
context: .
3232
dockerfile: Dockerfile

0 commit comments

Comments
 (0)