Commit Graph

33 Commits

Author SHA1 Message Date
Matt c74525e113 Make phone, date_of_birth, address nullable in members table
Build and Push Docker Image / build (push) Successful in 1m53s Details
These fields can be filled in later by the user. The admin setup page
only collects essential fields (name, email, password).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 14:06:10 +01:00
Matt 7a184e8a5f Fix missing display_name in membership status creation
Build and Push Docker Image / build (push) Successful in 2m18s Details
The membership_statuses table requires display_name but the setup page
was not providing it when creating the initial Active status.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 14:00:53 +01:00
Matt cfbf7639c2 Add password setup script for Supabase roles
Build and Push Docker Image / build (push) Successful in 1m51s Details
The Supabase postgres image's internal migrate.sh requires supabase_admin
to have a password matching POSTGRES_PASSWORD. Added zz-set-passwords.sh
to run after init.sql and set passwords dynamically using the environment
variable.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 13:57:35 +01:00
Matt 0e93961bb9 Remove hardcoded supabase_admin password from init.sql
Build and Push Docker Image / build (push) Successful in 1m48s Details
The Supabase postgres image sets these passwords based on POSTGRES_PASSWORD.
Hardcoding 'postgres' caused the image's migrate.sh to fail.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:20:46 +01:00
Matt c8efc3859c Wrap storage operations in conditionals for fresh db init
Build and Push Docker Image / build (push) Successful in 1m46s Details
- storage.objects and storage.buckets are created by storage-api service
- Wrapped all storage bucket inserts and policy operations in DO blocks
- Check if table exists before running storage operations
- Prevents errors during initial database setup

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:14:32 +01:00
Matt ce3239598d Add auth helper functions (uid, role, jwt) to init.sql
Build and Push Docker Image / build (push) Successful in 1m45s Details
These functions are normally created by GoTrue but our init.sql
runs first. Needed for RLS policies that use auth.uid().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:12:33 +01:00
Matt 679f278075 Grant service_role full access to all public tables
Build and Push Docker Image / build (push) Successful in 1m46s Details
Added GRANT ALL for service_role on:
- membership_statuses, membership_types, members tables
- All tables and sequences in public schema
- Default privileges for future tables

Fixes 'permission denied' errors during admin setup.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:10:21 +01:00
Matt d4f47c5b20 Fix: Use dynamic env for SERVICE_ROLE_KEY
Build and Push Docker Image / build (push) Successful in 1m49s Details
$env/static/private reads at build time, not runtime.
Changed to $env/dynamic/private so the key is read at runtime
from the container environment.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:05:58 +01:00
Matt 4039ec8187 Remove FK references to auth.users from init.sql
Build and Push Docker Image / build (push) Successful in 1m55s Details
The auth.users table is created by GoTrue, not the database init.
FK constraints to auth.users fail because init.sql runs before auth starts.
Removed FK from members and audit_logs tables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 11:58:31 +01:00
Matt f599a37964 Remove shell-based healthchecks for minimal images
Build and Push Docker Image / build (push) Successful in 1m47s Details
- PostgREST and postgres-meta images don't have /bin/sh
- Removed CMD-SHELL healthchecks that were causing unhealthy status
- Changed dependent services from service_healthy to service_started

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 11:47:24 +01:00
Matt dec5e1950e Fix domain configuration for separate portal and API domains
Build and Push Docker Image / build (push) Successful in 1m59s Details
- Changed from single DOMAIN variable to PORTAL_DOMAIN and API_DOMAIN
- Matches nginx config: portal.monacousa.org, api.monacousa.org, studio.monacousa.org
- Updated docker-compose.yml to use correct domain variables with defaults
- Updated setup.sh to validate both domain variables
- Updated .env.example with separate domain configuration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 11:34:25 +01:00
Matt c92a7ee9b8 Update port mappings to match nginx config
Build and Push Docker Image / build (push) Successful in 1m55s Details
- Portal: 7453
- Studio: 7454
- Kong API: 7455

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 11:31:55 +01:00
Matt 35f9beabc6 Fix setup.sh: use awk instead of sed for robustness
Build and Push Docker Image / build (push) Successful in 1m53s Details
- Use openssl rand -hex for secrets (no special chars)
- Use awk instead of sed for .env updates (handles any chars)
- Use awk for kong.yml generation (handles JWT tokens)
- Suppress source errors for malformed .env

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 11:25:47 +01:00
Matt 4f4d0dd42e Fix .env.example: quote SMTP_SENDER_NAME value
Build and Push Docker Image / build (push) Has been cancelled Details
Values with spaces must be quoted for bash source command

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 11:24:20 +01:00
Matt 8cabe7d362 Remove Traefik from deploy package (use existing nginx)
Build and Push Docker Image / build (push) Successful in 1m52s Details
- Remove Traefik service and related labels
- Expose ports to localhost only (3000, 8000, 3001)
- Update README with nginx proxy configuration examples
- Remove ACME_EMAIL and Traefik auth from .env.example

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 11:18:55 +01:00
Matt 3187f5babb Add standalone production deployment package
Build and Push Docker Image / build (push) Successful in 1m46s Details
- docker-compose.yml: Standalone compose with Traefik, Supabase, portal
- init.sql: Combined database schema + all 16 migrations
- kong.yml.template: Kong config with API key placeholders
- setup.sh: Auto-generates secrets (JWT, passwords, API keys)
- .env.example: Comprehensive environment template
- README.md: Complete deployment guide

