Files
hamkadr/LOCAL.md
T
soroush.asadi 6f02b1a0e9
CI/CD / CI · dotnet build (push) Successful in 32s
CI/CD / Deploy · hamkadr (push) Successful in 57s
[Local] Dockerized local test stack + always-show OTP in Development
Add docker-compose.local.yml + Dockerfile.local (public MS images + Liara NuGet) to run the whole app with a throwaway Postgres in one command for local testing, plus LOCAL.md. OtpService now never calls Kavenegar in the Development environment and always returns the code so the login page shows it on screen — guarantees local logins work with no SMS. Production behavior unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 19:21:47 +03:30

2.4 KiB

Run همکادر locally with Docker (for testing)

A self-contained stack — app built from source + its own Postgres. It does not touch production and does not send SMS.

Start

docker compose -f docker-compose.local.yml up --build

Then open http://localhost:8080.

First run takes a few minutes (pulls the .NET images, restores NuGet from the Liara mirror, builds, then applies EF migrations + seeds demo data on startup).

Log in (OTP shown on screen — no SMS)

Because it runs in the Development environment, the login code is printed on the page instead of being texted:

  1. Go to ورود / ثبت‌نام, choose کادر درمان, enter 09120000000 (the admin phone).
  2. Press دریافت کد تأیید → the 5-digit code appears in a green box on the page.
  3. Enter it → you're in as admin (you'll see پنل مدیریت / تنظیمات in the nav).

Kavenegar is never called in Development, even if SMS is toggled on.

Test ingestion

  1. Go to پنل مدیریت → تنظیمات → منابع جمع‌آوری.
  2. Enable a source and fill its config, e.g. مدجابز (medjobs.ir) or تلگرام (channel usernames). For Telegram from inside Iran you'll need the proxy — tick «از پروکسی استفاده شود» under that source and set the proxy address (see deploy/xray/README.md); locally you can run your own Xray and point it at socks5://host.docker.internal:PORT.
  3. Save, then trigger a run from پنل مدیریت → صف آگهی‌ها (Run-now), or set «اجرای خودکار» with a short interval.
  4. Watch logs: docker compose -f docker-compose.local.yml logs -f app New items land in the review queue (Manual mode) or publish (Automatic mode).

Inspect the database

Exposed on host port 5434 (so it won't clash with a dev DB on 5433):

docker exec -it hamkadr_local_db psql -U hamkadr -d hamkadr

Stop / reset

docker compose -f docker-compose.local.yml down          # stop (keeps data)
docker compose -f docker-compose.local.yml down -v       # stop + wipe the DB volume

Notes

  • If mcr.microsoft.com isn't reachable on your machine, edit Dockerfile.local and swap the two FROM mcr.microsoft.com/dotnet/... lines for mirror.soroushasadi.com/dotnet/....
  • Same for the Postgres image (postgres:16-alpinemirror.soroushasadi.com/postgres:16-alpine).