Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@alexander-schranz
Copy link
Member

@alexander-schranz alexander-schranz commented Feb 18, 2025

Warning

This is WIP we will remove this warning when the example works as expected.

What's in this PR?

Example for Using Dunglas Symfony Docker: https://github.com/dunglas/symfony-docker, see also Sulu Docs PR: sulu/sulu-docs#829

Steps

Install https://github.com/dunglas/symfony-docker

Add additional PHP Extensions:

  • gd, pdo_mysql

Update in compose.yaml the DATABASE_URL:

  • DATABASE_URL: mysql://${MYSQL_USER:-root}:${MYSQL_PASSWORD:-ChangeMe}@database:3306/${MYSQL_DATABASE:-su_demo}?serverVersion=${MYSQL_VERSION:-8}&charset=${MYSQL_CHARSET:-utf8mb4}
  • ELASTICSEARCH_HOSH: elasticsearch:9200

Disable workermode in worker.Caddyfile comment APP_RUNTIME out:

  • # env APP_RUNTIME Runtime\FrankenPhpSymfony\Runtime

Increase memory_limit if required frankenphp/conf.d: 10-app.ini, 20-app.dev.ini, 20-app.prod.ini:

  • memory_limit=512M

Configure Volumes for var/uploads and public/uploads:

# TODO ??

Build the docker:

docker compose build --no-cache

Start without TLS and other Ports (Mac don't allow bind :80 or :443):

SERVER_NAME=http://localhost HTTP_PORT=8001 HTTPS_PORT=4443 HTTP3_PORT=4443 docker compose up

Visit Server:

open http://127.0.0.1:8001

Go into the php container:

docker compose exec -ti php /bin/bash

bin/console sulu:build dev

Copy link
Member Author

@alexander-schranz alexander-schranz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking the lines which are different to dunglas/symfony-docker:

Comment on lines +36 to +43
# additional sulu extensions
RUN set -eux; \
install-php-extensions \
gd \
curl \
dom \
bz2 \
;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This we added additional atleast gd is required to run Sulu. Alternative is imagick or ffi (when using vips adapter)


###> recipes ###
###> doctrine/doctrine-bundle ###
RUN install-php-extensions pdo_mysql
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required by default postgres is here but demo comes with MySQL

MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
# Run "composer require symfony/orm-pack" to install and configure Doctrine ORM
DATABASE_URL: mysql://${MYSQL_USER:-root}:${MYSQL_PASSWORD:-ChangeMe}@database:3306/${MYSQL_DATABASE:-su_demo}?serverVersion=${MYSQL_VERSION:-8}&charset=${MYSQL_CHARSET:-utf8mb4}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is hardcoded to postgres in symfony docker we changed this to mysql

@@ -0,0 +1,4 @@
worker {
file ./public/index.php
# env APP_RUNTIME Runtime\FrankenPhpSymfony\Runtime
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a quick start without worker mode

MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
# Run "composer require symfony/orm-pack" to install and configure Doctrine ORM
DATABASE_URL: mysql://${MYSQL_USER:-root}:${MYSQL_PASSWORD:-ChangeMe}@database:3306/${MYSQL_DATABASE:-su_demo}?serverVersion=${MYSQL_VERSION:-8}&charset=${MYSQL_CHARSET:-utf8mb4}
ELASTICSEARCH_HOST: elasticsearch:9200
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the demo uses elasticsearch so we need point to elasticsearch container instead go over the IP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants