From 5de52a6f4744afd2610c90a14fb3201948d6df6f Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Thu, 7 Nov 2024 09:42:59 +0100
Subject: [PATCH] stuff

---
 config/docker-files/7.2-Dockerfile  |  3 ++-
 config/docker-files/7.3-Dockerfile  |  3 ++-
 config/docker-files/7.4-Dockerfile  |  3 ++-
 config/docker-files/8.0-Dockerfile  |  3 ++-
 config/docker-files/8.1-Dockerfile  |  3 ++-
 config/docker-files/8.2-Dockerfile  |  3 ++-
 config/docker-files/8.3-Dockerfile  |  3 ++-
 config/docker-files/8.4-Dockerfile  | 11 +++++------
 config/nginx-php.conf               |  1 +
 config/php-fpm.conf                 |  1 +
 config/php.ini                      |  7 ++++---
 lib/Commands/Compile.php            | 19 +++++++++++++++----
 lib/Creators/NginxConfiguration.php |  4 +++-
 13 files changed, 43 insertions(+), 21 deletions(-)

diff --git a/config/docker-files/7.2-Dockerfile b/config/docker-files/7.2-Dockerfile
index 886db6f..1aa6b3c 100644
--- a/config/docker-files/7.2-Dockerfile
+++ b/config/docker-files/7.2-Dockerfile
@@ -14,6 +14,7 @@ RUN apt update && apt install -y --no-install-recommends \
         libzip-dev \
         libicu-dev \
         libfreetype6-dev \
+        libxslt-dev \
         libxml2-dev \
         libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \
         locales \
@@ -28,7 +29,7 @@ RUN sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \
 
 # Install php extensions
 RUN docker-php-ext-configure gd --with-jpeg-dir --with-freetype-dir --with-webp-dir
-RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap zip
+RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip
 
 # Install Memcached & redis
 RUN pecl install memcached redis \
diff --git a/config/docker-files/7.3-Dockerfile b/config/docker-files/7.3-Dockerfile
index bd4720b..d664f6f 100644
--- a/config/docker-files/7.3-Dockerfile
+++ b/config/docker-files/7.3-Dockerfile
@@ -14,6 +14,7 @@ RUN apt update && apt install -y --no-install-recommends \
         libzip-dev \
         libicu-dev \
         libfreetype6-dev \
+        libxslt-dev \
         libxml2-dev \
         libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \
         locales \
@@ -28,7 +29,7 @@ RUN sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \
 
 # Install php extensions
 RUN docker-php-ext-configure gd --with-jpeg-dir --with-freetype-dir --with-webp-dir
-RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap zip
+RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip
 
 # Install Memcached
 RUN pecl install memcached redis \
diff --git a/config/docker-files/7.4-Dockerfile b/config/docker-files/7.4-Dockerfile
index 2838589..b0b8972 100644
--- a/config/docker-files/7.4-Dockerfile
+++ b/config/docker-files/7.4-Dockerfile
@@ -14,6 +14,7 @@ RUN apt update && apt install -y --no-install-recommends \
         libzip-dev \
         libicu-dev \
         libfreetype6-dev \
+        libxslt-dev \
         libxml2-dev \
         libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \
         locales \
@@ -28,7 +29,7 @@ RUN sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \
 
 # Install php extensions
 RUN docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp
-RUN docker-php-ext-install -j$(nproc) gd gettext intl opcache pdo_mysql pdo_pgsql soap zip
+RUN docker-php-ext-install -j$(nproc) gd gettext intl opcache pdo_mysql pdo_pgsql soap xsl zip
 
 # Install Memcached & redis
 RUN pecl install memcached redis \
diff --git a/config/docker-files/8.0-Dockerfile b/config/docker-files/8.0-Dockerfile
index 4cddac9..39c1c03 100644
--- a/config/docker-files/8.0-Dockerfile
+++ b/config/docker-files/8.0-Dockerfile
@@ -14,6 +14,7 @@ RUN apt update && apt install -y --no-install-recommends \
         libzip-dev \
         libicu-dev \
         libfreetype6-dev \
