This is the most bare-bones example of Go app running on Zerops — as few libraries as possible, just a simple endpoint with connnect, read and write to a Zerops PostgreSQL database.
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.
- Golang v1.22. on a load balanced Zerops Go service
- Zerops PostgreSQL 16 service as database
- Healthcheck setup example
- Utilization of Zerops' built-in environment variables system
- Utilization of Zerops' built-in log management
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 the GO service to achieve high reliability and resilience (add minContainers: 2in recipe YAML,apiservice section)
Further things to think about when running more complex, highly available GO production apps on Zerops:
- Containers are volatile - use Zerops object storage to store your files
- Use Zerops Redis (KeyDB) for caching, storing sessions and pub/sub messaging
- Use more advanced logging lib, such as Logrus, Zap or ZeroLog
Need help setting your project up? Join Zerops Discord community.