Nette Contributte is a web application skeleton based on Nette Framework, Doctrine and Contributte libraries. Zerops recipe for Contributte skeleton includes session and cache 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.
- Nette running on a load balanced Zerops PHP + Nginx service
- Zerops PostgreSQL 16 service as database
- Zerops KeyDB (Redis) service for session and cache
- Proper setup for Nettrine cache, optimization, and 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
modefromNON_HAtoHAin recipe YAML,dbservice section) - Use at least two containers for Nette service to achieve high reliability and resilience (add
minContainers: 2in recipe YAML,appservice section) - Use production-ready third-party SMTP server instead of Mailpit (change
parameters.smtpvariables in./config/app/parameters.neonfile) - Disable public access to Adminer or remove it altogether (remove service
adminerfrom recipe YAML) - Set
NETTE_DEBUGto0andNETTE_ENVtoprodinenvSecrets,appsection of import YAML - Create
adminuser manually throughcreate-userconsole command (in dev mode this is handled by fixtures) and- remove following line from
zerops.yml:- zsc execOnce ${appVersionId}-fixtures -- php /var/www/bin/console doctrine:fixtures:load --no-interaction
- add
--no-devto the following line inzerops.yml:- composer install --optimize-autoloader
- remove following line from
If you want to modify your existing Nette 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
$configurator->addDynamicParameters(['env' => getenv()]);to your ./app/Bootstrap.php file to use env variables in your neon configuration files - Add contributte/redis to your composer.json to store sessions in Redis
- configure it according to our ./config/env/base.neon file
- Add contributte/monolog to your composer.json to log into the syslog
- utilize the following handler:
Monolog\Handler\SyslogHandler(app)(see our ./config/ext/contributte.neon)
- utilize the following handler:
Admin login for this recipe is admin@admin.cz with automatically generated password,
which can be found under ADMIN_PASSWORD name in Zerops Environment variables section of app service.
Need help setting your project up? Join Zerops Discord community.