This is an example of how to set up a Statamic application to deploy on Kinsta’s Application Hosting services from a GitHub repository.
Statamic is a flat-file CMS that stores all the data in the Git repository. Before you push the code to MyKinsta, you must install it locally, create a super user account, and then commit and push all the changes to the repository.
Kinsta’s Application Hosting works best for stateless applications; you should work on your content locally and only use Kinsta to serve the website to users.
Statamic is based on Laravel; it’s a regular PHP-based application, so MyKinsta automatically installs dependencies defined in your composer.json file during the deployment process.
- Log in to GitHub and create a new repository from this template (Use this template > Create a new repository): Kinsta – Statamic Boilerplate.
- Statamic is based on Laravel, so the
APP_KEYenvironment variable must be set. You can generate an app key yourself locally, or you can use this online Laravel key generator.
- In MyKinsta, add an application with the Statamic Starter repository. In Environment variables:
- In Key 1, enter
APP_KEY, and in Value 1, paste the key generated from Step 2.
- Click Add another and in Key 2, enter
APP_KINSTA, and in Value 2, enter
- Select Available during runtime and Available during build process.
- In Key 1, enter
- The Start command can be left blank for the web process as Kinsta automatically detects the required command during the first deployment.
Note: The first deployment may fail because you need to add the necessary Buildpacks.
- So that the application can build the CSS/JS files, you need to add two buildpacks: Node JS and PHP. Click Settings > Add buildpack, select NodeJS > Add buildpack. Repeat this for PHP.
- Click Deployments > Deploy now > choose the required branch > Deploy application.
The app is available as soon as the build finishes, and the Statamic Welcome page loads at your application’s URL.
Statamic requires the following environment variables to be set:
APP_KEY– You can generate an app key yourself locally, or you can use the online Laravel key generator.
APP_KINSTA– set to
In most cases, you’ll want the application to build the CSS/JS files, so you’ll need to add these two Buildpacks:
- Node JS
Web Server Setup
The default web process is
heroku-php-apache2 public/. If needed, you can change this command when adding your application (Set up your processes) or on the application’s Processes page after deployment.