No source code cloning required - just copy files and run setup.sh

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 11:15:56 +01:00
Matt bcd5b955a3 Add script to update kong.yml with production API keys
Build and Push Docker Image / build (push) Successful in 1m38s Details
- Creates scripts/update-kong-keys.sh
- Reads ANON_KEY and SERVICE_ROLE_KEY from .env
- Generates kong.yml with correct API keys
- Run after setting up .env to configure Kong authentication

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 10:03:40 +01:00
Matt e4a40e1e40 Fix setup check to redirect when members table doesn't exist
Build and Push Docker Image / build (push) Successful in 1m49s Details
- Treat "table does not exist" errors as needing setup
- Redirect to /setup on unexpected errors (safer default)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 09:55:37 +01:00
Matt cd60c8ba32 Add database init script for Supabase schemas and roles
Build and Push Docker Image / build (push) Successful in 1m43s Details
- Create 00-init-schemas.sql that runs before Supabase init scripts
- Creates required roles: anon, authenticated, service_role, supabase_admin, etc.
- Creates required schemas: auth, storage, extensions, _realtime, graphql
- Sets up proper grants and permissions for Supabase services
- Mount init script to /docker-entrypoint-initdb.d/ in db container

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 09:51:21 +01:00
Matt 5bbf26e7a1 Add initial admin setup page and favicon support
Build and Push Docker Image / build (push) Successful in 2m2s Details
- Add /setup route for first-run admin user creation
- Add setup check hook to redirect to /setup when no users exist
- Fix storage container dependency (service_started vs service_healthy)
- Fix migrations mount path (don't overwrite Supabase init scripts)
- Add favicon and apple touch icon links to app.html
- Show success message on login after setup completion

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 09:36:25 +01:00
Matt a450e1afd9 Fix: Don't overwrite Supabase postgres init scripts
Build and Push Docker Image / build (push) Successful in 1m40s Details
Mounting to /docker-entrypoint-initdb.d was replacing the Supabase
postgres image's built-in initialization scripts that create the
auth schema, roles, etc. Now mounting to /migrations instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 03:25:50 +01:00
Matt 4836804dcb Remove conflicting schema migration
Build and Push Docker Image / build (push) Successful in 1m38s Details
The supabase/postgres image already has all required schemas and roles
pre-configured. The custom migration was conflicting with the image's
built-in initialization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 03:22:30 +01:00
Matt 4f78be3943 Add Kong config generator for production API keys
Build and Push Docker Image / build (push) Successful in 1m36s Details
Kong's declarative config doesn't support env vars, so API keys must be
embedded in kong.yml. Added generate-kong-config.sh script and integrated
it into deploy.sh to automatically generate kong.yml from .env values.

Run ./scripts/generate-kong-config.sh once after setting up .env, then
docker compose up -d will work correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 03:16:00 +01:00
Matt d0545e8aa7 Add Supabase schema initialization migration
Build and Push Docker Image / build (push) Successful in 1m46s Details
Creates required auth, storage, extensions, _realtime, and graphql_public
schemas that must exist before GoTrue can run its migrations. Also creates
necessary roles (anon, authenticated, service_role, supabase_admin) and
the base auth.users table structure.

Fixes: "no schema has been selected to create in (SQLSTATE 3F000)"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 03:14:00 +01:00
Matt 31d5942065 Use pre-built image from registry instead of local build
Build and Push Docker Image / build (push) Failing after 4m23s Details
2026-01-25 03:02:02 +01:00
Matt 4e1d31f3a4 Add production env template
Build and Push Docker Image / build (push) Successful in 1m40s Details
2026-01-25 02:42:45 +01:00
Matt 7fee4af60a Use placeholder JWT tokens for build (real keys injected at runtime)
Build and Push Docker Image / build (push) Successful in 1m37s Details
2026-01-25 02:38:39 +01:00
Matt bfc024a61f Update env template for portal.monacousa.org and use secrets in workflow
Build and Push Docker Image / build (push) Failing after 50s Details
2026-01-25 02:36:45 +01:00
Matt cb3703ec3a Use working Gitea workflow format with ubuntu-latest
Build and Push Docker Image / build (push) Successful in 1m45s Details
2026-01-25 02:28:16 +01:00
Matt c426d576fc Fix workflow: runs-on ubuntu
Build and Deploy / build (push) Waiting to run Details
2026-01-25 02:26:22 +01:00
Matt 886a1bca90 Fix workflow: use linux runner label for Gitea
Build and Deploy / build (push) Waiting to run Details
2026-01-25 02:24:11 +01:00
Matt c1871481d5 Add workflow to .github path for compatibility 2026-01-25 02:21:08 +01:00
Matt e7338d1a70 Initial production deployment setup
- Production docker-compose with nginx support
- Nginx configuration for portal.monacousa.org
- Deployment script with backup/restore
- Gitea CI/CD workflow
- Fix CountryFlag reactivity for dropdown flags

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 02:19:49 +01:00