Deploying Statamic 3 to a live web server

Published on January 27th, 2020

Estimated Reading Time is 3 mins

The last post was getting Statamic running locally. So let's assume you've followed the docs, tweaked the site and you want to make it live.

You've got a couple of options here to get your site running on a live server. Of course, you should read the what the official Statamic docs say about hosting.

Simplest (IMHO) approach

But, for the sake of this post - let's assume that you know nothing about your hosting environment other than it hosts some files.

Open terminal.app on your Mac - what you see here will depend on your system so I'll need to make some assumptions about your setup.

Assuming you're following on from the last post about running Statamic 3 locally on a Mac, you'll want to navigate to the directory where Statamic is installed.

then, when you're in this directory, run this command:

This is a new feature for Statamic 3. A generator to spit out 100% static HTML files and assets. You can find these by running:

Then, you can party like it's 1999 (or 1989 if you wanna live like Jack) and FTP those files to your server.

FTP the whole app

If your server meets the requirements of Statamic, you can FTP the whole site directory to your server.

Ideal setup

This, for me at least, is the ideal setup for Statamic. It's how I manage my other Laravel apps. For this particular approach, you'll need composer to be available on the live web server. 

My live web server is managed by Laravel Forge, Laravel Forge handles the deployment of code to that web server any time there's a push to my master branch on Github.

In the past, I've also used DeployHQ for this as well - so you're not limited to Laravel Forge - and other deployment tools are available.

Post deploy script via Laravel Forge

One thing that isn't yet available to Statamic 3, is the first-party Spock addon. This addon allows your content modified on the live environment to be versioned with Git and pushed back to your repository. The Gentlemen are working on porting that addon over for Statamic 3.

Bonus material

Justin Jackson posted how to use Statamic to deploy to Netlify. Nice work, Justin πŸ‘πŸΌ