fix: resolve issue on deployment

This commit is contained in:
Omid Zamani
2026-01-03 12:24:44 +01:00
parent 73dba02a62
commit b58aad9099
6 changed files with 189 additions and 3 deletions

42
doc/tool/lxc_test_en.md Normal file
View File

@@ -0,0 +1,42 @@
# Testing with LXC
To test the relay setup in a local LXC container (tested on Arch Linux host):
### 1. Host Preparation
Install the necessary packages:
```bash
sudo pacman -S lxc arch-install-scripts dnsmasq
```
### 2. Network Configuration
If your host system has IPv6 disabled, you must disable it for LXC as well to avoid service failures:
Edit `/etc/default/lxc-net` and ensure these lines exist:
```bash
USE_LXC_BRIDGE="true"
LXC_IPV6_ENABLE="false"
LXC_IPV6_NAT="false"
```
*Note: If port 53 is occupied (e.g., by dnscrypt-proxy), you may need to configure your DNS service to listen only on `127.0.0.1` so LXC's dnsmasq can bind to the bridge.*
Restart the network:
```bash
sudo systemctl enable --now lxc-net.service
```
### 3. Create and Prepare Container
Create a Debian 12 (bookworm) container:
```bash
sudo lxc-create -n test -t download -- -d debian -r bookworm -a amd64
sudo lxc-start -n test
```
Sync your local repository to the container:
```bash
sudo rsync -av --exclude=.git ./ /var/lib/lxc/test/rootfs/relay-ir/
```
### 4. Run Deployment
Attach to the container and run the deployment locally:
```bash
sudo lxc-attach -n test -- bash -c "cd /relay-ir && ./scripts/initenv.sh && ./scripts/cmdeploy run --ssh-host @local --skip-dns-check"
```

42
doc/tool/lxc_test_fa.md Normal file
View File

@@ -0,0 +1,42 @@
# تست با LXC
برای تست تنظیمات رله در یک کانتینر محلی LXC (تست شده روی میزبان آرچ لینوکس):
### ۱. آماده‌سازی میزبان
بسته‌های مورد نیاز را نصب کنید:
```bash
sudo pacman -S lxc arch-install-scripts dnsmasq
```
### ۲. پیکربندی شبکه
اگر IPv6 در سیستم میزبان شما غیرفعال است، باید آن را برای LXC نیز غیرفعال کنید تا از بروز خطا جلوگیری شود:
فایل `/etc/default/lxc-net` را ویرایش کرده و مطمین شوید این خطوط وجود دارند:
```bash
USE_LXC_BRIDGE="true"
LXC_IPV6_ENABLE="false"
LXC_IPV6_NAT="false"
```
*نکته: اگر پورت ۵۳ اشغال است (مثلاً توسط dnscrypt-proxy)، ممکن است لازم باشد سرویس DNS خود را طوری تنظیم کنید که فقط روی `127.0.0.1` گوش دهد تا dnsmasq مربوط به LXC بتواند به بریج متصل شود.*
شبکه را راه‌اندازی کنید:
```bash
sudo systemctl enable --now lxc-net.service
```
### ۳. ساخت و آماده‌سازی کانتینر
یک کانتینر دبیان ۱۲ (bookworm) بسازید:
```bash
sudo lxc-create -n test -t download -- -d debian -r bookworm -a amd64
sudo lxc-start -n test
```
کد محلی خود را به کانتینر منتقل کنید:
```bash
sudo rsync -av --exclude=.git ./ /var/lib/lxc/test/rootfs/relay-ir/
```
### ۴. اجرای استقرار (Deployment)
به کانتینر متصل شده و استقرار را به صورت محلی اجرا کنید:
```bash
sudo lxc-attach -n test -- bash -c "cd /relay-ir && ./scripts/initenv.sh && ./scripts/cmdeploy run --ssh-host @local --skip-dns-check"
```