+        libxslt-dev \
         libxml2-dev \
         libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \
         locales \
@@ -28,7 +29,7 @@ RUN sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \
 
 # Install php extensions
 RUN docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp
-RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap zip
+RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip
 
 # Install Memcached & redis
 RUN pecl install memcached redis \
diff --git a/config/docker-files/8.1-Dockerfile b/config/docker-files/8.1-Dockerfile
index 4861cd6..e39d102 100644
--- a/config/docker-files/8.1-Dockerfile
+++ b/config/docker-files/8.1-Dockerfile
@@ -14,6 +14,7 @@ RUN apt update && apt install -y --no-install-recommends \
         libzip-dev \
         libicu-dev \
         libfreetype6-dev \
+        libxslt-dev \
         libxml2-dev \
         libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \
         locales \
@@ -28,7 +29,7 @@ RUN sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \
 
 # Install php extensions
 RUN docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp
-RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap zip
+RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip
 
 # Install Memcached & redis
 RUN pecl install memcached redis \
diff --git a/config/docker-files/8.2-Dockerfile b/config/docker-files/8.2-Dockerfile
index efd288f..d4594a2 100644
--- a/config/docker-files/8.2-Dockerfile
+++ b/config/docker-files/8.2-Dockerfile
@@ -14,6 +14,7 @@ RUN apt update && apt install -y --no-install-recommends \
         libzip-dev \
         libicu-dev \
         libfreetype6-dev \
+        libxslt-dev \
         libxml2-dev \
         libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \
         locales \
@@ -28,7 +29,7 @@ RUN sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \
 
 # Install php extensions
 RUN docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp
-RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap zip
+RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip
 
 # Install Memcached & redis
 RUN pecl install memcached redis \
diff --git a/config/docker-files/8.3-Dockerfile b/config/docker-files/8.3-Dockerfile
index cf2ba3c..481b393 100644
--- a/config/docker-files/8.3-Dockerfile
+++ b/config/docker-files/8.3-Dockerfile
@@ -16,6 +16,7 @@ RUN apt update \
         libzip-dev \
         libicu-dev \
         libfreetype6-dev \
+        libxslt-dev \
         libxml2-dev \
         locales \
         libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \
@@ -30,7 +31,7 @@ RUN sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \
 
 # Install php extensions
 RUN docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp
-RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap zip
+RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip
 
 # Install Memcached and redis
 RUN pecl install memcached redis \
diff --git a/config/docker-files/8.4-Dockerfile b/config/docker-files/8.4-Dockerfile
index 8fb001d..84c2a19 100644
--- a/config/docker-files/8.4-Dockerfile
+++ b/config/docker-files/8.4-Dockerfile
@@ -1,4 +1,4 @@
-FROM php:8.4.0alpha2-fpm
+FROM php:8.4-rc-fpm
 
 # Install system requirements
 RUN apt update \
@@ -16,6 +16,7 @@ RUN apt update \
         libzip-dev \
         libicu-dev \
         libfreetype6-dev \
+        libxslt-dev \
         libxml2-dev \
         locales \
         libmemcached11 libmemcachedutil2 build-essential libmemcached-dev libz-dev \
@@ -30,13 +31,11 @@ RUN sed -i -e 's/# en_GB.UTF-8 UTF-8/en_GB.UTF-8 UTF-8/' /etc/locale.gen \
 
 # Install php extensions
 RUN docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp
-RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap zip
+RUN docker-php-ext-install -j$(nproc) gd gettext intl mysqli opcache pdo_mysql pdo_pgsql soap xsl zip
 
 # Install Memcached and redis
-# RUN pecl install memcached redis \
-#     && docker-php-ext-enable memcached redis
-RUN pecl install memcached \
-    && docker-php-ext-enable memcached
+RUN pecl install memcached redis \
+    && docker-php-ext-enable memcached redis
 
 # Cleanup
 RUN docker-php-source delete \
