From 2de32b0c663f46727dcc4fc8144daacbb543ac66 Mon Sep 17 00:00:00 2001 From: default Date: Fri, 5 Jun 2026 00:38:29 +0000 Subject: [PATCH 1/7] Add rocket emoji to tagline --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f085eb6..423fe90 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Route Commerce -A multi-tenant B2B e-commerce platform for fresh produce wholesale distribution. Brands manage products, stops, orders, and wholesale customers from a single admin dashboard. +A multi-tenant B2B e-commerce platform for fresh produce wholesale distribution. Brands manage products, stops, orders, and wholesale customers from a single admin dashboard. 🚀 ## What It Does -- 2.43.0 From 988310fd50b807490b153b3f4f36110840d5f7cf Mon Sep 17 00:00:00 2001 From: tyler Date: Thu, 4 Jun 2026 18:42:58 -0600 Subject: [PATCH 2/7] Add Gitea Actions deploy workflow --- .gitea/workflows/deploy.yml | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..89bcd7f --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,57 @@ +name: Deploy to route.crispygoat.com + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + env: + NODE_ENV: production + + - name: Deploy + run: | + APP_DIR=/home/tyler/route-commerce + mkdir -p $APP_DIR + + # Copy build output and required files + rsync -a --delete .next/ $APP_DIR/.next/ + rsync -a --delete public/ $APP_DIR/public/ + cp package.json package-lock.json $APP_DIR/ + cp next.config.ts $APP_DIR/ 2>/dev/null || cp next.config.js $APP_DIR/ 2>/dev/null || true + + # Install production deps only + cd $APP_DIR + npm ci --omit=dev + + # Copy env if not already there + if [ ! -f $APP_DIR/.env.production ]; then + echo "WARNING: No .env.production found at $APP_DIR — app may not start correctly" + fi + + # Start or restart PM2 process + if pm2 describe route-commerce > /dev/null 2>&1; then + pm2 restart route-commerce + else + pm2 start npm --name route-commerce -- start -- -p 3100 + pm2 save + fi + + echo "Deployed successfully" -- 2.43.0 From 8ad8dbb25b36900222c0c2aff7b43a8b89a3f49e Mon Sep 17 00:00:00 2001 From: tyler Date: Thu, 4 Jun 2026 18:47:46 -0600 Subject: [PATCH 3/7] Remove npm cache from workflow (local runner) --- .gitea/workflows/deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 89bcd7f..99aec05 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -16,7 +16,6 @@ jobs: uses: actions/setup-node@v4 with: node-version: '22' - cache: 'npm' - name: Install dependencies run: npm ci -- 2.43.0 From fddb9178c07d85022c01a40ffdc12119b301de4d Mon Sep 17 00:00:00 2001 From: tyler Date: Thu, 4 Jun 2026 18:48:21 -0600 Subject: [PATCH 4/7] Use npm install instead of npm ci (no lockfile) --- .gitea/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 99aec05..0b574a7 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -18,7 +18,7 @@ jobs: node-version: '22' - name: Install dependencies - run: npm ci + run: npm install - name: Build run: npm run build @@ -38,7 +38,7 @@ jobs: # Install production deps only cd $APP_DIR - npm ci --omit=dev + npm install --omit=dev # Copy env if not already there if [ ! -f $APP_DIR/.env.production ]; then -- 2.43.0 From beac3e48f1ed5e03723e774461d9ef78bed1837b Mon Sep 17 00:00:00 2001 From: tyler Date: Thu, 4 Jun 2026 18:52:02 -0600 Subject: [PATCH 5/7] Load .env.production from server before build --- .gitea/workflows/deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 0b574a7..db21714 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -20,6 +20,9 @@ jobs: - name: Install dependencies run: npm install + - name: Load env + run: cp /home/tyler/route-commerce/.env.production .env.production + - name: Build run: npm run build env: -- 2.43.0 From e8f2d76637085d6a9e70151460b803cad695604b Mon Sep 17 00:00:00 2001 From: tyler Date: Thu, 4 Jun 2026 18:53:11 -0600 Subject: [PATCH 6/7] Fix workflow: use actual secrets, fix env file writing --- .gitea/workflows/deploy.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index db21714..02712cc 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -20,34 +20,44 @@ jobs: - name: Install dependencies run: npm install - - name: Load env - run: cp /home/tyler/route-commerce/.env.production .env.production - - name: Build run: npm run build env: NODE_ENV: production + NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} + NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }} + SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} + MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }} + MINIMAX_BASE_URL: ${{ secrets.MINIMAX_BASE_URL }} - name: Deploy + env: + NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} + NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }} + SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} + MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }} + MINIMAX_BASE_URL: ${{ secrets.MINIMAX_BASE_URL }} run: | APP_DIR=/home/tyler/route-commerce mkdir -p $APP_DIR + # Write env file from secrets + printf "NEXT_PUBLIC_SUPABASE_URL=%s\n" "$NEXT_PUBLIC_SUPABASE_URL" > $APP_DIR/.env.production + printf "NEXT_PUBLIC_SUPABASE_ANON_KEY=%s\n" "$NEXT_PUBLIC_SUPABASE_ANON_KEY" >> $APP_DIR/.env.production + printf "SUPABASE_SERVICE_ROLE_KEY=%s\n" "$SUPABASE_SERVICE_ROLE_KEY" >> $APP_DIR/.env.production + printf "MINIMAX_API_KEY=%s\n" "$MINIMAX_API_KEY" >> $APP_DIR/.env.production + printf "MINIMAX_BASE_URL=%s\n" "$MINIMAX_BASE_URL" >> $APP_DIR/.env.production + # Copy build output and required files rsync -a --delete .next/ $APP_DIR/.next/ rsync -a --delete public/ $APP_DIR/public/ - cp package.json package-lock.json $APP_DIR/ + cp package.json $APP_DIR/ cp next.config.ts $APP_DIR/ 2>/dev/null || cp next.config.js $APP_DIR/ 2>/dev/null || true # Install production deps only cd $APP_DIR npm install --omit=dev - # Copy env if not already there - if [ ! -f $APP_DIR/.env.production ]; then - echo "WARNING: No .env.production found at $APP_DIR — app may not start correctly" - fi - # Start or restart PM2 process if pm2 describe route-commerce > /dev/null 2>&1; then pm2 restart route-commerce -- 2.43.0 From 367a5625f33f613df207cbbc054f33d3a3955d2a Mon Sep 17 00:00:00 2001 From: default Date: Fri, 5 Jun 2026 01:19:10 +0000 Subject: [PATCH 7/7] Add self-hosted Postgres docker-compose - docker-compose.yml: Postgres 16 Alpine with named volume, healthcheck - .env.example: POSTGRES_* and DATABASE_URL template - .gitignore: exclude db_data/ volume Starting fresh, no data migration. App still wired to Supabase; DB is ready for migrations to be applied. --- .env.example | 15 +++++++++++++++ .gitignore | 4 +++- docker-compose.yml | 25 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .env.example create mode 100644 docker-compose.yml diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..1448d7c --- /dev/null +++ b/.env.example @@ -0,0 +1,15 @@ +# --- Self-hosted Postgres (Docker) --- +POSTGRES_USER=routecommerce +POSTGRES_PASSWORD=change-me-strong-password +POSTGRES_DB=route_commerce +# Used by the app and push-migrations.js to talk to the local DB +DATABASE_URL=postgresql://routecommerce:change-me-strong-password@127.0.0.1:5432/route_commerce?schema=public + +# --- Supabase (legacy, can be removed once app is rewired) --- +NEXT_PUBLIC_SUPABASE_URL= +NEXT_PUBLIC_SUPABASE_ANON_KEY= +SUPABASE_SERVICE_ROLE_KEY= + +# --- App secrets --- +MINIMAX_API_KEY= +MINIMAX_BASE_URL= diff --git a/.gitignore b/.gitignore index 81d5216..c49893a 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,6 @@ supabase/.temp/ # IDE / local config .mcp.json -.env* + +# Docker / self-hosted Postgres +db_data/ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..64450d4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +services: + db: + image: postgres:16-alpine + container_name: route_commerce_db + restart: unless-stopped + env_file: + - .env + environment: + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: ${POSTGRES_DB} + volumes: + - db_data:/var/lib/postgresql/data + ports: + - "127.0.0.1:5432:5432" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] + interval: 5s + timeout: 5s + retries: 5 + start_period: 10s + +volumes: + db_data: + driver: local -- 2.43.0