If you are new to building with Strapi, you may wonder how to handle migration across all environments for development, production, and testing. This article will help you decide which platform will be best for deploying your production app.
What is Strapi?
Strapi is an open-source headless content management system (CMS) built to provide ease while developing APIs with different features and working with all frontend GraphQL enabled frameworks. With Strapi, you can create content types, handle users, and manage images and audio using the media library.
Hosting your Strapi Application
You are required to host and communicate with your API on a live server. This article will focus on the different Strapi environments, what to consider before picking a deployment option, and their pros and cons.
Strapi Environments
Environment variables are provided to be used in Config files. Instead of writing the credentials across all config files, they are defined in a .env
file to configure development, production, and test environments.
Your project is in the Development environment when it is still being worked on locally. This is indicated in the structure and config; it is in the production environment once deployed.
The state of your environment affects the availability of certain features like the content-type builder. Watch this video to see how to migrate your content across environments.
Most Popular Deployment Options
Take complete control of your deployment and deploy on more robust platforms. Here is a list of the most popular recommendations and the advantages and limitations of some of these deployment options. That way, it’s easier to decide what works best for you.
Amazon AWS EC2:
Amazon AWS EC2 is a service offered as part of Amazon Web Services; it allows you to deploy your Strapi apps without worrying about how to scale or pay more than you utilize. Find their pricing on their website.
The Elastic Computer Service allows you to decide the geographical location for your instance; this improves reliability and eliminates network delay. It also runs on multiple operating from Linux, Fedora, and Redhat to Windows.
You can use the guide for help when setting up.
Advantages:
- You have total control over your deployment and can manage any aspect of your production app.
- You can deploy your app in any region.
- You get to pay for only what you use.
Disadvantages:
- The deployment process is lengthy compared to others.
- Setting up your instance could be complicated.
Azure:
Azure is powered by Microsoft and offers Compute Service that runs on Windows and Linux, on which you can deploy complex applications. You can start without cost and pay on the go while scaling your application. The deployment guide is available in the documentation.
Advantages:
- You have access to your production files and database and can manage them.
- You only pay based on your consumption
- Scalability is easier.
Disadvantages:
- The deployment process is lengthy and takes a while.
- You might require some knowledge of DevOps.
DigitalOcean
Digital Ocean offers Linux-based virtualized hardware, which can either be independent or part of a more extensive infrastructure, and access to firewalls, with unlimited scalability. Their pricing is flexible, and there is an extensive guide on how to get started.
Advantages:
- Great server quality.
- Cheap and affordable pricing.
- Flexibility and scalability: You can easily upgrade your infrastructure if your app grows.
Disadvantages:
- It takes time to set up the server.
- Lack of CDN.
Heroku
Heroku is a cloud platform focused on applications and developer experience. They provide a secure, scalable database-as-a-service with constant threat monitoring and automatic operating system vulnerability patching.
You can extend applications for use with Heroku with over 200 Add-ons available in Heroku Elements Marketplace. There are different plans based on dyne hours per month; you can find the pricing on their website. If this is the option for you, you can get started using the deployment documentation.
Advantages:
- Easy Setup: You can easily launch your Strapi App with Heroku without bothering about configuring the database.
- Scalability: You can purchase more dynos and size up your DB.
- Great plugin support for third-party apps.
Disadvantages:
- Cost: It is relatively more expensive than using an IaaS for the same level of performance.
- Limited Access: You cannot manage your deployment right from the server.
- Deployment Issues: Once you make a wrong push to the GitHub repository, Your deployment is equally affected.
Platform.sh
The Platform.sh cloud allows developers to deploy their applications fast and worry less about scalability and database management. The main requirement is that you use Git to manage your application code.
Managing your stack on Platform.sh gives you features like Unified Environment, Multi-Services & Multi-App, Full Cluster Cloning Technology, Fail-Proof Deployments, and more. The deployment process is completed within minutes, and there is no downtime, and you can find the pricing on their website.
Advantages:
- It has good documentation and a detailed guide on deploying your apps.
- You can deploy at scale anywhere: If your apps grow bigger, You can easily scale your app.
- It includes a diverse library of development languages and frameworks.
Disadvantages:
- Limited access and control: You do not have access to managing your production database and others.
- Deployment issues: An accidental bad push to the repository can crash your production app.
Render
Render is a cloud-based solution for building and running apps, websites, and CDNs with free TLS certificates. They have flexible pricing and offer database management with PostgreSQL. If you are considering this option, you can follow the deployment guide here.
Advantages:
- It is developer-friendly: It’s easy to use and requires just a few steps to deploy.
- Free and automatic SSL is available.
- It provides daily database backups to prevent loss of data.
Disadvantages:
- It does not have simple shared hosting.
Strapi Cloud
Strapi Cloud provides a holistic package that combines a server with a database, asset storage, a CDN (Content Delivery Network), and an email service. On top of these foundational elements, Strapi is highly customizable and will significantly enhance the experience for developers and content managers.
Advantages:
- Easy and quick deployment
- One-stop shop for hosting, database, asset storage, and email.
- Cut down on the cost of complexities of managing infrastructure.
Disadvantages: -Tailored for SMBs: does not offer free or hobby plans.
Conclusion
When deciding on the best deployment option, there are many things to consider: project requirements, budget, team size, and deadlines. Hopefully, you have some great options to consider with that in mind.
Host on Strapi Cloud
The Strapi experience has always been about flexibility, customization, and open-source innovation. But we understand that managing infrastructure and scaling your application can sometimes be a daunting task, diverting your focus from what you do best: developing web experiences.
That's why we're excited to introduce Strapi Cloud, so you can leverage the same robust Strapi capabilities you love, but without the hassle of managing servers, worrying about uptime, or scaling infrastructure as your project grows. It will allow you to future-proof your apps with a CMS that meets the content management needs of all your stakeholders, no matter your use case, services or devices.
Strapi remains committed to open-source values, and self-hosting will always be a viable option. We believe in offering choices that align with your project's unique needs. Strapi Cloud is an additional resource for those who want to focus solely on development, leaving the infrastructure to us.
Aw are here to support you every step of the way, no matter which hosting option you choose. You can reach out to us and the community on our Discord if you have any questions!
Web and Blockchain Software Engineer who is passionate about using technology towards achieving SDGs, creating innovative solutions, open-source, and building communities. He is building EduKarma for innovative learning in Africa.