This guide explains how to update an existing Strapi project so it can be deployed on Render (opens new window).
With persistent disks and managed PostgreSQL databases, Render gives you multiple different ways to store your content. Render services come with fully managed SSL, so it's no longer necessary to set up a proxy server to secure your Strapi app. Since Render services are automatically restarted if they become unresponsive, you don't need to use a process manager like
详细信息 consult Render's Deploy Strapi guide (opens new window)
# Step 1: Create a Render Account
Visit the Render dashboard (opens new window) to create an account if you don't already have one.
# Step 2: Choose Your Content Storage Method
You have to choose which database system to use for storing structured content, and where to store uploaded media library files.
Below are descriptions of 3 approaches that make different trade-offs between scalability, availability, simplicity, and cost.
- SQLite and Uploads on Disk: this option will use a Render persistent disk (opens new window) to store both a SQLite database file and uploaded media library files. This is a simple and inexpensive approach, appropriate if, for example, you're using Strapi as the data source for a static site generator. See Render's
strapi-sqliterepository (opens new window) for an example of this approach.
- Managed PostgreSQL and Uploads on Cloudinary: if you're using Strapi as the backend for a website or app that dynamically fetches content, scalability and availability are more important. Use a managed PostgreSQL database (opens new window) and Cloudinary for uploads to get horizontal scaling and zero downtime deploys (opens new window). See Render's
strapi-postgres-cloudinaryrepository (opens new window) for an example of this approach.
- Managed PostgreSQL and Uploads on Disk: if you care about performance but can tolerate a few seconds of downtime when you deploy, you can cut costs compared to a paid Cloudinary plan with a hybrid approach. Use managed PostgreSQL (opens new window) for structured content and block storage (opens new window) for uploads. If your project doesn't use the media library you can remove the disk to get horizontal scaling and zero downtime deploys (opens new window). See Render's
strapi-postgresrepository (opens new window) for an example of this approach.
# Step 3: Add a render.yaml File
Select the render.yaml file (opens new window) that matches your storage preferences and add it to the root of your Strapi project.
Alternatively, you can manually configure your service and database in the Render dashboard, instead of using infrastructure as code (opens new window).
# Step 4: Configure Strapi for Production
config/env/production and its contents from the example repository that corresponds to your storage preference.
If you attach a custom domain (opens new window) to your Render service, use it as the
url attribute in
For PostgreSQL, install the
pg package from npm. If you're using Cloudinary, install
The Configuration doc has more info on configuring Strapi
# Step 5: Deploy
- Commit your changes and push them to GitHub or GitLab.
- In the Render dashboard select YAML in the side navigation and click the New From YAML 按钮
- Give Render permission to access your GitHub or GitLab repository if you haven't already.
- Select the repository and branch for your Strapi project and follow the prompts that appear. If you're using Cloudinary, you'll be asked to enter your account credentials as environment variables. Render encrypts environment variables and stores them securely.
# Step 6: Scale
For vertical scaling, upgrade your service to a plan with more CPU and RAM per instance. If you're using a managed database you can upgrade its plan as well. Visit Render's pricing page (opens new window) and consider the recommended requirements in choosing the best plan for your needs. To upgrade, change the
plan field(s) (opens new window) in your
Render services without attached disks can be horizontally scaled. Add a
numInstances field (opens new window) in your
render.yaml file to get multiple instances of your Strapi application running in parallel. Render automatically load balances requests among your instances.
For manually-managed infrastructure you can change the plan and number of instances from the Settings tab in the Render dashboard.