From 20743859e506fa957b378fcbc3c8c68667775c67 Mon Sep 17 00:00:00 2001 From: mamazu <14860264+mamazu@users.noreply.github.com> Date: Tue, 7 Jan 2025 18:21:51 +0100 Subject: [PATCH 1/3] Adding documentation for FrankenPHP --- cookbook/web-server/franken-php.rst | 63 +++++++++++++++++++++++++++++ cookbook/web-server/index.rst | 1 + 2 files changed, 64 insertions(+) create mode 100644 cookbook/web-server/franken-php.rst diff --git a/cookbook/web-server/franken-php.rst b/cookbook/web-server/franken-php.rst new file mode 100644 index 00000000..13b46ccd --- /dev/null +++ b/cookbook/web-server/franken-php.rst @@ -0,0 +1,63 @@ +Running Franken PHP +=================== + +To add FrankenPHP to an existing project you can follow these steps: `FrankenPHP Documentation`_. + +However after running through those steps you need to modify the setup a slight bit: +1. Installing the correct php extensions +2. Adding a database to the project +3. Removing Sulu's default configuration + +The modifications +----------------- +.. note:: + Beware these instructions might get out of date if FrankenPHP Documentation changes. + +After installing you should have a `Dockerfile` which is the base for all containers. + +There should be a section under like this: +.. code-block:: dockerfile + # Base FrankenPHP image + ... + RUN set -eux; \ + install-php-extensions \ + @composer \ + apcu \ + intl \ + opcache \ + zip \ + ; + +This is the list of installed extensions. For Sulu you also need: `gd` and `pdo_mysql` or `pdo_postgres`. + +Secondly we also need to add a database. We can just do that by adding it to the yaml configuration file `compose.yaml`. + +Here is an example configuration for mysql: + +.. code-block:: yaml + services: + # .... + database: + # arm compatible mysql docker image + image: mysql/mysql-server:${MYSQL_VERSION:-8.0} # arm and x86/x64 compatible mysql image + command: [ "--max_connections=1000", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_general_ci" ] + environment: + MYSQL_DATABASE: ${MYSQL_DATABASE:-sulu} + # You should definitely change the password in production + MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-ChangeMe} + MYSQL_ROOT_HOST: '%' + volumes: + - db-data:/var/lib/mysql + # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data! + # - ./docker/db/data:/var/lib/mysql:rw + +After setting up the container you might also want to update the `DATABASE_URL` variable in the php service (by default it assumes postgres). At least note that FrankenPHP and the default Sulu mysql container have different default credentials. + +If you have some other modifications in your set up be sure to copy all changes of the `docker-compose*` files to the `compose.yaml` and `compose.override.yaml`. + +After all this, the Sulu default configuration is not used anymore and can be removed: +.. code-block:: bash + rm docker-compose.yaml + rm docker-compose.override.yaml + +.. _FrankenPHP Documentation: https://github.com/dunglas/symfony-docker/blob/main/docs/existing-project.md#installing-on-an-existing-project diff --git a/cookbook/web-server/index.rst b/cookbook/web-server/index.rst index b3fe169d..86b9d41d 100644 --- a/cookbook/web-server/index.rst +++ b/cookbook/web-server/index.rst @@ -14,3 +14,4 @@ these tools. apache nginx built-in + franken-php From 0aaa0493852bd9ee2a1a0be34dbb7178c9eddfed Mon Sep 17 00:00:00 2001 From: mamazu <14860264+mamazu@users.noreply.github.com> Date: Tue, 7 Jan 2025 18:38:56 +0100 Subject: [PATCH 2/3] Fixing rst codeblocks Co-authored-by: Alexander Schranz --- cookbook/web-server/franken-php.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cookbook/web-server/franken-php.rst b/cookbook/web-server/franken-php.rst index 13b46ccd..2f4e351c 100644 --- a/cookbook/web-server/franken-php.rst +++ b/cookbook/web-server/franken-php.rst @@ -10,13 +10,17 @@ However after running through those steps you need to modify the setup a slight The modifications ----------------- + .. note:: + Beware these instructions might get out of date if FrankenPHP Documentation changes. After installing you should have a `Dockerfile` which is the base for all containers. There should be a section under like this: + .. code-block:: dockerfile + # Base FrankenPHP image ... RUN set -eux; \ @@ -35,6 +39,7 @@ Secondly we also need to add a database. We can just do that by adding it to the Here is an example configuration for mysql: .. code-block:: yaml + services: # .... database: @@ -56,7 +61,9 @@ After setting up the container you might also want to update the `DATABASE_URL` If you have some other modifications in your set up be sure to copy all changes of the `docker-compose*` files to the `compose.yaml` and `compose.override.yaml`. After all this, the Sulu default configuration is not used anymore and can be removed: + .. code-block:: bash + rm docker-compose.yaml rm docker-compose.override.yaml From fb76dcb7048f6136e5db51be2a5806f2c0a625e0 Mon Sep 17 00:00:00 2001 From: mamazu <14860264+mamazu@users.noreply.github.com> Date: Tue, 7 Jan 2025 18:44:29 +0100 Subject: [PATCH 3/3] Updating the title --- cookbook/web-server/franken-php.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/web-server/franken-php.rst b/cookbook/web-server/franken-php.rst index 2f4e351c..8233ce81 100644 --- a/cookbook/web-server/franken-php.rst +++ b/cookbook/web-server/franken-php.rst @@ -1,5 +1,5 @@ -Running Franken PHP -=================== +FrankenPHP via Docker +===================== To add FrankenPHP to an existing project you can follow these steps: `FrankenPHP Documentation`_.