From: Thorsten Date: Thu, 5 Feb 2026 21:48:19 +0000 (+0100) Subject: neues Setup mit quickinstall X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=3f422ecf458454f95e1f951b9586e5fbd87dbe92;p=dfde-docker.git neues Setup mit quickinstall --- diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..26d406b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git/ +.claude/ +git.swp/ +dfde-theme/.git/ +dfde-theme/.idea/ diff --git a/.gitignore b/.gitignore index 1377554..10cf1cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.swp +dfde-theme/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3d77ead --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +FROM php:8.2-apache + +RUN apt-get update && apt-get install -y \ + zip \ + unzip \ + libpng-dev \ + libjpeg-dev \ + libfreetype6-dev \ + libsqlite3-dev \ + imagemagick \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install gd pdo pdo_sqlite \ + && rm -rf /var/lib/apt/lists/* + +# Install composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Download and setup QuickInstall +ADD https://api.github.com/repos/phpbb/quickinstall/zipball/1.6.15 /tmp/quickinstall.zip +RUN unzip /tmp/quickinstall.zip -d /tmp/qi \ + && mv /tmp/qi/phpbb-quickinstall-* /var/www/html/quickinstall \ + && rm /tmp/quickinstall.zip \ + && cd /var/www/html/quickinstall && composer install --no-dev + +# Add phpBB source to QuickInstall's sources directory (extracted) +COPY phpBB-3.3.15.zip /tmp/ +RUN unzip /tmp/phpBB-3.3.15.zip -d /var/www/html/quickinstall/sources/ \ + && rm /tmp/phpBB-3.3.15.zip + +# Set permissions for QuickInstall +RUN mkdir -p /var/www/html/quickinstall/boards \ + && mkdir -p /var/www/html/quickinstall/cache \ + && mkdir -p /var/www/html/quickinstall/settings + +# Add saved profile +COPY debianforumde.json /var/www/html/quickinstall/settings/ + +# Copy dfde-theme into sources for board creation +COPY dfde-theme /var/www/html/quickinstall/sources/phpBB3/styles/dfde + +# Copy board creation script +COPY create-board.php /var/www/html/quickinstall/ + +# Set permissions before running the script +RUN chown -R www-data:www-data /var/www/html/quickinstall + +# Create the board during build +RUN cd /var/www/html/quickinstall && php create-board.php dfde + +# Fix permissions after board creation +RUN chown -R www-data:www-data /var/www/html/quickinstall diff --git a/README.md b/README.md new file mode 100644 index 0000000..fe70b56 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# debianforum.de Docker-Entwicklungsumgebung + +Erstellt eine phpBB-Instanz mit dem debianforum.de-Theme und Testdaten. + +## Voraussetzungen + +- Docker +- Verzeichnisstruktur: + ``` + Projekte/ + ├── dfde-deploy/ ← dieses Repository + └── dfde-theme/ ← Theme-Repository (Geschwisterverzeichnis) + ``` + +## Verwendung + +```bash +./run.sh +``` + +Das Skript: +1. Kopiert das Theme in den Build-Kontext +2. Baut das Docker-Image (inkl. Board-Erstellung) +3. Startet den Container mit Theme-Mount + +## Zugriff + +- **URL:** http://localhost:8080/quickinstall/boards/dfde/ +- **Admin-Login:** `admin` / `password` + +## Live Theme-Editing + +Das Theme wird als Volume gemountet: +``` +../dfde-theme/ → /var/www/html/quickinstall/boards/dfde/styles/dfde +``` + +Änderungen am Theme sind sofort im Browser sichtbar (ggf. reload ohne Cache, Strg+Shift+R). + +## Container-Verwaltung + +```bash +# Logs anzeigen +docker logs -f dfde + +# Container stoppen (und ggf. den Zustand löschen, andernfalls lässt sich der Container mit docker start dfde auch wieder starten) +docker stop dfde && docker rm dfde + +# Neustart (ohne Rebuild) +docker start dfde +``` + +## Testdaten + +Das Board wurde mit folgenden Parametern erstellt: +- 100 Benutzer +- 2 Kategorien, 10 Foren +- 5-25 Themen pro Forum +- 0-50 Antworten pro Thema diff --git a/create-board.php b/create-board.php new file mode 100644 index 0000000..e48e34e --- /dev/null +++ b/create-board.php @@ -0,0 +1,185 @@ + + * + * This script bootstraps QuickInstall and invokes the board creation module + * to create a fully populated board during Docker build. + */ + +if (php_sapi_name() !== 'cli') { + die("This script must be run from the command line.\n"); +} + +if ($argc < 2) { + die("Usage: php create-board.php \n"); +} + +$board_name = $argv[1]; + +// Change to QuickInstall directory +chdir('/var/www/html/quickinstall'); + +// Define required constants +define('IN_PHPBB', true); +define('IN_QUICKINSTALL', true); +define('IN_INSTALL', true); + +$quickinstall_path = './'; +$phpbb_root_path = $quickinstall_path . 'sources/phpBB3/'; +$phpEx = 'php'; + +// Report all errors, except notices +$level = E_ALL ^ E_NOTICE; + +// Include scripts for quickinstall +require("{$quickinstall_path}includes/qi_constants.$phpEx"); +require("{$quickinstall_path}includes/qi.$phpEx"); +require("{$quickinstall_path}includes/settings.$phpEx"); +require("{$quickinstall_path}includes/qi_functions.$phpEx"); +require("{$quickinstall_path}includes/qi_file.$phpEx"); +require("{$quickinstall_path}includes/qi_module.$phpEx"); +require("{$quickinstall_path}includes/twig.$phpEx"); +require("{$quickinstall_path}vendor/autoload.$phpEx"); + +if (PHP_VERSION_ID >= 50400) { + if (!defined('E_STRICT')) { + define('E_STRICT', 2048); + } + $level &= ~E_STRICT; +} + +if (PHP_VERSION_ID >= 50500) { + if (!defined('E_DEPRECATED')) { + define('E_DEPRECATED', 8192); + } + $level &= ~E_DEPRECATED; +} +error_reporting($level); + +// Define STRIP constant +define('STRIP', false); + +// Set limits +@set_time_limit(0); +@ini_set('memory_limit', '256M'); + +// Set PHP error handler to qi's handler +set_error_handler(array('qi', 'msg_handler'), E_ALL); + +// Load settings from the debianforumde profile +$settings = new settings($quickinstall_path); +$settings->import_profile('debianforumde'); + +// Get phpBB version and load dependencies +$phpbb_version = get_phpbb_version($phpbb_root_path); + +if (file_exists($phpbb_root_path . 'phpbb/class_loader.' . $phpEx)) { + define('PHPBB_31', true); + + require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); + $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', $phpbb_root_path . 'phpbb/', $phpEx); + $phpbb_class_loader->register(); + + require($phpbb_root_path . 'vendor/autoload.' . $phpEx); +} + +if (!file_exists($phpbb_root_path . 'includes/functions_install.' . $phpEx) || version_compare($phpbb_version, '3.2', '>=')) { + define('PHPBB_32', true); +} + +if (file_exists($phpbb_root_path . 'vendor-ext') || version_compare($phpbb_version, '4.0', '>=')) { + define('PHPBB_40', true); +} + +require($phpbb_root_path . 'includes/functions.' . $phpEx); +require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + +if (!function_exists('phpbb_email_hash') || version_compare($phpbb_version, '3.3', '>=')) { + define('PHPBB_33', true); +} + +// Need to set prefix here before constants.php are included +$table_prefix = $settings->get_config('table_prefix', ''); + +require($phpbb_root_path . 'includes/constants.' . $phpEx); + +if (!qi::phpbb_branch('3.2')) { + require($phpbb_root_path . 'includes/functions_install.' . $phpEx); +} + +// Initialize user, cache, auth - mirroring index.php exactly +if (qi::phpbb_branch('3.1')) { + if (qi::phpbb_branch('3.2')) { + $cache_dir = $quickinstall_path . $settings->get_config('cache_dir', ''); + $cache = new \phpbb\cache\driver\file($cache_dir); + $user = new \phpbb\user( + new \phpbb\language\language( + new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), + '\phpbb\datetime' + ); + } else { + $user = new \phpbb\user('\phpbb\datetime'); + $cache = new \phpbb\cache\driver\file(); + } + + $auth = new \phpbb\auth\auth(); + require($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx); +} else { + require($phpbb_root_path . 'includes/acm/acm_file.' . $phpEx); + require($phpbb_root_path . 'includes/auth.' . $phpEx); + require($phpbb_root_path . 'includes/cache.' . $phpEx); + require($phpbb_root_path . 'includes/session.' . $phpEx); + + $user = new user(); + $auth = new auth(); + $cache = new cache(); +} + +// Initialize template +$template = new twig($user, $settings->get_cache_dir(), $quickinstall_path); + +// Apply QuickInstall language +qi::apply_lang($settings->get_config('qi_lang', 'en')); + +// Validate settings +if (!$settings->validate()) { + $errors = $settings->get_errors(); + echo "Settings validation errors:\n"; + foreach ($errors as $error) { + if (is_array($error)) { + echo " - " . implode(': ', $error) . "\n"; + } else { + echo " - $error\n"; + } + } + exit(1); +} + +// Set config as per index.php +if (qi::phpbb_branch('3.1')) { + $config = new \phpbb\config\config(array( + 'load_tplcompile' => '1', + )); + qi_set_config(false, false, false, $config); + qi_set_config_count(null, null, null, $config); +} else { + $config = array( + 'load_tplcompile' => '1', + ); +} + +// Set the board name via POST simulation +$_POST['dbname'] = $board_name; +$_REQUEST['dbname'] = $board_name; + +echo "Creating board '$board_name' with profile 'debianforumde'...\n"; + +// Load and run the create module +require("{$quickinstall_path}modules/qi_create.$phpEx"); + +$create_module = new qi_create(); +$create_module->run(); + +echo "Board '$board_name' created successfully!\n"; diff --git a/ctrl.sh b/ctrl.sh deleted file mode 100755 index 1bee1ac..0000000 --- a/ctrl.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -cmd=$1 -pushd docker - -case $cmd in -stop) - docker ps -q | xargs docker stop -t1 - ;; -start) - bash run.sh & - ;; -restart) - bash $0 stop && bash $0 start - ;; -safedb) - docker ps -q | xargs -I_ docker cp _:/tmp/db db - chown thorsten:thorsten db - ;; -commit) - docker ps -q | xargs -I_ docker commit _ - ;; -esac - -popd diff --git a/debianforumde.json b/debianforumde.json new file mode 100644 index 0000000..8ae957d --- /dev/null +++ b/debianforumde.json @@ -0,0 +1,58 @@ +{ + "qi_lang": "en", + "cache_dir": "cache\/", + "boards_dir": "boards\/", + "boards_url": "boards\/", + "make_writable": "0", + "grant_permissions": "", + "dbms": "sqlite3", + "dbhost": "\/var\/www\/html\/quickinstall\/boards\/", + "dbport": "", + "dbuser": "dbuser", + "dbpasswd": "dbpassword", + "no_dbpasswd": "0", + "db_prefix": "qi_", + "table_prefix": "phpbb_", + "server_name": "localhost", + "server_port": "80", + "cookie_domain": "", + "cookie_secure": "0", + "admin_name": "admin", + "admin_pass": "password", + "admin_email": "qi_admin@phpbb-quickinstall.tld", + "site_name": "Testing Board", + "site_desc": "QuickInstall sandbox", + "default_lang": "en", + "qi_tz": "UTC", + "other_config": "session_length;999999\n#load_tplcompile;1;1\n#This is a comment...", + "board_email": "qi_board@phpbb-quickinstall.tld", + "email_enable": "0", + "smtp_delivery": "0", + "smtp_host": "", + "smtp_port": "25", + "smtp_auth": "PLAIN", + "smtp_user": "", + "smtp_pass": "", + "populate": "1", + "num_users": "100", + "num_new_group": "10", + "email_domain": "phpbb-quickinstall.tld", + "create_admin": "1", + "create_mod": "1", + "num_cats": "2", + "num_forums": "10", + "num_topics_min": "5", + "num_topics_max": "25", + "num_replies_min": "0", + "num_replies_max": "50", + "chunk_post": "1000", + "chunk_topic": "2000", + "chunk_user": "5000", + "alt_env": "", + "redirect": "1", + "install_styles": "1", + "default_style": "debianforum.de", + "drop_db": "0", + "delete_files": "0", + "debug": "0" +} \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 18c9c22..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM php:5.6-apache - -MAINTAINER nobody - -RUN apt-get update -RUN apt-get install -y zip -COPY phpBB-3.2.0.zip /tmp/ - -RUN unzip /tmp/phpBB-3.2.0.zip -d /var/www/html/ - -COPY db /tmp/db -COPY config.php /var/www/html/phpBB3/ - -RUN find /var/www/html/phpBB3 -ls >> /var/www/html/sitemap.txt -RUN chown www-data:www-data -R /var/www/html/phpBB3 -RUN chown www-data:www-data /tmp/db - -RUN rm -rf /var/www/html/phpBB3/install - diff --git a/docker/config.php b/docker/config.php deleted file mode 100644 index bb5bb13..0000000 --- a/docker/config.php +++ /dev/null @@ -1,19 +0,0 @@ -