From 700b2e4c7f315c6a628cb28eb1e9657c0b61f452 Mon Sep 17 00:00:00 2001 From: Zareian Date: Fri, 18 Sep 2026 00:14:46 +0330 Subject: [PATCH] give our service a name nobody can confuse with someone else's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit روی این سرور یک `gunicorn.service` هست که مالِ تیمِ دیگری است. هر کسی که عجله داشته باشد و `systemctl restart gunicorn` بزند، سرویسِ آن‌ها را می‌خواباند و سرویسِ ما اصلاً ری‌استارت نمی‌شود — یعنی دیپلوی بی‌صدا اعمال نمی‌شود. همین دیشب یک بار اتفاق افتاد. حالا همان یونیت با نامِ `zareian-mathapp` هم صدا زده می‌شود (symlink در /etc/systemd/system). نامِ قبلی هم کار می‌کند، پس چیزی نمی‌شکند. خط تیره و نه نقطه: systemd آخرین نقطه را جداکننده‌ی نوعِ یونیت می‌داند، پس `zareian.mathapp` را باید هر بار کامل با `.service` نوشت. deploy.sh هم اول دنبالِ همین نام می‌گردد. Co-Authored-By: Claude Opus 5 --- CLAUDE.md | 10 ++++++++++ deploy.sh | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 4d8f397..b849e93 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -243,6 +243,16 @@ Ours is exactly one directory: **`/home/administrator/mathapp-v2`**, served by **`gunicorn-mathapp.service`** (unix socket, proxied by nginx). Note `~/mathapp` also exists, is not a git repo, and is not what runs — do not touch it. +The same unit also answers to **`zareian-mathapp`** (a symlink alias in +`/etc/systemd/system/`, added 2026-09-18). Prefer that name in anything a human will type +or copy: `gunicorn` alone is a *different team's* service on this box, and `tadrisino` is +too generic for a machine where other people's projects may claim it later. + +```bash +sudo systemctl restart zareian-mathapp # ours, unambiguous +sudo systemctl restart gunicorn # NOT ours — someone else's app +``` + Rules that follow from this, and are not negotiable: 1. **Never run a destructive command outside `~/mathapp-v2`.** No `rm -rf`, no diff --git a/deploy.sh b/deploy.sh index fbad0b9..d0b95a1 100755 --- a/deploy.sh +++ b/deploy.sh @@ -156,7 +156,7 @@ if [ -z "$SERVICE" ] && command -v systemctl >/dev/null 2>&1; then # مختلف کنارِ هم هستند و یک `gunicorn.service` وجود دارد که مالِ تیمِ # دیگری است — حدس زدنِ آن یعنی ری‌استارت کردنِ سرویسِ یک نفرِ دیگر. اگر # نامِ سرویس در این فهرست نبود، TADRISINO_SERVICE را صریح بدهید. - for candidate in tadrisino tadrisino-api gunicorn-mathapp mathapp; do + for candidate in zareian-mathapp gunicorn-mathapp tadrisino tadrisino-api; do if systemctl cat "${candidate}.service" >/dev/null 2>&1; then SERVICE="$candidate"; break fi