Setting Up Statamic Sites with Ploi
I'm always trying to find ways to improve my workflow when creating and editing websites. It's what I do all day most days, so saving a few minutes on a single task really adds up.
Advantages over Forge are the fact that Ploi can also run automatic updates on your server and the fact that there is native support for Statamic sites. There are a bunch of other interesting features that Forge doesn't offer, but those two made me give it a try.
One process I wanted to optimize is setting up new Statamic site on a server, which in our current setup requires a lot of manual steps until it's up and running and connected to a GitLab repo.
Letting Ploi Install Statamic for You
Let's get to it. In this case I'm using a server that's already set up and running, so I can skip the entire server setup stage. Simply navigate to your server where Ploi gives you the option to add another site to it.
Instead of just creating a blank new site, open the advanced settings and set the project type to Statamic. This doesn't install our CMS yet, but it let's Ploi know what this site will be running as, so it can display some additional information about it later.
After entering your desired URL and submitting the form with the "Add site" button, your new website will appear in the list. You can already access the URL, but since we haven't actually set up Statamic yet, you will only see Ploi's default template.
Instead you can click on the site in your Ploi control panel to open the list of setup options. You'll have to click on "More 1-click installation options" first since Statamic sadly isn't one of the four top choices (yet).
After you click on the Statamic tile, you'll be presented with a couple of additional options.
First you can choose your installation type, meaning you can pick a standard install or any of the several starter kits currently available. For this project I decided to stick with a blank version of Statamic.
Next you have to decide between just installing Statamic or both installing it and creating a git repository at the same time. Since you will most likely need a git repo anyways, there really isn't any reason to skip it, so let's do that and save ourselves the time it would take to set up manually.
I already connected Ploi to my GitHub (and GitLab) account, so you might have to do that first. After picking the desired platform you just need to pick a name, description, and decide whether or not to make the repo private.
Click on "Install Statamic" and wait while Ploi does all the magic for you in the background - it only takes a few seconds.
That's it, Statamic is up and running. If you visit the URL you chose, you will see the standard home screen of a new Statamic installation. And if you switch to GitHub or GitLab, you will also see a newly created repository which already has all your files and is connected to your new Ploi site.
Modifying your Statamic Installation
One thing I found strange is the very minimal deploy script created for this site. When you deploy a Statamic site to Ploi using git, it recommend adding a couple of Statamic CLI commands to the script, so I would have expected those to be recommended or simply added here as well.
Instead you can just add these lines to the end of your deploy script manually:
Keep in mind that this is only a basic setup of Statamic. So you will still have to go and do the usual setup tasks such as adding the URL in your .env, creating your first user, and setting your Statamic license key.
You'll probably also want to set up a SSL certificate and maybe protect the site with a password, but that's all up to you.
One nice detail: since we told Ploi that the site will be Statamic, you have an additional option in your site's menu, giving you a few facts about your installation and letting you run a bunch of Statamic commands without logging into your server.
Setting up a site this way is easily done in less than a minute. For me that's a huge improvement over our current process, so I'm quite excited about it.
If you're also interested in giving it a try, feel free to sign up to Ploi using this link. Enjoy!