diff --git a/config/nginx-php.conf b/config/nginx-php.conf
index f1329d4..184b385 100644
--- a/config/nginx-php.conf
+++ b/config/nginx-php.conf
@@ -8,4 +8,5 @@ location ~ \.php(?:$|/) {
     fastcgi_param DOCUMENT_ROOT $site_document_root;
     fastcgi_param PATH_INFO $fastcgi_path_info;
     fastcgi_param SCRIPT_FILENAME $request_filename;
+    fastcgi_read_timeout 1200;
 }
diff --git a/config/php-fpm.conf b/config/php-fpm.conf
index 2d2ca09..bab01d8 100644
--- a/config/php-fpm.conf
+++ b/config/php-fpm.conf
@@ -2,3 +2,4 @@ php_admin_flag[log_errors] = on
 php_admin_value[error_log] = /var/log/error.log
 access.log = /dev/null
 pm.max_requests = 500
+request_terminate_timeout = 900
\ No newline at end of file
diff --git a/config/php.ini b/config/php.ini
index 610f462..34a9445 100644
--- a/config/php.ini
+++ b/config/php.ini
@@ -1,7 +1,8 @@
 max_input_vars=10000
-max_execution_time=300
-upload_max_filesize=8M
-post_max_size=9M
+max_execution_time=1200
+max_file_uploads = 256
+upload_max_filesize=200M
+post_max_size=200M
 error_reporting=22519
 
 zend_extension=opcache.so
diff --git a/lib/Commands/Compile.php b/lib/Commands/Compile.php
index 51843e4..5cb7c45 100644
--- a/lib/Commands/Compile.php
+++ b/lib/Commands/Compile.php
@@ -163,6 +163,15 @@ final class Compile extends Command
             ),
         ]);
 
+        // DB
+        $creator->addService('db', 'mariadb:latest', [
+            'container_name' => 'db',
+            'networks'       => ['code-network'],
+            'environment'    => [
+                'MARIADB_RANDOM_ROOT_PASSWORD' => true,
+            ],
+        ]);
+
         $mounts = [
             "{$compiledPath}/nginx.conf" => 'conf.d/default.conf',
             "{$compiledPath}/nginx-sites.conf" => 'sites.conf',
@@ -195,6 +204,7 @@ final class Compile extends Command
                     'MYSQL_HOST' => 'host.docker.internal',
                 ],
                 'networks' => ['code-network'],
+                'depends_on' => ['db'],
             ]);
 
             $creator->addServiceVolume(
@@ -246,9 +256,10 @@ final class Compile extends Command
 
                 'server_name _',
 
-                'proxy_read_timeout' => 300,
-                'proxy_connect_timeout' => 300,
-                'proxy_send_timeout' => 300,
+                'proxy_read_timeout 1200',
+                'proxy_connect_timeout 1200',
+                'proxy_send_timeout 1200',
+                'send_timeout 1200',
 
                 'access_log off',
                 'error_log off',
@@ -283,7 +294,7 @@ final class Compile extends Command
             ]);
 
             $creator->addServer([
-                'listen ' . $sslPort . ' default_server ssl',
+                'listen ' . $sslPort . ' default_server ssl http2',
                 'client_max_body_size 64M',
                 'set $fastcgi_backend ' . $index . '_backend',
 
diff --git a/lib/Creators/NginxConfiguration.php b/lib/Creators/NginxConfiguration.php
index ffcadca..23b9e30 100644
--- a/lib/Creators/NginxConfiguration.php
+++ b/lib/Creators/NginxConfiguration.php
@@ -9,7 +9,7 @@ final class NginxConfiguration extends ConfigurationCreator
     public function addLocation(string $location, array $config, string $modifier = '^~')
     {
         $this->addConfiguration('location', [
-            'location' => $location = '/' . ltrim($location, '/'),
+            'location' => '/' . ltrim($location, '/'),
             'modifier' => $modifier,
             'config'   => $config,
         ]);
@@ -17,6 +17,8 @@ final class NginxConfiguration extends ConfigurationCreator
 
     public function addServer(array $config)
     {
+
+
         $this->addConfiguration('server', [
             'config' => $config,
         ]);
-- 
GitLab