Deployment Overview
Pegasus---like Django---can be deployed on any standard cloud infrastructure.
The most common ways of deploying Pegasus are:
- On a raw VPS / Virtual Machine, such Digital Ocean, Linode, or Amazon EC2 or Lightsail
- On a platform-as-a-service (PaaS) platform, such as Heroku, or PythonAnywhere
- In a containerized way, using Docker, and (optionally) Kubernetes
Choosing the right deployment architecture involves a complex set of trade-offs, and there’s no one-size-fits-all solution. PaaS and Docker-based solutions tend to be easier to get up and running, but can be more difficult to modify and are often more expensive at scale. Meanwhile, setting up a VPS can be error-prone but is a very cost-effective way to deploy small applications.
Much of the choice will also depend on the knowledge and comfort of you/your team with various tools and platforms. See this Django Deployment Guide for a big-picture overview on choosing a deployment strategy.
Deployment to any VPS
Section titled “Deployment to any VPS”The easiest way to deploy your application to any Linux server is to use Pegasus’s Kamal deployment support. This will deploy your application using portable, cross-platform Docker containers. For more information on deploying to a VPS, see the kamal deployment documentation.
Officially supported PaaS platforms
Section titled “Officially supported PaaS platforms”Pegasus also ships with configuration files to deploy to select platforms out-of-the-box. The officially supported platforms are:
- Render (Python-based)
- Fly (Docker-based)
- Heroku (Python or Docker)
- Digital Ocean App Platform (Docker-based)
- Google Cloud Run (Docker-based)
Render and Fly are comparable, and are the recommended options for staging sites or MVPs, since they are easy to set up and have a generous free tier. Digital Ocean and Heroku tend to be more expensive but have a longer track record. Google Cloud is the most copmlex to set up, but allows you to access Google’s infrastructure.
If you would like to deploy to a platform that’s not listed here, please get in touch on Slack or by emailing [email protected] and I’m happy to help!
Other options
Section titled “Other options”If, for whatever reason, you want to deploy to a VPS but don’t want to use the built in Kamal option, the Django documentation provides a good overview on how to deploy Django to your own server.
Pegasus user Mitja Martini has documented how he deploys his SaaS Pegasus application to a VPS using Dokku (an open-source, self-hosted PaaS platform).
Pegasus user Artem Gordinskiy has documented his experience migrating Pegasus apps from Kamal to Coolify (another open-source, self-hosted PaaS).
Pegasus’s Docker support can be used as a basis for other production environments that supports container---for example, Google Kubernetes Engine and Amazon ECS.
Please reach out in the Pegasus Slack #deployment
channel for any help on this!