Symfony Demo is a demo web application based on Symfony Framework, Twig and Doctrine libraries.
Zerops recipe for Symfony Demo app includes sessions stored in Redis, and PostgreSQL DB with doctrine migrations.
You can either click the deploy button to deploy directly on Zerops, or manually copy the import yaml to the import dialog in the Zerops app.
- Symfony running on a load balanced Zerops PHP + Nginx service
- Zerops PostgreSQL 16 service as database
- Zerops KeyDB (Redis) service for session storage
- Setup for Doctrine database migrations
- Logs set up to use syslog and accessible through Zerops GUI
- Utilization of Zerops built-in environment variables system
- Mailpit as SMTP mock server
- Adminer for quick database management tool
Base of the recipe is ready for production, the difference comes down to:
- Use highly available version of the PostgreSQL database (change
mode
fromNON_HA
toHA
in recipe YAML,db
service section) - Use at least two containers for Symfony service to achieve high reliability and resilience (add
minContainers: 2
in recipe YAML,app
service section) - Use production-ready third-party SMTP server instead of Mailpit (change
MAILER_DSN
env variable in./zerops.yml
file) - Disable public access to Adminer or remove it altogether (remove service
adminer
from recipe YAML)
If you want to modify your existing Symfony app to efficiently run on Zerops, these are the general steps we took:
- Add zerops.yml to your repository, our example includes idempotent migrations, caching, and optimized build process
- Add marein/symfony-lock-doctrine-migrations-bundle to your composer.json to enable safe migrations in containerized deployments
- Setup
monolog.syslog_handler
to see logs in Zerops (see our ./config/packages/monolog.yaml) - Setup
session.handler_id
to store sessions inside Redis (see our ./config/packages/framework.yaml, we specifically use DB with index0
) - We had to move
twbs/bootstrap
fromrequire-dev
torequire
in composer section forcomposer install --no-dev
to work - We also had to update
symfonycasts/sass-bundle
tov0.5
or newer for sass compilation to work on alpine linux
Need help setting your project up? Join Zerops Discord community.