forked from fahrPool/fahrPool
53 lines
2.7 KiB
Markdown
53 lines
2.7 KiB
Markdown
---
|
|
name: rebuild-master-stack
|
|
description: Rebuilds and restarts the docker-compose "web" service with the current master branch code, then verifies it's serving. Use only when the user explicitly asks to see their changes live in the master/production-like stack (e.g. after merging a feature branch).
|
|
disable-model-invocation: true
|
|
---
|
|
|
|
# Rebuild Master Stack
|
|
|
|
Only run this when the user explicitly asks (e.g. "rebuild the container", "show me this live", "restart the stack"). Never trigger it proactively — it restarts a shared, potentially-in-use service.
|
|
|
|
## Steps
|
|
|
|
1. Confirm you're operating from the main repo checkout (not a worktree), on `master`, with the change you want to deploy already merged there.
|
|
|
|
2. Rebuild the `web` image:
|
|
|
|
```bash
|
|
docker compose build web
|
|
```
|
|
|
|
If this is the first rebuild after a task that added new npm dependencies (check `web/package.json` diff against the previous deployed state), the build step already runs `npm install` inside the Docker build — no separate action needed there. But if you're instead testing directly against a local `npm run dev` outside Docker, remember to run `npm install` in `web/` yourself first (new dependencies aren't picked up automatically).
|
|
|
|
3. Restart just the `web` container with the new image:
|
|
|
|
```bash
|
|
docker compose up -d web
|
|
```
|
|
|
|
4. Verify it's actually serving the new code, not a stale cached image:
|
|
|
|
```bash
|
|
sleep 3
|
|
curl -s -o /dev/null -w "Status: %{http_code}\n" http://localhost:3000/login
|
|
docker exec aushilfsfahrer-web-1 sh -c "ls /app/.next/server/app/<new-route-added-by-this-change> 2>&1"
|
|
```
|
|
|
|
Pick a route that's specific to whatever just shipped (e.g. a new page directory) so you're confirming the *new* build actually landed, not just that *some* build is running.
|
|
|
|
5. If the merge included new Supabase migrations, apply them to the master stack's database too — it does **not** share a database with the local Supabase CLI dev stack (see the `supabase-local-dev` skill). Check which migrations are missing:
|
|
|
|
```bash
|
|
docker exec -i aushilfsfahrer-db-1 psql -U postgres -d postgres -c "select version from supabase_migrations.schema_migrations order by version;"
|
|
```
|
|
|
|
Apply any missing migration files directly and record them:
|
|
|
|
```bash
|
|
docker exec -i aushilfsfahrer-db-1 psql -U postgres -d postgres -v ON_ERROR_STOP=1 < supabase/migrations/<file>.sql
|
|
docker exec -i aushilfsfahrer-db-1 psql -U postgres -d postgres -c "insert into supabase_migrations.schema_migrations (version) values ('<version>') on conflict (version) do nothing;"
|
|
```
|
|
|
|
Report the admin login URL/credentials back to the user once verified (`admin@aushilfsfahrer.local` / `Admin123!`, or the current password — see the `supabase-local-dev` skill if it's been reset).
|