This repository demonstrates how to set up and deploy Twill applications using Zerops for both development and production environments.
Twill is a CMS toolkit for Laravel that makes it quick and easy to create a custom, powerful admin console. This recipe showcases how to run a Twill application on Zerops, including all advanced functionalities, with sessions and cache stored in Redis and files stored in Object Storage, making it suitable for production of any size.
You can either click the deploy button to deploy the development setup directly on Zerops or manually copy the import yaml to the import dialog in the Zerops app.
- Twill running on a load-balanced Zerops PHP + Nginx service
- Zerops MySQL service as the database
- Zerops KeyDB (Redis) service for session and cache
- Zerops Object Storage (S3 compatible) service as the file system
- Proper setup for Laravel cache, optimization, and database migrations
- Logs set up to use syslog and accessible through Zerops GUI
- Utilization of Zerops built-in environment variables system
- Utilization of Zerops readiness check for proper Zero downtime deployment
- Utilization of Zerops health check for advanced app monitoring
- Mailpit as SMTP mock server
- Adminer for quick database management tool
- S3browser for quick S3 storage browsing and testing
This setup includes tools and configurations for a rapid development cycle:
- Mailpit as the SMTP mock server
- Adminer for quick database management
- Fully commented-out configurations that you can easily switch to production settings
For a production-ready environment, consider the following modifications:
- Use a highly available version of the MySQL database
- Use at least two containers for the Twill service to achieve high reliability and resilience by adding
minContainers: 2
in the recipe YAML. - Use a production-ready third-party SMTP server instead of Mailpit.
- Disable public access to Adminer or remove it altogether from the recipe YAML.
You can see a production example setup at
zerops-project-import-production.yml
.
To modify your existing Twill app to run efficiently on Zerops, follow these steps:
- Add zerops.yml to your repository. The provided example includes idempotent migrations, caching, and an optimized build process.
- Add league/flysystem-aws-s3-v3 to your composer.json to support the Object Storage file system.
- Setup health checks. Health checks are enabled out of the box in Laravel 11.
- Utilize Zerops environment variables and secrets to setup S3 for the file system, Redis for cache and sessions, and trusted proxies to work with a reverse proxy load balancer.
- Frontend and Backend:
- The setup includes a fully functional example of a frontend page and a backend seeded with data.
- Object Storage:
- Media are stored in Object Storage with local caching via Glide.
Need help setting your project up? Join the Zerops Discord community.