Skip to content

Commit

Permalink
Adding deployment guide for Ploi (statamic#880)
Browse files Browse the repository at this point in the history
* Fixing the related articles

* Resolved merge conflict

* Ploi deployment guide

* dark mode tweak

Co-authored-by: Jason Varga <[email protected]>
  • Loading branch information
joshuablum and jasonvarga authored Jul 22, 2022
1 parent 35f6853 commit c00c7c4
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 1 deletion.
81 changes: 81 additions & 0 deletions content/collections/docs/ploi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
id: cf38dba4-5cce-4b81-a2f5-e82665e4e11f
blueprint: page
title: 'Deploying Statamic with Ploi'
intro: |-
Ploi provisions and deploys PHP applications on DigitalOcean,
Linode, Vultr, Amazon, Hetzner and other hosting platforms. It's a piece of 🍰 to deploy a Statamic site with it.
parent: c4f17d05-78bd-41bf-8e06-8dd52f6ec154
---
Assuming you have a [Ploi](https://ploi.io) account, the first thing to do is authorize your hosting provider of choice. In this walk-through we'll use [Hetzner](https://www.hetzner.com) as the example. This is a one-time step and will allow you to easily spin up and provision new server stacks anytime. Go to your [Hetzner Cloud Console](https://console.hetzner.cloud) (or other cloud provider of choice) and create an API token. Documentation on that for Hetzner can be found [here](https://docs.hetzner.com/cloud/api/getting-started/generating-api-token/). Make sure the token has **read and write** access.

<figure>
<img src="/img/deployment-ploi-hosting-setup.jpg" alt="Deployment hosting setup example">
</figure>

## Spinning Up a New Server

Once you have connected to your hosting provider, the next step is to spin up a new server. Ploi automatically tailors the server stack for Statamic and Laravel, so you only need to choose the server size most suitable for your project and you'll be billed accordingly by Hetzner.

<figure>
<img src="/img/deployment-ploi-create-server.jpg" alt="Create server example">
</figure>

## Creating a New Site

The next step is to create a new site. This will scaffold out the directory structure and nginx config on the server, and further allow you to configure your site's environment variables, deployments, and so on.

<figure>
<img src="/img/deployment-ploi-create-site.jpg" alt="Create site example">
</figure>

## Configuring Deployment

<figure>
<img src="/img/deployment-ploi-site-setup-example.jpg" alt="Install repo example">
</figure>

Finally, setup your deployment by pointing your site to your source control repository. Ploi will create a sensible deployment script for you for one-click deployments.


Alternatively, you can use Ploi's [1-click Statamic install](https://ploi.io/statamic) feature to quickly create a new site and an optional repository. You can even use this feature with one of [Statamic's starter kits](https://statamic.com/starter-kits).

<figure>
<img src="/img/deployment-ploi-statamic-preset-example-pixelated.jpg" alt="Install Statamic with Ploi's 1-click feature example">
<figcaption>Whip up a fresh install right from the Ploi dashboard 🚀</figcaption>
</figure>

After doing this, you'll be able to customize the deployment script if needed. You can also enable "**quick deploy**", which will automatically trigger deployments when you push changes to your chosen branch. You can also [use GitHub actions to trigger a deployment](https://ploi.io/documentation/deployment/how-to-trigger-deployments-via-github-actions) with Ploi.

<figure>
<img src="/img/deployment-ploi-script-example.jpg" alt="Deployment script example">
</figure>

The "Deploy script" area is where you'd add commands to install Composer and NPM dependencies, compile CSS and JavaScript if you need to, and clear Statamic's cache. Most deploy scripts look like something like this:

``` shell
cd /home/ploi/{example}.{tld}
git pull origin main
composer install--no-interaction--prefer-dist--optimize-autoloader
echo ... sudo-S service php8.1-fpm reload
php please cache:clear
npm ci && npm run production
```

## Statamic specific features

Ploi let's you interact with your Statamic installtion without you having to connect to your server via SSH. This includes clearing the (static) cache, warming the stache, generating meta data for assets etc.

<figure>
<img src="/img/deployment-ploi-statamic-features.jpg" alt="Ploi's Statamic specific features">
<figcaption>Access the Statamic and Laravel CLI right from the web UI.</figcaption>
</figure>

## Advanced Control

Ploi is [optimized for Laravel](https://ploi.io/laravel-optimized) and offers advanced control of queue workers, cron jobs, SSL certificates, database access, etc.

<figure>
<img src="/img/deployment-ploi-advanced.jpg" alt="Advanced Ploi features">
<figcaption>Ploi has a lot of handy features.</figcaption>
</figure>
2 changes: 2 additions & 0 deletions content/trees/collections/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ tree:
children:
-
entry: 8fd95af9-f635-45bb-a3d1-1fa1db7be4a2
-
entry: cf38dba4-5cce-4b81-a2f5-e82665e4e11f
-
entry: 79d022e5-8fb0-4d20-955d-801e0edafa61
-
Expand Down
Binary file added public/img/deployment-ploi-advanced.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/deployment-ploi-create-server.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/deployment-ploi-create-site.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/deployment-ploi-hosting-setup.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/deployment-ploi-script-example.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/views/deploying.antlers.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h2 id="vps">
<h2 class="text-2xl mb-2 font-bold font-display">Laravel Forge</h2>
<p class="text-sm font-mono-alt">Server Management Platform</p>
</a>
<a href="https://stoffel.io/blog/creating-statamic-sites-with-ploi" target="_blank" class="bg-white border text-center shadow-stack-sm hover:shadow-stack-yellow-sm rounded-sm px-3 py-6 hover:bg-gradient-to-tl from-gray-lightest dark:bg-gray-darkest dark:text-white dark:shadow-none">
<a href="/deploying/ploi" class="bg-white border text-center shadow-stack-sm hover:shadow-stack-yellow-sm rounded-sm px-3 py-6 hover:bg-gradient-to-tl from-gray-lightest dark:bg-gray-darkest dark:text-white dark:shadow-none">
<img class="mx-auto mb-2 h-16" src="/img/ploi-cake.png" alt="Ploi Logo">
<h2 class="text-2xl mb-2 font-bold font-display">Ploi</h2>
<p class="text-sm font-mono-alt">Server Management Platform</p>
Expand Down

0 comments on commit c00c7c4

Please sign in to comment.