Commit Graph

190 Commits

Author SHA1 Message Date
soroush.asadi 979dcaa949 fix: route all Docker builds through local Nexus mirrors
- All Node Dockerfiles rewritten with NODE_IMAGE + NPM_REGISTRY build args
  defaulting to local Nexus proxies (171.22.25.73:5000/library/node:20-alpine
  and http://mirror:8081/repository/npm-group/)
- Add extra_hosts: mirror:host-gateway to every build section so the
  mirror hostname resolves during docker build
- Replace nuget.org with nuget.docker.config (Nexus mirror) in api/admin-api
  Dockerfiles to fix NuGet restore in Iranian network
- Rewrite admin-web and website Dockerfiles (were referencing non-existent
  meezi-node:20-alpine base image with no npm install step)
- Update dotnet image defaults to 171.22.25.73:5002 MCR proxy in admin-api
  and docker-compose.admin.yml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 21:01:43 +03:30
Soroush.Asadi b1365c501e CI CD 2 2026-05-28 20:43:35 +03:30
Soroush.Asadi 96dad89016 CI CD 2026-05-28 19:50:23 +03:30
Soroush.Asadi d5a3056bfb Merge branch 'main' of https://github.com/codesoroush/Meezi 2026-05-28 19:28:56 +03:30
soroush.asadi 25154f9dd9 fix(ci): set PATH in deploy job so docker binary is found
act runner (host mode) inherits a minimal PATH from the process
environment — docker is not found even though it is installed.
Explicitly include all standard locations plus /snap/bin.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 19:28:15 +03:30
Soroush.Asadi 665de97c49 ci : workflow updated 15 2026-05-28 19:18:24 +03:30
soroush.asadi 34040503cf docs: rewrite DEPLOY.md with self-hosted setup guide
Replaces outdated Arvan Cloud instructions with the current
self-hosted stack: Gitea CI, Nexus mirror, Docker Compose,
IP-based access today and Caddy+domain tomorrow.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 19:06:28 +03:30
soroush.asadi cb80afaf42 fix(ci): replace actions/checkout@v4 in deploy job with shell git
Node.js is not in PATH on the self-hosted:host runner, so JS actions
(actions/checkout@v4) fail with "cannot find node". Use the same shell
git init/fetch/checkout pattern used in all other jobs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 18:57:58 +03:30
soroush.asadi 88a9f96108 feat(infra): parameterize secrets, add Caddy reverse proxy for domain
All hardcoded passwords/keys replaced with env vars so .env controls
everything in both dev and production:
  - DB_PASSWORD, DB_CONNECTION_STRING, JWT_KEY
  - CORS_ORIGIN_*, ASPNETCORE_ENVIRONMENT
  - All ZarinPal/Kavenegar/Snappfood secrets

New files for tomorrow's domain setup:
  - Caddyfile        → routes all subdomains with auto TLS
  - docker-compose.caddy.yml → adds Caddy service to the stack

.env.example now has clear TODAY (IP) vs TOMORROW (domain) sections.
Fixed hardcoded ZarinPal MerchantId in docker-compose.full.yml.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 18:54:55 +03:30
soroush.asadi 0a33497d40 feat(admin-web): add web/admin to repo
Initial commit of the Super-Admin web panel (Next.js + TypeScript).
CI admin-web-check job was failing because the directory was never
tracked in git.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 18:46:25 +03:30
Soroush.Asadi f717c02467 Merge branch 'main' of https://github.com/codesoroush/Meezi 2026-05-28 18:34:56 +03:30
soroush.asadi 539165b6bb fix(ci): replace python3 with cat heredoc; sync local registry IPs
python3 is not in PATH inside dotnet/sdk:10.0 container — replace the
"Write NuGet config" step with a cat heredoc which works in any container.

Also syncs GitHub with the Gitea-side changes:
  - All images pulled from local Nexus mirrors (no internet round-trip)
      171.22.25.73:5000 → docker-hub-proxy (node, postgres, redis)
      171.22.25.73:5002 → mcr-proxy        (dotnet/sdk)
  - npm steps already on npm-group (Liara + Runflare fallback)
  - docker-compose.mirror.yml: expose port 5002 for mcr-proxy

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 18:34:06 +03:30
Soroush.Asadi da81be926a ci : workflow updated 13 2026-05-28 18:24:29 +03:30
Soroush.Asadi 37afa965e7 ci : workflow updated 12 2026-05-28 18:08:49 +03:30
soroush.asadi 720bab457e feat(mirror): add Liara npm/PyPI/Ubuntu APT mirrors to Nexus
Adds mirrors/nexus/add-liara-mirrors.sh that provisions:
  - npm-liara-proxy  → https://package-mirror.liara.ir/repository/npm/
  - npm-group        → npm-liara-proxy + npm-proxy (Liara first, Runflare fallback)
  - pypi-liara-proxy → https://package-mirror.liara.ir/repository/pypi/
  - pypi-group       → pypi-liara-proxy + pypi-proxy
  - ubuntu-proxy     → http://linux-mirror.liara.ir/repository/ubuntu/
  - ubuntu-security-proxy → http://linux-mirror.liara.ir/repository/ubuntu-security/

Also updates CI npm install steps to use npm-group instead of npm-proxy
so all four Node.js jobs benefit from the Liara-first, Runflare-fallback
group from day one.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 17:35:01 +03:30
soroush.asadi f825c72ca2 perf(ci): replace apk add git with Gitea archive API for Node.js jobs
apk add git downloads from dl-cdn.alpinelinux.org (Fastly CDN) which is
slow/blocked in Iran — caused 6m+ checkout times.

New approach: wget the repo tarball from Gitea's archive API endpoint.
wget + tar (busybox) are already in node:20-alpine — no package install.
Gitea is on the same machine as the runner = download is instant.

GET /api/v1/repos/{owner}/{repo}/archive/{sha}.tar.gz
Authorization: Bearer {token}

dotnet/sdk jobs unchanged — Debian base has git pre-installed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 17:12:49 +03:30
soroush.asadi ca17cffee6 fix(ci): write NuGet config inline to allow HTTP source (NU1302)
NuGet 10 blocks HTTP sources by default. allowInsecureConnections=true
must be set in a config file — the --source CLI flag doesn't support it.

Write the config to /tmp/nuget.ci.config inline in the step so there is
no dependency on any file existing in the workspace.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 16:55:19 +03:30
soroush.asadi 32d9900e07 fix(ci): use --source flag instead of --configfile for NuGet restore
--configfile nuget.mirror.config fails when the file isn't present in
the workspace (e.g. when Gitea is behind GitHub on commits).

--source inline URL is simpler, self-contained, and replaces all
configured sources — no extra file dependency in CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 16:39:36 +03:30
soroush.asadi 3cb39c9b81 fix(mirror): Docker proxy port is 5000 not 8083 (matches Nexus httpPort config)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 16:33:04 +03:30
soroush.asadi d8e26c6fad fix(mirror): point NuGet source to nuget-group (was nuget-proxy which doesn't exist)
nuget-group aggregates nuget.org-proxy (Liara) and nuget-runflare-proxy
(Runflare) — automatic fallback if one upstream is down.

npm-proxy and docker-hub-proxy names match exactly, no changes needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 16:28:18 +03:30
soroush.asadi 7321c59e43 fix(mirror): Nexus Docker proxy with optional Liara upstream + credential support
provision.sh: Docker proxy defaults to registry-1.docker.io (works directly
  from VPS). Set DOCKER_MIRROR_URL/USER/PASS env vars to route through
  docker-mirror.liara.ir once Liara credentials are obtained.

update-docker-upstream.sh: swap Docker proxy upstream at any time without
  re-running the full provision (useful after getting Liara credentials).

indexType auto-selects: HUB for docker.io direct, REGISTRY for Liara/Harbor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 15:56:22 +03:30
soroush.asadi 61e44c63ab refactor(mirror): replace 3 services with single Nexus Repository Manager
Consolidates BaGet + Verdaccio + registry:2 into one Sonatype Nexus OSS
instance with a REST API provisioning script.

docker-compose.mirror.yml: single nexus service, ports 8081 (UI/NuGet/npm)
  and 8083 (Docker Hub pull-through proxy)
mirrors/nexus/provision.sh: idempotent setup — changes admin password,
  enables anonymous access, creates nuget-proxy / npm-proxy / docker-hub-proxy
nuget.mirror.config: updated source URL to Nexus NuGet proxy endpoint
ci-cd.yml: updated npm --registry to Nexus npm proxy endpoint

Run once on server: docker compose -f docker-compose.mirror.yml up -d
  then: ./mirrors/nexus/provision.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 14:35:55 +03:30
soroush.asadi 6f85cfe4d3 feat(infra): add local pull-through mirrors for NuGet, npm, Docker Hub
docker-compose.mirror.yml:
  - BaGet  (port 5101) → proxies nuget.org
  - Verdaccio (port 4873) → proxies npmjs.com
  - registry:2 (port 5100) → proxies Docker Hub

nuget.mirror.config: points dotnet restore at http://mirror:5101
mirrors/verdaccio/config.yaml: open reads, upstream npmjs fallback

CI workflow:
  - All container jobs: --add-host=mirror:host-gateway
  - dotnet restore --configfile nuget.mirror.config
  - npm install --registry http://mirror:4873

First run: packages fetched from upstream through the VPS.
All subsequent runs: served from local disk, no CDN needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 14:31:12 +03:30
soroush.asadi c452df8988 fix(ci): add --add-host=gitea:host-gateway to all container jobs
github.server_url returns 'http://gitea:3000' (Gitea ROOT_URL using Docker
service name). CI job containers run on an isolated network and can't resolve
the 'gitea' hostname.

host-gateway maps to the Docker bridge IP (172.17.0.1). Gitea publishes
port 3000 on all interfaces, so http://gitea:3000 becomes reachable inside
every job container via the bridge.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 11:59:45 +03:30
soroush.asadi 8ddb427edd fix(ci): replace actions/checkout with shell git for container jobs
actions/checkout@v4 is a JS action executed inside the job container:
- dotnet/sdk:10.0 has no Node.js  → exit 127
- node:20-alpine  has no git      → checkout fails

Fix: manual git clone via shell using http.extraheader for token auth.
Token never appears in process list or git log. deploy job (self-hosted:host)
keeps actions/checkout — the act_runner image has both node and git.

Also removes defaults.run.working-directory from Node.js jobs (the checkout
step must start in workspace root, not web/<app>).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 11:46:34 +03:30
soroush.asadi 6c868f5f30 fix(ci): use docker:// runner mode with pre-built SDK images
Switch CI jobs to container: image: overrides so jobs run inside official
SDK containers (dotnet/sdk:10.0, node:20-alpine) instead of the bare
runner container. This bypasses blocked CDN downloads for dotnet/node.

Deploy job stays on self-hosted:host where Docker CLI is available.
Update workflow comments to explain the required runner label config:
  ubuntu-latest:docker://node:20-alpine (CI jobs)
  self-hosted:host (deploy)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 11:27:49 +03:30
soroush.asadi dcddcf77d6 Fix Gitea CI stuck at setup-dotnet/setup-node due to blocked CDNs
Root cause: actions/setup-dotnet@v4 downloads .NET from
download.visualstudio.microsoft.com and actions/setup-node@v4 downloads
Node from nodejs.org — both CDNs are blocked from Iran so jobs hang at 0s.

Fix:
- All .NET jobs: add container: mcr.microsoft.com/dotnet/sdk:10.0
  so .NET is already inside the image — no download needed.
  Remove actions/setup-dotnet step entirely.
- All Node.js jobs: add container: node:20-alpine
  so Node/npm are already inside the image — no download needed.
  Remove actions/setup-node step entirely.
- api-build: add postgres + redis service containers + env vars so
  dotnet test can actually connect to a database (was silently failing).
- deploy job: change back to runs-on: self-hosted
  ubuntu-latest containers don't have Docker CLI — docker compose
  commands would fail immediately. Deploy MUST run on the server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 11:08:42 +03:30
soroush.asadi 8f81a62ec9 Redesign menu admin screen with two-panel layout and modal forms
UX improvements:
- Two-panel layout: sticky category sidebar (desktop) + items grid
- Mobile: horizontal scrolling category pills above items
- Category sidebar shows item count badge per category; edit on hover
- Items search bar + instant filter (name, English name, Arabic name)
- Category filter drives items grid (click sidebar = filter items)
- Item cards: image hover reveals Edit button (progressive disclosure)
- Out-of-stock overlay + inline toggle switch (replaces text button)
- Add/Edit item opens in clean modal overlay (no jarring inline expansion)
- Add/Edit category opens in separate modal
- nameEn made optional (was blocking new item creation)
- Consolidated form state with single object per form
- Empty state with illustration and Add CTA
- Skeleton loading grid
- Branch overrides tab wired to branchId from store
- New i18n keys for search, counts, states in en/fa/ar

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 08:10:25 +03:30
soroush.asadi 79deab543a Redesign POS order flow with order type picker and counter/takeaway support
- Add OrderTypePicker screen: Table / Counter / Takeaway cards shown when no
  active session, replacing the old always-visible table board
- Move PosTableBoard into a modal overlay (opens on Table selection or
  "Assign Table" for counter orders)
- Add orderType field + setOrderType action to cart store
- Counter and Takeaway orders no longer require a table to submit
- Add "Assign Table →" button in cart for counter orders with active session
- Rewrite category tabs as horizontal scrollable row (no wrapping)
- Larger product cards with 4:3 thumbnail + quantity badge overlay
- Bigger quantity controls (h-8 w-8) and "New order" back button in header
- Add i18n keys for order types in en/fa/ar

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 00:07:58 +03:30
soroush.asadi 9ed305e5bd ci: change all runners from self-hosted to ubuntu-latest 2026-05-27 23:55:26 +03:30
soroush.asadi 284920544b ci: add missing admin-api and admin-web to full CI/CD pipeline
CI now covers all 6 services:
- api-build: Meezi.API dotnet build + test
- admin-api-build: Meezi.Admin.API dotnet build (was missing)
- dashboard-check: web/dashboard tsc
- admin-web-check: web/admin tsc (was missing)
- website-check: web/website tsc (was missing)
- finder-check: web/finder tsc

Deploy now builds and starts all 8 containers:
- Main: postgres, redis, api, web, website, finder
- Admin: admin-api, admin-web (via docker-compose.admin.yml overlay)
- Health checks for both meezi-api and meezi-admin-api

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-27 23:53:49 +03:30
soroush.asadi 64b488ac89 ci: add Gitea Actions workflow (CI + self-hosted deploy)
.gitea/workflows/ci-cd.yml:
- Triggers on push to main and PRs
- CI jobs: dotnet build/test, dashboard tsc, finder tsc (all self-hosted)
- Deploy job: only on push to main, needs all CI jobs to pass
  - Writes .env from ENV_FILE secret (set in Gitea repo settings)
  - docker compose build --parallel with BuildKit
  - Rolling restart (postgres/redis untouched)
  - Health-check poll: waits up to 2min for meezi-api healthy
  - Auto-prunes old images on success

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-27 23:21:29 +03:30
soroush.asadi ac8a9442e3 ci: proper CI + self-hosted runner deploy workflow
ci.yml — runs on GitHub's servers (free):
- API: dotnet build + test with Postgres/Redis service containers
- Dashboard + Finder: TypeScript typecheck (tsc --noEmit)

deploy.yml — runs on YOUR Linux server (self-hosted runner):
- Triggers on every push to main
- docker compose build --parallel (BuildKit cache)
- Rolling restart with --no-deps --remove-orphans
- Health-check poll: waits up to 2min for API healthy
- Auto-prunes old images after successful deploy

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-27 21:45:39 +03:30
soroush.asadi a85890f30a chore: Flutter mobile app, CI, and dev tooling
- mobile/: Flutter/Dart merchant mobile app skeleton
- .github/: GitHub Actions CI workflows
- .dockerignore: exclude host node_modules from build context
- .cursorrules: Cursor IDE project rules
- .claude/: Claude Code project settings and launch config

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-27 21:35:27 +03:30
soroush.asadi 42d4cb896a feat(finder): AI-powered cafe finder PWA with Next.js 16
Public cafe discovery app:
- SEO-optimised pages: home, /cafe/[slug], /search, /city/[city]
- AI search bar with natural language queries
- Structured data (JSON-LD) for Google rich results
- City browsing, rating/filter sidebar, similar cafes
- Review listing, full menu preview, working-hours card
- Web App Manifest + offline fallback page (PWA)
- Next.js 16: params/searchParams typed as Promise<{}>
- Fix Lucide icon title→aria-label (type removed upstream)
- "use client" on offline page (onClick handler)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-27 21:34:47 +03:30
soroush.asadi d62bb8d3ad feat(website): Next.js 16 marketing website with RTL/Farsi
Marketing website for Meezi platform:
- Server-side rendered pages: home, demo, blog, pricing
- RTL/Farsi layout with Vazirmatn font
- SEO metadata and Open Graph tags
- proxy.ts for Next.js 16 middleware convention
- MEEZI_API_URL internal Docker network routing

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-27 21:34:32 +03:30
soroush.asadi 131ecdbbe6 feat(dashboard): Next.js 16 merchant panel with offline POS and PWA
Complete merchant dashboard upgrade:

Next.js 16 compatibility:
- Fix params/searchParams typed as Promise<{}> throughout App Router
- Replace middleware.ts with proxy.ts (Next.js 16 convention)
- Remove unused @ts-expect-error directives caught by stricter TS
- Cast dynamic next-intl t() keys to fix TranslateArgs type errors

Offline POS:
- IndexedDB queue (meezi_pos_offline) for orders created while offline
- Zustand sync store tracking queueCount, isSyncing, isOnline
- useOfflineSync hook: auto-syncs on reconnect/visibility-change
- SyncStatusIndicator chip in topbar (amber=offline, blue=syncing)
- submitOrderToApi falls back to local order on network failure
- Local orders skip payment flow; sync on reconnect

PWA (installable):
- @ducanh2912/next-pwa with Workbox runtime caching rules
- Web App Manifest (manifest.ts) — RTL/Farsi, theme #0F6E56
- PWA icons: 192px, 512px, maskable 512px
- next.config.ts replaces next.config.mjs

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-27 21:34:12 +03:30
soroush.asadi ef15fd6247 feat(api): .NET 10 multi-tenant REST API
Full backend implementation:
- Multi-tenant cafe/restaurant management (menus, orders, tables, staff)
- POS order flow with ZarinPal and Snappfood payment integration
- OTP authentication via Kavenegar SMS
- QR digital menu with public discover/finder endpoints
- Customer loyalty, coupons, CRM
- PostgreSQL via EF Core, Redis for caching/sessions
- Background jobs, webhook handlers
- Full migration history

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-27 21:33:48 +03:30
soroush.asadi 03376b3ea1 feat(docker): multi-stage Dockerfiles with npmmirror registry
Rewrites dashboard and finder Dockerfiles to use a clean multi-stage
build (deps → builder → runner) that installs npm packages inside
Alpine Linux, avoiding the SWC musl binary issue when building from
Windows host. Uses registry.npmmirror.com for reliable installs from
restricted networks (Iran).

- docker/api/Dockerfile: .NET 10 multi-stage build
- docker/web/Dockerfile: Node 20-alpine multi-stage, npmmirror
- docker/finder/Dockerfile: Node 20-alpine multi-stage, npmmirror
- docker/website/Dockerfile: marketing website build
- scripts/: PowerShell helper scripts for local dev

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-27 21:33:29 +03:30
soroush.asadi 45cd028d1c chore: initial project structure and root configuration
Adds root-level config files: solution (.slnx), NuGet, global.json,
Docker Compose files for all services (API, dashboard, website, finder,
admin), environment example, and developer documentation.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-27 21:33:10 +03:30