Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/frankenphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: docker/setup-buildx-action@v3
-
name: Build Docker images
uses: docker/bake-action@v4
uses: docker/bake-action@v6
with:
pull: true
load: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['8.2', '8.3']
php-versions: ['8.4']
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#syntax=docker/dockerfile:1.4
#syntax=docker/dockerfile:1

# Versions
FROM dunglas/frankenphp:1-php8.3 AS frankenphp_upstream
Expand Down Expand Up @@ -37,10 +37,12 @@ RUN set -eux; \
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1

ENV PHP_INI_SCAN_DIR=":$PHP_INI_DIR/app.conf.d"

###> recipes ###
###> symfony/panther ###
# Chromium and ChromeDriver
ENV PANTHER_NO_SANDBOX 1
ENV PANTHER_NO_SANDBOX=1
# Not mandatory, but recommended
ENV PANTHER_CHROME_ARGUMENTS='--disable-dev-shm-usage'
RUN apt-get update && apt-get install -y --no-install-recommends chromium chromium-driver && rm -rf /var/lib/apt/lists/*
Expand All @@ -58,7 +60,7 @@ RUN install-php-extensions pdo_mysql
###< doctrine/doctrine-bundle ###
###< recipes ###

COPY --link frankenphp/conf.d/app.ini $PHP_INI_DIR/conf.d/
COPY --link frankenphp/conf.d/10-app.ini $PHP_INI_DIR/app.conf.d/
COPY --link --chmod=755 frankenphp/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
COPY --link frankenphp/Caddyfile /etc/caddy/Caddyfile

Expand All @@ -79,7 +81,7 @@ RUN set -eux; \
xdebug \
;

COPY --link frankenphp/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/
COPY --link frankenphp/conf.d/20-app.dev.ini $PHP_INI_DIR/app.conf.d/

CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile", "--watch" ]

Expand All @@ -91,7 +93,7 @@ ENV FRANKENPHP_CONFIG="import worker.Caddyfile"

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

COPY --link frankenphp/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/
COPY --link frankenphp/conf.d/20-app.prod.ini $PHP_INI_DIR/app.conf.d/
COPY --link frankenphp/worker.Caddyfile /etc/caddy/worker.Caddyfile

# prevent the reinstallation of vendors at every changes in the source code
Expand Down
11 changes: 10 additions & 1 deletion compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
volumes:
- ./:/app
- ./frankenphp/Caddyfile:/etc/caddy/Caddyfile:ro
- ./frankenphp/conf.d/app.dev.ini:/usr/local/etc/php/conf.d/app.dev.ini:ro
- ./frankenphp/conf.d/20-app.dev.ini:/usr/local/etc/php/app.conf.d/20-app.dev.ini:ro
# If you develop on Mac or Windows you can remove the vendor/ directory
# from the bind-mount for better performance by enabling the next line:
#- /app/vendor
Expand Down Expand Up @@ -39,3 +39,12 @@ services:
MP_SMTP_AUTH_ACCEPT_ANY: 1
MP_SMTP_AUTH_ALLOW_INSECURE: 1
###< symfony/mailer ###

phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: unless-stopped
environment:
PMA_HOST: mysql
PMA_PORT: 3306
ports:
- 8081:80
13 changes: 1 addition & 12 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ services:
SERVER_NAME: ${SERVER_NAME:-localhost}, php:80
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
TRUSTED_PROXIES: ${TRUSTED_PROXIES:-127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16}
TRUSTED_HOSTS: ${TRUSTED_HOSTS:-^${SERVER_NAME:-example\.com|localhost}|php$$}
# Run "composer require symfony/orm-pack" to install and configure Doctrine ORM
DATABASE_URL: mysql://${MYSQL_USER:-app}:${MYSQL_PASSWORD:-!ChangeMe!}@mysql:3306/${MYSQL_DATABASE:-app}?serverVersion=${MYSQL_VERSION:-8.0.35}&charset=utf8mb4
# Run "composer require symfony/mercure-bundle" to install and configure the Mercure integration
MERCURE_URL: ${CADDY_MERCURE_URL:-http://php/.well-known/mercure}
MERCURE_PUBLIC_URL: ${CADDY_MERCURE_PUBLIC_URL:-https://${SERVER_NAME:-localhost}/.well-known/mercure}
MERCURE_PUBLIC_URL: ${CADDY_MERCURE_PUBLIC_URL:-https://${SERVER_NAME:-localhost}:${HTTPS_PORT:-443}/.well-known/mercure}
MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
# The two next lines can be removed after initial installation
SYMFONY_VERSION: ${SYMFONY_VERSION:-}
Expand Down Expand Up @@ -53,15 +51,6 @@ services:
- 3306:3306
###< doctrine/doctrine-bundle ###

phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: unless-stopped
environment:
PMA_HOST: mysql
PMA_PORT: 3306
ports:
- 8081:80

volumes:
caddy_data:
caddy_config:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"doctrine/doctrine-fixtures-bundle": "^3.6",
"friendsofphp/php-cs-fixer": "^3.59",
"phpunit/phpunit": "^9.6",
"rector/rector": "^1.2",
"rector/rector": "^2.0",
"symfony/browser-kit": "^7.1",
"symfony/css-selector": "^7.1",
"symfony/debug-bundle": "^7.1",
Expand Down
42 changes: 21 additions & 21 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
locale: 'en'
app_locales: 'en|ru|nl|bg|hu'
images_directory: '%kernel.project_dir%/public/uploads/images'
app_version: '2.11.2'
app_version: '2.11.3'

services:
# default configuration for services in *this* file
Expand Down
16 changes: 14 additions & 2 deletions frankenphp/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

{$SERVER_NAME:localhost} {
log {
{$CADDY_SERVER_LOG_OPTIONS}
# Redact the authorization query parameter that can be set by Mercure
format filter {
request>uri query {
Expand All @@ -18,7 +19,7 @@
}
}

root * /app/public
root /app/public
encode zstd br gzip

mercure {
Expand All @@ -43,5 +44,16 @@
# Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics
header ?Permissions-Policy "browsing-topics=()"

php_server
@phpRoute {
not path /.well-known/mercure*
not file {path}
}
rewrite @phpRoute index.php

@frontController path index.php
php @frontController

file_server {
hide *.php
}
}
3 changes: 2 additions & 1 deletion frankenphp/conf.d/app.ini → frankenphp/conf.d/10-app.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ expose_php = 0
date.timezone = UTC
apc.enable_cli = 1
session.use_strict_mode = 1
zend.detect_unicode = 0

upload_max_filesize = 16M
post_max_size = 32M
zend.detect_unicode = 0

; https://symfony.com/doc/current/performance.html
realpath_cache_size = 4096K
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions frankenphp/conf.d/20-app.prod.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
; https://symfony.com/doc/current/performance.html#use-the-opcache-class-preloading
opcache.preload_user = root
opcache.preload = /app/config/preload.php
; https://symfony.com/doc/current/performance.html#don-t-check-php-files-timestamps
opcache.validate_timestamps = 0
2 changes: 0 additions & 2 deletions frankenphp/conf.d/app.prod.ini

This file was deleted.

14 changes: 10 additions & 4 deletions frankenphp/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
composer config --json extra.symfony.docker 'true'

if grep -q ^DATABASE_URL= .env; then
echo "To finish the installation please press Ctrl+C to stop Docker Compose and run: docker compose up --build -d --wait"
echo 'To finish the installation please press Ctrl+C to stop Docker Compose and run: docker compose up --build -d --wait'
sleep infinity
fi
fi
Expand All @@ -26,8 +26,12 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
composer install --prefer-dist --no-progress --no-interaction
fi

# Display information about the current project
# Or about an error in project initialization
php bin/console -V

if grep -q ^DATABASE_URL= .env; then
echo "Waiting for database to be ready..."
echo 'Waiting for database to be ready...'
ATTEMPTS_LEFT_TO_REACH_DATABASE=60
until [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ] || DATABASE_ERROR=$(php bin/console dbal:run-sql -q "SELECT 1" 2>&1); do
if [ $? -eq 255 ]; then
Expand All @@ -41,11 +45,11 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
done

if [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ]; then
echo "The database is not up or not reachable:"
echo 'The database is not up or not reachable:'
echo "$DATABASE_ERROR"
exit 1
else
echo "The database is now ready and reachable"
echo 'The database is now ready and reachable'
fi

if [ "$( find ./migrations -iname '*.php' -print -quit )" ]; then
Expand All @@ -55,6 +59,8 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then

setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var
setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var

echo 'PHP app ready!'
fi

exec docker-php-entrypoint "$@"
4 changes: 2 additions & 2 deletions src/Controller/Admin/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
use App\Form\Type\CategoryType;
use App\Repository\CategoryRepository;
use App\Service\Admin\CategoryService;
use Symfony\Component\Form\ClickableInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\SubmitButton;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
Expand Down Expand Up @@ -42,7 +42,7 @@ public function new(Request $request, CategoryService $service): Response
if ($form->isSubmitted() && $form->isValid()) {
$service->create($category);

/** @var ClickableInterface $button */
/** @var SubmitButton $button */
$button = $form->get('saveAndCreateNew');
if ($button->isClicked()) {
return $this->redirectToRoute('admin_category_new');
Expand Down
Loading
Loading