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:
Make a change in codebase (Strapi app) then push it to GitLab.
The newest commit automatically triggers build (building a docker image of the Strapi app) using GitLab CI.
Then after the build is successful, GitLab CI will push the docker image to AWS ECR.
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.
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 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).