Clone
1
Troubleshooting
test edited this page 2026-05-17 07:08:15 +00:00
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Решение проблем

Диагностика одной командой

bash /opt/shop/scripts/diagnose-502.sh

HTTP 502 (Caddy / браузер)

SSL работает, страница 502 — Caddy жив, backend (Node) не отвечает.

curl -s http://127.0.0.1:3000/health
systemctl status shop
journalctl -u shop -n 30 --no-pager

Пока /health не OK — Caddy будет отдавать 502.


ECONNREFUSED 127.0.0.1:5432

PostgreSQL не запущен или не установлен.

bash /opt/shop/scripts/fix-db-connection.sh

Или вручную:

systemctl start postgresql
pg_isready -h 127.0.0.1 -p 5432
bash scripts/setup-postgres-ubuntu.sh

Проверьте DATABASE_URL в /opt/shop/.env.


Служба shop сразу останавливается

В логе только «База уже содержит товары» без строки Магазин: http://...:

cd /opt/shop && git pull   # нужен исправленный seed.js (v0.10.0+)
systemctl restart shop

dubious ownership (git pull)

Не делайте chown -R www-data /opt/shop.

chown -R root:root /opt/shop
git config --global --add safe.directory /opt/shop
git pull

Docker: контейнер app unhealthy

docker compose logs app
docker compose logs postgres
docker compose up -d --build

Docker: нет связи с БД

Проверьте, что DATABASE_URL в compose указывает на хост postgres, а не 127.0.0.1 (внутри контейнера app).


Полезные ссылки