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
- AdminerEvo 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 Nette 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
parameters.smtp
variables in./config/app/parameters.neon
file) - Disable public access to Adminer or remove it altogether (remove service
adminer
from recipe YAML) - Set
NETTE_DEBUG
to0
andNETTE_ENV
toprod
inenvSecrets
,app
section of import YAML - Create
admin
user manually throughcreate-user
console 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-dev
to 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 [email protected]
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.