How to deploy new versions of your Strapi app with Microtica: Tips & Tricks
Tags: strapi, deployment, aws, microtica
Published: 2024-01-16 09:00:12

Strapi is an open-source, headless CMS, while Microtica offers cloud-based infrastructure delivery and management, simplifying application deployments. Both prioritize scalability, performance, and deployment ease, advocating for efficient development processes and content delivery.

In this blog, we will briefly overview the **best practices for deploying new versions of Strapi** with Microtica. We’ll cover key strategies for smooth deployment, avoiding common mistakes, and handling multiple environments like dev, test, and prod. Additionally, we’ll discuss how our platform can assist with version control and answer some frequently asked questions about deploying new Strapi versions with Microtica.

## How to Deploy New Strapi Versions?

When deploying your application with Microtica for the first time, you can use the ready-made [Strapi Serverless Template](https://app.microtica.com/templates/new?template=https%3A%2F%2Fraw.githubusercontent.com%2Fmicrotica%2Ftemplates%2Fmaster%2Fstrapi-serverless%2F.microtica%2Ftemplate.yaml&utm_source=devto&utm_medium=blog&utm_campaign=strapi+deployments), and either create a new application in your provided git repository or import an existing application if you’re migrating to AWS.

Microtica’s template **pre-configures a fully managed cloud environment for Strapi**, based on serverless Fargate.

## Automated Deployment with Git Versioning

One of the key advantages of using Microtica is its ability to automate the deployment workflow. Set up a pipeline that integrates with your version control system (e.g., GitHub) to automatically trigger deployments whenever there are new Strapi versions or changes in your application. This ensures consistency and reduces the chances of human error during the deployment process.

**1.Branching**: When you create your application using the template, you can choose the branch from which you want to deploy your application. This is important because you might have **different branches for different environments** or feature previews. Every git push to that branch triggers a seamless automatic deployment of the new version and code changes.

![Configure template in Microtica](https://assets-global.website-files.com/62b04b3a715c202b5fa1408b/65a14575136ea18d808097d8_F2iW5xqiEePZyZyYw0fXRJKfl-cHqQ_bw3q0U-O-LhxbmEqV9MvFa2zz14r-269peGAwnCDeG7nOXko8RPIXf2JLGKpfvisHd-N4_XmmWsDCTlxp0_-3mT1vEw8XvbUpJ-tpAaORzHoYF1E1GzOiejw.png)

**2. Create a Microtica pipeline**: If you create the Strapi application using the template, you have a preconfigured [*microtica.yaml *file](http://strapi-serverless/.microtica/microtica.yaml) with a defined Microtica pipeline that includes stages for building, testing, and deploying your application. You can easily configure these stages in your Git repository and Microtica will automate the entire deployment lifecycle.

**3. Versioning and tagging**: Implement versioning and tagging mechanisms for your Strapi application within your version control system. This ensures that you can easily track changes, rollback to previous versions if needed, and maintain a clear history of your deployments. Additionally, you can customize this feature by defining *filepath patterns* that enable you to automatically trigger your builds and deployments only when specific files change.

## Manual Deployments of Your Strapi App

Microtica also provides the ability to deploy applications manually by triggering the deployment pipeline directly from the user interface (UI). While manual deployments can be useful in certain scenarios, we strongly encourage adopting automated deployment practices.

You can manually trigger deployments after testing and verifying the new version in a separate environment. This approach can offer more control over the rollout process, giving you a chance to [rollback](https://docs.microtica.com/automated-rollbacks?utm_source=devto&utm_medium=blog&utm_campaign=strapi+deployments) if needed.

![Trigger deployments in Microtica](https://assets-global.website-files.com/62b04b3a715c202b5fa1408b/65a145750475983df2383b1e_5LS7qTJbZYlGRNQAzxqh084R20DTITsGfNY4U7ZbXt72brL19eTXq39Jptf7ffW6oTrRW3A1-bNPiLXZ1WFwPwy6HvMC1SmZEX5aHxl-3ncoA5LJuqlSeR5DDCoV9VF2plvuSYawRA8Mjxxyfsp3GUo.png)

## The Hybrid Approach for Strapi Update

A third common approach that our customers seem to find useful, is to **combine automated deployments** for minor updates **with manual rollouts** for major Strapi versions. This method leverages the convenience of automatic updates for minor bug fixes and stability improvements while providing control for significant feature changes.

## Handling Multiple Environments When Deploying Strapi on AWS

Strapi applications often have different requirements and configurations for development, testing, and production environments. Microtica provides a robust solution for managing these environments efficiently.

Each project in Microtica consists of multiple environments, which are isolated from each other, allowing teams to integrate different code bases with each environment. You can quickly deploy new code versions, test them, and rollback if necessary.

## Environment-specific Configurations — Environment Variables

Leverage Microtica’s support for environment variables to **configure specific settings for each environment**. For example, set up different database connections, cache configurations, or API endpoints for each environment, ensuring a smooth transition from development to production.

All environment variables can be configured using Microtica’s user interface, eliminating the need for manual coding. This makes setting up and switching between environments faster and more reliable.

![Environment variables configuration](https://assets-global.website-files.com/62b04b3a715c202b5fa1408b/65a14575e2ed6a663750d197_JIzvEYiUJSszo2jfjBO-FE2BgUmsVWsmx7_c0sOPWnj0fKszehiYvcsszU66r_G-kRODGiRCPobpAVsNrpbvPeZk65dxgwUqnnGsmyahhL4BlX2g_JgRT_Zb0yknz4YWsZBskG89PumOETsKkvyCC3s.png)

Microtica enables teams to quickly and easily create and destroy environments as needed. It also allows them to monitor and track performance in real-time, create alarms, and receive application alerts. This helps teams to quickly identify and address any issues that may arise.

## Immutable Infrastructure to Streamline Strapi Deployments

By adopting Microtica for your Stapi application delivery on AWS, you’re also adopting the immutable infrastructure approach. The necessary **infrastructure is treated as code**, which reduces the chances of environment drift and ensures that your application behaves predictably across different stages.

Microtica supports popular IaC tools, such as AWS CloudFormation, enabling you to manage infrastructure configurations in a version-controlled manner.

## Beyond the Basics — A Seamless Workflow

* **Continuous testing**: Integrate continuous testing into your Microtica pipeline to catch potential issues early in the deployment process. Automated tests can help validate the functionality and performance of your Strapi application across various environments.

* **Monitoring and logging**: The platform offers real-time monitoring and logging mechanisms into your application’s performance, CPU, and memory usage. The **new version 3.0** will offer enhanced monitoring tools, like dashboards with crucial metrics, incidents, and alert systems. This ensures that you can proactively identify and address issues in your application at any time.

* **Scalability**: Let Microtica do the heavy lifting with its built-in autoscaling feature. Define target metrics and thresholds, and Microtica will automatically adjust your Strapi instances based on real-time demand, taking the guesswork out of scaling.

* **Resource optimization**: Monitor your resource usage to identify underutilized instances and optimize your costs. Microtica provides detailed insights to help you make informed decisions about your scaling strategy.

## Conclusion

Deploying new versions of Strapi with Microtica offers a streamlined and automated process, allowing for efficient management of multiple environments. By following best practices such as automated workflows, environment-specific configurations, and continuous testing, you can ensure **a reliable and scalable deployment pipeline** for your applications. Microtica’s features empower developers to focus on building and enhancing their Strapi projects, confident in the knowledge that the deployment process is both efficient and robust.

## Additional documentation resources:

* [Automated deployments](https://docs.microtica.com/automated-deployments?utm_source=devto&utm_medium=blog&utm_campaign=strapi+deployments)

* [Pipelines](https://docs.microtica.com/pipelines?utm_source=devto&utm_medium=blog&utm_campaign=strapi+deployments)

* [Automated Rollbacks](https://docs.microtica.com/automated-rollbacks?utm_source=devto&utm_medium=blog&utm_campaign=strapi+deployments)

* [The Serverless Template](https://docs.microtica.com/strapi-serverless?utm_source=devto&utm_medium=blog&utm_campaign=strapi+deployments)

* [Cloud Cost Optimization](https://docs.microtica.com/cloud-cost-optimization?utm_source=devto&utm_medium=blog&utm_campaign=strapi+deployments)