Infrastructure
In this guide, you'll learn about the infrastructure that powers your Cloud projects.
Project's Infrastructure#
Every Cloud project you create is made up of multiple environments, each having their own infrastructure. Cloud automatically provisions and manages the infrastructure of every environment, so you don't have to worry about setting up servers or scaling.
Your project will have at least a production environment, which is your live application. You may create custom long-lived environments for staging or other uses. You may also create short-lived preview environments for testing changes before merging them into production.
This guide only covers the server specs for production, long-lived, and preview environments. You can also learn about other resources of an environment, such as database, redis, and S3 storage.
Production (Long-Lived) Environment Infrastructure#
Production and long-lived environments are stable and scalable, making them ideal for hosting your Medusa applications. Cloud ensures that they're:
- Always available with zero-downtime deployments: Your application will always be available for users, even during deployments. Cloud automatically handles rolling updates without interrupting your users.
- Automatically scaled to meet peak traffic: Cloud automatically scales your servers to handle traffic spikes, such as during flash sales or marketing campaigns. Your application can handle sudden increases in traffic without manual intervention.
- Equipped with server and worker instances: Your application runs on multiple server instances that handle incoming HTTP requests, while worker instances handle background tasks like scheduled jobs and subscribers. This separation allows your application to handle both web traffic and background processing efficiently.
Preview (Short-Lived) Environment Infrastructure#
Preview environments are designed for testing changes before merging them into production. So, they have a simpler setup compared to production environments:
- Cloud automatically scales preview environments to zero after ten minutes of inactivity. So, if no one is using the preview environment, it will automatically shut down to save resources.
- Preview environments run on a single server instance, which is sufficient for testing changes.
The simpler setup is sufficient for testing changes. However, some customizations like scheduled jobs and subscribers may not work as expected since the preview environment may be inactive. You can still use these customizations in long-lived environments normally.