Files
npm-angie-auto-install/README.md
Mateusz Gruszczyński ef65e11dff fixes
2025-10-23 22:30:18 +02:00

107 lines
3.0 KiB
Markdown

# NPM + Angie Auto Installer
Minimal, repeatable setup for **Nginx Proxy Manager (NPM)** on **Angie** (Debian 13).
The installer configures Angie, deploys NPM (frontend + backend), fixes common pitfalls (PID tests, logrotate)
---
## Repository
Base URL: **https://gitea.linuxiarz.pl/gru/npm-angie-auto-install**
> On Gitea, the raw file URL usually looks like:
> `https://gitea.linuxiarz.pl/gru/npm-angie-auto-install/raw/branch/main/install.py`
---
## Requirements
- Debian 13 (root privileges).
- `curl`, `python3`, `systemd`.
- Network access to fetch packages and Node/Yarn artifacts.
- ~2 GB RAM (recommended) or add 2 GB swap for safer frontend builds.
---
## Quick Start (one-liner)
```bash
curl -fsSL https://gitea.linuxiarz.pl/gru/npm-angie-auto-install/raw/branch/master/npm_install.py -o install.py && sudo python3 install.py --dark-mode
```
> If you keep a patched version, replace `install.py` with your file name (e.g. `install_fixed.py`).
---
## Manual Download & Run
```bash
# 1) Download
curl -L https://gitea.linuxiarz.pl/gru/npm-angie-auto-install/raw/branch/master/npm_install.py -o install.py
# 2) Verify (optional)
python3 -m pyflakes install.py || true
# 3) Run
sudo python3 install.py --dark-mode
```
---
## What the Installer Does
- Creates **/etc/nginx -> /etc/angie** symlink (idempotent).
- Installs **Angie** and config templates; provides an **nginx wrapper** that makes config tests safe:
- `nginx -t` automatically uses `-g "pid /tmp/angie-test.pid; error_log off;"` and strips other `-g` flags.
- Prepares **/run/angie/angie.pid** with sane permissions.
- Configures **logrotate** for `/data/logs/*.log` (daily, rotate 7, compress) and provides a **logrotate-npm** helper that uses a writable state file at `/opt/npm/var/logrotate.state`.
- Deploys NPM (frontend + backend) and for building the legacy frontend.
---
## Options
- IPv6 keep/strip (resolver & conf).
- Theme.Park stylesheet injection (optional).
- Update-only mode (rebuild without reconfiguring Angie).
Check `--help` in the script for all flags.
---
## Post-Install
```bash
# Status
systemctl status angie.service --no-pager
systemctl status npm.service --no-pager
# NPM UI
# Default: http(s)://<your-host>:81 (see summary printed by installer)
```
---
## Troubleshooting
**1) Frontend build killed (SIGKILL) / high RAM usage**
- The script forces **Yarn Classic (1.22.x)** and reduces concurrency.
- If memory is tight, add swap:
```bash
sudo fallocate -l 2G /swapfile && sudo chmod 600 /swapfile
sudo mkswap /swapfile && sudo swapon /swapfile
```
**2) Permission denied: `/var/lib/logrotate/status`**
- Use `/usr/local/bin/logrotate-npm` (created by the installer), which keeps its own writable state file.
**3) Config test fails on PID**
- The **nginx wrapper** ensures `nginx -t` writes test PID to `/tmp`, not to `/run/angie/angie.pid`.
---
## Uninstall (manual)
```bash
sudo systemctl disable --now npm.service angie.service || true
sudo rm -f /usr/sbin/nginx /usr/local/bin/logrotate-npm || true
```
---
## License
MIT
## Author
linuxiarz.pl, Mateusz Gruszczyński