This is a quick guide on deploying Strapi to a Kubernetes cluster in AWS/GCP/DO using Porter. This guide uses PostgresDB by default - to customize your database settings, modify the files in
/app/config/env/production in the example repository.
- Create an account on Porter.
- One-click provision a Kubernetes cluster in a cloud provider of your choice, or connect an existing cluster.
- Fork this repository.
- From the Launch tab, navigate to Web Service > Deploy from Git Repository. Then select the forked repository and
Dockerfilein the root directory.
- Configure the port to
1337, add environment variable
NODE_ENV=production, and set resources to the recommended settings (i.e. 2048Mi RAM, 1000 CPU).
- Hit Deploy!
- Strapi instance deployed through Porter connects to PostgresDB. You can connect Strapi instance deployed on Porter to any external database, but it is also possible to use a database that is also deployed on Porter. Follow this guide to deploy a PostgresDB instance to your cluster in one click.
- After the database has been deployed, navigate to the Environment Variables tab of your deployed Strapi instance. Configure the following environment variables:
NODE_ENV=production DATABASE_HOST= DATABASE_PORT=5432 DATABASE_NAME= DATABASE_USERNAME= DATABASE_PASSWORD=
For details on how to connect to the deployed database, see this guide.
To develop, clone this repository to your local environment and run
npm install && npm run develop; from the
app directory. Porter will automatically handle CI/CD and propagate your changes to production on every push to the repository.
Join the Porter Discord community if you have any questions or need help.
Updated 4 months ago