From f96616bcefef80bf158f7085571a82fb0f063845 Mon Sep 17 00:00:00 2001 From: Greg Sarjeant Date: Thu, 14 Aug 2025 11:54:36 +0000 Subject: [PATCH] Add a bad docker config to test the setup error page (#70) Add a configuration with apache and php, but no sqlite. Confirm that the setup error page displays on first load. Reviewed-on: https://gitea.subcultureofone.org/greg/tkr/pulls/70 Co-authored-by: Greg Sarjeant Co-committed-by: Greg Sarjeant --- docker/apache/bad-configs/.htaccess | 22 ++++++++++++++++++++ docker/apache/bad-configs/docker-compose.yml | 22 ++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 docker/apache/bad-configs/.htaccess create mode 100644 docker/apache/bad-configs/docker-compose.yml diff --git a/docker/apache/bad-configs/.htaccess b/docker/apache/bad-configs/.htaccess new file mode 100644 index 0000000..71f8f55 --- /dev/null +++ b/docker/apache/bad-configs/.htaccess @@ -0,0 +1,22 @@ +# Basic .htaccess for tkr on shared hosting +# For use with included docker-compose.yml + +# Enable mod_rewrite +RewriteEngine On + +# Set directory index +DirectoryIndex public/index.php + +# Block access to sensitive directories +RewriteRule ^(storage|src|templates|config)(/.*)?$ - [F,L] + +# Block access to hidden files +RewriteRule ^\..*$ - [F,L] + +# Block access to setup script +RewriteRule ^tkr-setup\.php$ - [F,L] + +# Route everything else through public/index.php +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)$ public/index.php [L] diff --git a/docker/apache/bad-configs/docker-compose.yml b/docker/apache/bad-configs/docker-compose.yml new file mode 100644 index 0000000..d6fa759 --- /dev/null +++ b/docker/apache/bad-configs/docker-compose.yml @@ -0,0 +1,22 @@ +services: + apache-php-no-sqlite: + image: debian:bookworm + container_name: apache-no-sqlite-test + ports: + - "80:80" + volumes: + - ./config:/var/www/html/tkr/config + - ./public:/var/www/html/tkr/public + - ./src:/var/www/html/tkr/src + - ./storage:/var/www/html/tkr/storage + - ./templates:/var/www/html/tkr/templates + - ./tkr-setup.php:/var/www/html/tkr/tkr-setup.php + - ./docker/apache/shared-hosting/.htaccess:/var/www/html/tkr/.htaccess + command: > + bash -c "apt-get update && + apt-get install -y apache2 php libapache2-mod-php && + a2enmod rewrite headers expires php8.2 && + sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf && + chown -R www-data:www-data /var/www/html/tkr/storage && + apache2ctl -D FOREGROUND" + restart: unless-stopped