From 8c81c05bcae05aef4647dd4e4e0af80e77e10677 Mon Sep 17 00:00:00 2001 From: Johnnybegood90 Date: Sat, 14 Mar 2026 02:57:13 +0100 Subject: [PATCH] Updating Docker Compose & README.md --- .gitignore | 3 +- Dockerfile | 14 ++++++- README.md | 81 ++++++++++++++++++++++++++++++++----- docker-compose.yml | 2 +- docker/docker-entrypoint.sh | 11 +++++ 5 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 docker/docker-entrypoint.sh diff --git a/.gitignore b/.gitignore index 3980cdb..f5a083b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ config.json -.DS_Store \ No newline at end of file +data/ +.DS_Store diff --git a/Dockerfile b/Dockerfile index 3bf31f9..f943db0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,18 @@ RUN docker-php-ext-install curl && \ a2enmod rewrite COPY . /var/www/html/ +COPY docker/docker-entrypoint.sh /usr/local/bin/gridtv-entrypoint.sh -RUN chown -R www-data:www-data /var/www/html && \ - chmod -R 775 /var/www/html +RUN mkdir -p /data && \ + chown -R www-data:www-data /var/www/html /data && \ + find /var/www/html -type d -exec chmod 755 {} \; && \ + find /var/www/html -type f -exec chmod 644 {} \; && \ + chmod 755 /usr/local/bin/gridtv-entrypoint.sh + +HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ + CMD php -r "exit(@file_get_contents('http://127.0.0.1/') === false ? 1 : 0);" + +ENTRYPOINT ["gridtv-entrypoint.sh"] +CMD ["apache2-foreground"] EXPOSE 80 diff --git a/README.md b/README.md index 965f3cf..99ee861 100644 --- a/README.md +++ b/README.md @@ -70,15 +70,19 @@ docker compose up -d Then open `http://localhost:8080` and follow the setup wizard. +Docker stores the generated configuration in `./data/config.json` on the host. + To run on a custom port: ```bash PORT=9000 docker compose up -d ``` +To back up or migrate your Docker setup, keep the `data/` directory. + --- -### Option B — Apache / Nginx +### Option B — Native PHP host #### 1. Clone the repo @@ -94,7 +98,25 @@ chmod 775 /var/www/gridtv chown -R www-data:www-data /var/www/gridtv ``` -#### 3a. Configure Nginx +#### 3. Install php-curl + +The built-in player uses `proxy.php` to relay HTTP streams over HTTPS. This requires the **php-curl** extension: + +```bash +# Debian/Ubuntu — adjust version to match your PHP +apt install php8.4-curl +systemctl reload apache2 # or: systemctl reload nginx +``` + +#### 4. Reverse proxy examples + +
+Show reverse proxy / vhost examples + +These examples are intentionally minimal. Replace `guide.your-domain.com` with your domain and adjust the PHP socket or upstream target to match your host. + +
+Nginx + PHP-FPM ```nginx server { @@ -115,13 +137,16 @@ server { } ``` -> 💡 Adjust the PHP version (`php8.2-fpm`) to match the one installed on your server. - ```bash nginx -t && systemctl reload nginx ``` -#### 3b. Configure Apache +> Adjust `php8.2-fpm.sock` to match the PHP-FPM version installed on your server. + +
+ +
+Apache vhost ```apache @@ -140,16 +165,52 @@ a2enmod php8.4 rewrite systemctl reload apache2 ``` -#### 4. Install php-curl +
-The built-in player uses `proxy.php` to relay HTTP streams over HTTPS. This requires the **php-curl** extension: +
+Caddy + +```caddy +guide.your-domain.com { + root * /var/www/gridtv + php_fastcgi unix//run/php/php8.2-fpm.sock + file_server +} +``` ```bash -# Debian/Ubuntu — adjust version to match your PHP -apt install php8.4-curl -systemctl reload apache2 # or: systemctl reload nginx +systemctl reload caddy ``` +> If you use `xcaddy` or a distro package, keep the same site block and only adapt the PHP-FPM socket path. + +
+ +
+Traefik (Docker labels) + +Use this if GridTV runs in Docker and Traefik is your front proxy: + +```yaml +services: + gridtv: + build: . + volumes: + - ./data:/data + labels: + - "traefik.enable=true" + - "traefik.http.routers.gridtv.rule=Host(`guide.your-domain.com`)" + - "traefik.http.routers.gridtv.entrypoints=websecure" + - "traefik.http.routers.gridtv.tls=true" + - "traefik.http.services.gridtv.loadbalancer.server.port=80" +``` + +You still need a running Traefik instance with `websecure` configured and DNS pointing to it. + +
+ +
+ #### 5. First launch — Setup Open your browser at `http://guide.your-domain.com`. diff --git a/docker-compose.yml b/docker-compose.yml index 12629bc..f364069 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,5 +4,5 @@ services: ports: - "${PORT:-8080}:80" volumes: - - ./config.json:/var/www/html/config.json + - ./data:/data restart: unless-stopped diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh new file mode 100644 index 0000000..6aaa1a5 --- /dev/null +++ b/docker/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -eu + +mkdir -p /data +chown -R www-data:www-data /data +chmod 775 /data + +rm -f /var/www/html/config.json +ln -s /data/config.json /var/www/html/config.json + +exec docker-php-entrypoint "$@"