This project is a Strapi application already configured to be deployed on Clever Cloud and to use object storage with Cellar. It complements the walkthrough from Pierre Guézennec: https://www.camino.dev/blog/deployer-cms-strapi-clever-cloud
This README contains two sections:
- Initial/manual deployment (quickstart and Clever Cloud-specific setup)
- Terraform automation (infrastructure + app provisioning)
Strapi comes with a full featured Command Line Interface (CLI) which lets you scaffold and manage your project in seconds.
Start Strapi with auto-reload enabled:
npm run develop
# or
yarn developStart Strapi with auto-reload disabled (production-like):
npm run start
# or
yarn startBuild the admin panel:
npm run build
# or
yarn buildStrapi gives you many possible deployment options for your project including Strapi Cloud. Browse the deployment section of the documentation to find the best solution for your use case.
Deploy this app with the following tools:
Inject the following environment variables:
ADMIN_JWT_SECRET="<your-token>"
API_TOKEN_SALT="<your-token>"
APP_KEYS="<your-token>,<your-token>,<your-token>,<your-token>"
CC_NODE_BUILD_TOOL="yarn"
CELLAR_ADDON_REGION="fr-par"
CELLAR_BUCKET="<your-bucket-name>"
DATABASE_CLIENT="postgres"
HOST="0.0.0.0"
JWT_SECRET="<your-token>"
NODE_ENV="production"
TRANSFER_TOKEN_SALT="<your-token>"Run openssl rand -hex 32 for each value and replace <your-token> with the result.
If you use custom domain, change origin: on middlewares.js
Environment variables have already been set in the code.
This project uses @strapi/provider-upload-aws-s3 to store assets and has already been set up.
Don't forget to connect your add-ons to the application (Service dependencies option from your app menu in Clever Cloud Console).
Cellar policies need to be public. Follow this documentation.
Strapi can run on a small instance like the XS plan, but the build process can take more RAM and CPU. Enable a dedicated build instance from your app menu Information option in Clever Cloud Console.
This repository includes Terraform configuration to provision the Clever Cloud application, add-ons, and related resources.
- Install Terraform: https://www.terraform.io/downloads
- A Clever Cloud account: https://console.clever-cloud.com
- Clever Cloud credentials (create a token in the Clever Cloud console or with
clever login). Get tokens from: https://console.clever-cloud.com/users/me/tokens
- Clone the repository
git clone https://github.com/CleverCloud/strapi-example.git
cd strapi-example- Generate secrets
cd terraform
./generate-secrets.sh > secrets.txt- Configure Terraform variables
cp terraform.tfvars.example terraform.tfvars
# Edit terraform/terraform.tfvars with your values, Clever Cloud tokens and the generated secrets- Initialize Terraform
terraform init- Review the plan
terraform plan- Deploy
terraform apply- Retrieve the application URL
terraform output app_urlThis project uses @strapi/provider-upload-aws-s3 to store assets and has already been set up.
Don't forget to connect your add-ons to the application (Service dependencies option from your app menu in Clever Cloud Console).
Cellar policies need to be public. Follow this documentation.
- Change instance sizes in
terraform/terraform.tfvars:
instance_type = "S" # Options: XS, S, M, L, XL
build_instance_type = "L" # Larger build instance for faster builds- Add a custom domain in
terraform/terraform.tfvars:
custom_domain = "strapi.yourdomain.com"- Scale the number of instances:
instance_count = 2- Never commit
terraform/terraform.tfvarscontaining secrets. - Add the following (recommended) entries to your repository
.gitignore.
############################
# Terraform
############################
terraform/.terraform/
terraform/*.tfstate
terraform/*.tfstate.backup
terraform/*.tfstate.*.backup
terraform/.terraform.lock.hcl
terraform/terraform.tfvars
terraform/secrets.txt
terraform.tfstate
############################
# Strapi
############################
.env
.cache
license.txt
exports
.strapi
dist
build
.strapi-updater.json# Destroy infrastructure
terraform destroy
# Show outputs
terraform output
# Inspect state
terraform showcd terraform./generate-secrets.sh > secrets.txtcp terraform.tfvars.example terraform.tfvarsand edit with your values and secretsterraform initterraform plan && terraform apply
- Resource center - Strapi resource center.
- Strapi documentation - Official Strapi documentation.
- Strapi tutorials - List of tutorials made by the core team and the community.
- Strapi blog - Official Strapi blog containing articles made by the Strapi team and the community.
- Changelog - Find out about the Strapi product updates, new features and general improvements.
Feel free to check out the Strapi GitHub repository. Your feedback and contributions are welcome!
- Discord - Come chat with the Strapi community including the core team.
- Forum - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members.
- Awesome Strapi - A curated list of awesome things related to Strapi.