Просмотр исходного кода

docs: add Docker Compose setup instructions to README files

Manuel 1 день назад
Родитель
Сommit
daa335e756
2 измененных файлов с 90 добавлено и 0 удалено
  1. 45 0
      README.md
  2. 45 0
      README_es.md

+ 45 - 0
README.md

@@ -66,6 +66,7 @@
             <li><a href="#forwarding-squid-logs-from-a-remote-squid-host-important">Forwarding Squid logs from remote host</a></li>
           </ul>
         </li>
+        <li><a href="#docker-compose">Docker Compose</a></li>
       </ul>
     </li>
     <li>
@@ -194,6 +195,50 @@ _A modern tool for parsing and analyzing Squid logs, providing a user-friendly d
 apt install git python3 python3-pip python3-venv libmariadb-dev curl
 ```
 
+### Docker Compose
+
+Docker Compose is useful when SquidStats and Squid run on the same host. Docker
+and the Compose plugin are required. The compose file reads configuration from
+`.env`, mounts the application logs, persists the SQLite database in
+`./SquidStats`, and exposes the web panel on port `5000`.
+
+1. Extract the release and enter its directory:
+
+   ```bash
+   sudo mkdir -p /opt/containers/squidstats
+   sudo tar -xf squidstats.tar -C /opt/containers/squidstats
+   cd /opt/containers/squidstats
+   ```
+
+2. Create the persistent database directory and environment file:
+
+   ```bash
+   mkdir -p SquidStats logs
+   cp example.env .env
+   ```
+
+   Set at least `FIRST_PASSWORD`, `DATABASE_STRING_CONNECTION=/opt/SquidStats/squidstats.db`,
+   `SQUID_LOG=/var/log/squid/access.log`, `SQUID_CACHE_LOG=/var/log/squid/cache.log`,
+   `SQUID_CONFIG_PATH=/etc/squid/squid.conf`, `ACL_FILES_DIR=/etc/squid/squid.d`,
+   `LISTEN_HOST=0.0.0.0`, and `LISTEN_PORT=5000` in `.env`.
+
+3. Build and start the application:
+
+   ```bash
+   docker compose build --no-cache
+   docker compose up -d
+   docker compose logs -f squidstats
+   ```
+
+   The default mounts expect Squid configuration and logs in `/etc/squid` and
+   `/var/log/squid`. Override `SQUID_CONFIG_DIR`, `SQUID_LOG_DIR`, or
+   `DATABASE_DIR` in the shell when the host uses different locations. The
+   Squid log mount is read-only; the configuration mount is writable only
+   because the administration features may update Squid configuration.
+
+   Open `http://<server>:5000`. Keep `.env` private and replace the example
+   password before exposing the panel.
+
 #### 🔧 Cache Manager Configuration (Critical for SquidStats)
 
 **SquidStats requires proper Cache Manager configuration to function correctly.** Please follow the [official Squid Cache Manager documentation](https://wiki.squid-cache.org/Features/CacheManager/Index) for complete setup.

+ 45 - 0
README_es.md

@@ -66,6 +66,7 @@
             <li><a href="#reenviar-logs-de-squid-desde-un-host-proxy-remoto-importante">Reenviar logs desde host remoto</a></li>
           </ul>
         </li>
+        <li><a href="#docker-compose">Docker Compose</a></li>
       </ul>
     </li>
     <li>
@@ -193,6 +194,50 @@ _Una herramienta moderna para analizar logs de Squid, proporcionando un panel f
 apt install git python3 python3-pip python3-venv libmariadb-dev curl
 ```
 
+### Docker Compose
+
+Docker Compose resulta útil cuando SquidStats y Squid se ejecutan en el mismo
+host. Se necesitan Docker y el plugin de Compose. El archivo compose lee la
+configuración desde `.env`, monta los logs de la aplicación, persiste la base
+SQLite en `./SquidStats` y publica el panel web en el puerto `5000`.
+
+1. Descomprime la versión y entra en su directorio:
+
+   ```bash
+   sudo mkdir -p /opt/containers/squidstats
+   sudo tar -xf squidstats.tar -C /opt/containers/squidstats
+   cd /opt/containers/squidstats
+   ```
+
+2. Crea el directorio persistente y el archivo de entorno:
+
+   ```bash
+   mkdir -p SquidStats logs
+   cp example.env .env
+   ```
+
+   Define al menos `FIRST_PASSWORD`, `DATABASE_STRING_CONNECTION=/opt/SquidStats/squidstats.db`,
+   `SQUID_LOG=/var/log/squid/access.log`, `SQUID_CACHE_LOG=/var/log/squid/cache.log`,
+   `SQUID_CONFIG_PATH=/etc/squid/squid.conf`, `ACL_FILES_DIR=/etc/squid/squid.d`,
+   `LISTEN_HOST=0.0.0.0` y `LISTEN_PORT=5000` en `.env`.
+
+3. Construye y arranca la aplicación:
+
+   ```bash
+   docker compose build --no-cache
+   docker compose up -d
+   docker compose logs -f squidstats
+   ```
+
+   Los montajes predeterminados esperan la configuración y los logs de Squid
+   en `/etc/squid` y `/var/log/squid`. Si el host usa otras rutas, sobrescribe
+   `SQUID_CONFIG_DIR`, `SQUID_LOG_DIR` o `DATABASE_DIR` en la shell. El montaje
+   de logs de Squid es de solo lectura; el de configuración es escribible
+   únicamente porque las funciones administrativas pueden actualizarla.
+
+   Abre `http://<servidor>:5000`. Mantén `.env` privado y cambia la contraseña
+   de ejemplo antes de exponer el panel.
+
 #### 🔧 Configuración del Cache Manager (Crítico para SquidStats)
 
 **SquidStats requiere una configuración adecuada del Cache Manager para funcionar correctamente.** Por favor sigue la [documentación oficial del Cache Manager de Squid](https://wiki.squid-cache.org/Features/CacheManager/Index) para una configuración completa.