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.

  1. Log in to GitHub and create a new repository from this template (Use this template > Create a new repository): Kinsta – Statamic Boilerplate.
  2. Statamic is based on Laravel, so the APP_KEY environment variable must be set. You can generate an app key yourself locally, or you can use this online Laravel key generator.
  3. In MyKinsta, add an application with the Statamic Starter repository. In Environment variables:
    1. In Key 1, enter APP_KEY, and in Value 1, paste the key generated from Step 2.
    2. Click Add another and in Key 2, enter APP_KINSTA, and in Value 2, enter true.
    3. Select Available during runtime and Available during build process.
  4. 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.
  5. 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.
  6. 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 welcome page after successful installation.
Statamic welcome page after successful installation.

Environment Variables

Statamic requires the following environment variables to be set:

Buildpacks

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
  • PHP

Web Server Setup

Start Command

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.