A guide for deploying PasarGuard in network-restricted environments, air-gapped servers, and hosts requiring domestic Iranian mirrors.
- Overview
- Domestic Mirror Optimization (
mirror.sh) - Standalone / Air-Gapped Deployment
- Standalone Package Contents
- Persian Documentation Links
Due to international sanctions and network filtering, servers located in Iran often experience throttled, blocked, or high-latency connections to:
- Official Ubuntu/Debian APT mirrors (
archive.ubuntu.com,deb.debian.org). - Docker Hub (
registry-1.docker.io). - GitHub raw content and releases.
PasarGuard includes a dedicated subsystem under iran-sanction/ that solves this through automated mirror selection and pre-packaged standalone distributions.
iran-sanction/mirror.sh is an automated benchmarking and configuration utility.
When configuring a server in Iran:
-
Latency Probing: Measures round-trip time (
time_total) to each domestic mirror endpoint usingcurl. -
Throughput Sampling: Downloads multiple chunks (
SAMPLES=3,TIMEOUT=8s) to determine real-world download speed (speed_download). -
Composite Scoring: Calculates a weighted score:
$$\text{Score} = (0.70 \times \text{Speed}) + (0.30 \times \text{Latency})$$ -
Automated Application:
- Replaces APT repository mirrors with the fastest responsive HTTPS mirror in
/etc/apt/sources.list(ensuring encrypted transport). - Adds registry mirrors to
/etc/docker/daemon.json(registry-mirrors). - Reloads the Docker daemon (
systemctl daemon-reload && systemctl restart docker).
- Replaces APT repository mirrors with the fastest responsive HTTPS mirror in
- ArvanCloud:
mirror.arvancloud.ir,docker.arvancloud.ir - HamDocker:
hub.hamdocker.ir - IranServer:
mirror.iranserver.com,docker.iranserver.com - MobinHost:
mirror.mobinhost.com,docker.mobinhost.com - Isfahan University of Technology (IUT):
repo.iut.ac.ir
To run the mirror selection test directly:
sudo bash iran-sanction/mirror.shTo run in dry-run mode (tests speeds without writing configuration files):
DRY_RUN=true sudo bash iran-sanction/mirror.shStandalone packages include all required Compose templates, installer scripts, and helper libraries so they do not require fetching files from GitHub during installation.
If the server can reach GitHub releases or domestic mirrors:
curl -LO https://github.com/PasarGuard/scripts/releases/latest/download/pasarguard-standalone.tar.gz
tar -xzf pasarguard-standalone.tar.gz
cd pasarguard-standalone
chmod +x iran-sanction/pasarguard-standalone.sh
sudo ./iran-sanction/pasarguard-standalone.sh install-script
sudo pasarguard install --database timescaledbBecause air-gapped hosts have no internet connectivity and standalone bundles contain configuration templates and scripts rather than container images, required Docker images must be pre-provisioned:
-
Download the release bundle onto an external computer with internet access:
-
Pull and save the required Docker images on the connected machine (or push to an accessible local registry):
# Panel stack image (example for default SQLite install): docker pull ghcr.io/pasarguard/panel:latest docker save ghcr.io/pasarguard/panel:latest -o pasarguard-images.tar -
Transfer both the release bundle and image archive to the air-gapped host via
scp, SFTP, or USB drive:scp pasarguard-standalone.tar.gz pasarguard-images.tar root@server-ip:/tmp/
-
Load Docker images and install on the server:
# Import the container images into Docker docker load -i /tmp/pasarguard-images.tar # Extract and install standalone scripts cd /tmp tar -xzf pasarguard-standalone.tar.gz cd pasarguard-standalone sudo ./iran-sanction/pasarguard-standalone.sh install-script sudo pasarguard install
The pasarguard-standalone.tar.gz bundle contains:
pasarguard-standalone/
├── pasarguard.sh
├── iran-sanction/
│ ├── pasarguard-standalone.sh
│ └── mirror.sh
├── lib/
│ ├── common.sh
│ ├── docker.sh
│ ├── env.sh
│ ├── github.sh
│ ├── pasarguard-backup.sh
│ ├── pasarguard-restore.sh
│ └── system.sh
└── docker-compose/
├── pasarguard-sqlite.yml
├── pasarguard-mysql.yml
├── pasarguard-mariadb.yml
├── pasarguard-postgresql.yml
└── pasarguard-timescaledb.yml
Native Persian (Farsi) documentation for standalone packages is available here: