Skip to content

Latest commit

 

History

History
64 lines (43 loc) · 3.72 KB

readme.md

File metadata and controls

64 lines (43 loc) · 3.72 KB

Zerops x Nette

Nette QuickStart is a very simple web application based on Nette Framework. Zerops recipe for Nette QuickStart includes session and cache stored in Redis, and PostgreSQL DB with Nextras migrations.

nette


Deploy on Zerops

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.

Deploy on Zerops


Recipe features

  • Nette running on a load balanced Zerops PHP + Nginx service
  • Zerops PostgreSQL 16 service as database
  • Zerops KeyDB (Redis) service for session and cache
  • Setup for Nextras database migrations with automatic admin user creation
  • Logs set up to use syslog and accessible through Zerops GUI
  • Utilization of Zerops built-in environment variables system
  • AdminerEvo for quick database management tool

Production vs. development

Base of the recipe is ready for production, the difference comes down to:

  • Use highly available version of the PostgreSQL database (change mode from NON_HA to HA 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)
  • Disable public access to Adminer or remove it altogether (remove service adminer from recipe YAML)
  • Set APP_ENV to prod in envSecrets, app section of import YAML

Changes made over the default installation

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
  • Set debug mode according to APP_ENV env variable in your ./app/Bootstrap.php file
  • Add nette/redis to your composer.json to store sessions in Redis
  • Add nette/monolog to your composer.json to log into the syslog
  • Add nextras/migrations to your composer.json to utilize automated DB migrations
    • create ./migrations folder structure similar to this repo (we moved content of database.sql into it)
    • SQLite (./data/blog.sqlite) was replaced by PostgreSQL database container


Additional info

Admin login for this recipe is admin 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.