The Twelve-Factor App implementation in Strapi

Hi, I trying to implement The Twelve-Factor App in Strapi by deploying it to a cloud infrastructure which is AWS. The service I am using is AWS ECS-Fargate.

Steps to deploy:

  1. Make a change in codebase (Strapi app) then push it to GitLab.
  2. The newest commit automatically triggers build (building a docker image of the Strapi app) using GitLab CI.
  3. Then after the build is successful, GitLab CI will push the docker image to AWS ECR.
  4. AWS ECS-Fargate, will then pull the docker image and the Strapi app is executed as a service in AWS ECS, having a task definition created in AWS Fargate.

My questions are:

  1. How to implement Concurrency in Strapi app?
  2. How is the Disposability factor implemented in the app? I mean how do I prove that the Strapi app starts fast and shutdowns gracefully?
  3. Are Admin Processes covered in Strapi CLI? How do I do admin tasks in Strapi?

Thank you.

System Information
  • Strapi Version: v3.6.5
  • Cloud Service: AWS
  • Database: MongoDB Atlas
  • Node Version: v14.17.1
  • Yarn Version: v1.22.10

Effectively this is clustering, Strapi supports both vertical and horizontal scaling; for vertical you would use something like PM2 Clusters, horizontal would require a load balancer like HAProxy or Nginx sitting in front of Strapi. They key thing to note here is that, right now, the Strapi nodes are not smart enough to know that others exist or communicate with each other. Their common link is the database.

By default the startup is slow because we do some database checks, though they can be disabled via the database.js configuration file: Configurations - Strapi Developer Documentation

  • autoMigration (boolean): To disable auto tables/columns creation for SQL database.

Keep in mind at least one node will need to handle the migrations, after it is finished the other nodes don’t need to so long as they share the same model structure.

Most of them are not possible via the CLI. You would effectively need to run CURL requests to the Admin REST endpoints which are largely not documented (yet).

Hi @DMehaffy , thanks for your reposnse!

How does Strapi or Strapi docker image (strapi:base14) handle SIGTERM?