# Deploy Bookish ## Su Proxmox LXC (raccomandato) ### 1. Crea container LXC ```bash pct create 120 local:vault/almalinux-9-default_20240918_amd64.tar.xz \ --storage local-lvm \ --memory 1024 \ --swap 512 \ --cores 2 \ --net0 name=eth0,bridge=vmbr0,ip=dhcp \ --ostype almalinux \ --unprivileged 1 pct start 120 pct enter 120 ``` ### 2. Installa dipendenze ```bash # Python e strumenti di sviluppo dnf install -y python3 python3-pip git python3-devel gcc \ pango-devel cairo-devel gdk-pixbuf2-devel # Per WeasyPrint dnf install -y libffi-devel redhat-rpm-config ``` ### 3. Clona e setup ```bash git clone http://192.168.0.183:8085/truetype/bookish.git cd bookish python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt ``` ### 4. Crea service systemd ```ini # /etc/systemd/system/bookish.service [Unit] Description=Bookish Ebook Converter & Reader After=network.target [Service] Type=simple User=root WorkingDirectory=/opt/bookish ExecStart=/opt/bookish/.venv/bin/python /opt/bookish/app.py 5000 Restart=always RestartSec=5 Environment=BOOKISH_SECRET=your-secret-here Environment=BOOKISH_DEBUG=false [Install] WantedBy=multi-user.target ``` ```bash systemctl daemon-reload systemctl enable --now bookish ``` ## Docker (alternativa) ```dockerfile FROM python:3.11-slim RUN apt-get update && apt-get install -y pandoc libpango-1.0-0 \ libcairo2 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY . . RUN pip install --no-cache-dir -r requirements.txt EXPOSE 5000 CMD ["python", "app.py", "5000"] ``` ## Reverse Proxy (Caddy) ```caddyfile bookish.tuodominio.it { reverse_proxy localhost:5000 } ``` Con Caddy l'HTTPS รจ automatico. ## Pulizia e Manutenzione I file in `uploads/` e `converted/` vengono puliti automaticamente dopo 1 ora. Nessun DB da manutenere. Per backup basta copiare la directory del progetto (escludendo `uploads/`, `converted/`, `.venv/`).