11min

Deploy an Existing Strapi App

When you deploy infrastructure with the Strapi Serverless template, you have the possibility to create a new Strapi application in your Git repository or select an existing Strapi application if you already have one. 

By using Git for your Strapi projects, the process of moving content types from one environment to another is much easier and deployments are more predictable.

Prepare your existing Strapi repository

The first thing you need to do is to define the pipeline and the Dockerfile for your Strapi project.

The easiest way to do this is by using Microtica Component Generator CLI.

Shell
|

This will create a new .microtica folder in your Strapi project that contains the microtica.yaml pipeline spec and a Dockerfile.

Below is the flow for deploying your existing Strapi project on AWS. 

1. Review your database configuration

Before deploying the Strapi template, please make sure that you have a correct database configuration. This is important to make it right because the template provides some predefined environment variables in the app runtime that can be used in the Strapi project.

Here is an example of a working database configuration:

config/database.js
|

2. Select the Strapi Serverless Template.

Document image

3. Import Git Repository

As a first step, you need to connect a Git account (GitHub, Bitbucket, or GitLab). If you already have a Git account connected to Microtica, you can choose it from the list. Select the repository with your existing project, click Import, and every Git push will be deployed automatically in Microtica.

Document image

4. Configure Template

The second step is to configure the environment variables for this template. Variables provide a way to customize a template to meet your requirements.  For example, here is where you configure the scaling parameters for your Strapi app. You can scale your app vertically and horizontally. For vertical scaling, update the CPU and Memory configuration in this section. For horizontal scaling, update the number of desired replicas in the same section.

In this section you can also choose the database client - sqlite is the default option.

Document image

You can update the configuration later as well.

5. Configure Environment

After configuring the template, you will need to select an environment where the template will reside. Environments are a great way to separate your development and production applications. If you need to create a new environment, you can enter the environment name and description and click the Select button. You can also choose an existing environment if you have created one previously. 

Next, you need to configure the target AWS account where your Strapi infrastructure will be provisioned. Here is a quick guide on How to Connect your AWS account.

6. Deploy 

Once your AWS account is connected and configured in the environment, click on the Deploy button to trigger the deployment.

It takes up to 10 mins to create a live Strapi environment.

You can follow the pipeline logs inline, and monitor your deployment in real-time. 

Once the template deployment finishes, you can find the access URL in Environment > Infrastructure > ContainerRunner view, under Resource outputs, the AccessURL parameter. Copy-paste it in the browser to see your Strapi Demo app.  

Document image

Microtica uses Strapi v4 as a default version for the Strapi Serverless template.

ÔĽŅ