I have been meaning to rework my website for several years, but other projects have always gotten in the way. I was waffling between a Laravel custom site, Wordpress, flat file sites, others.. you get the idea. That was also not helping with the spinning of wheels and getting nowhere.
When Laravel News announced that they had updated their site to using Statamic 3, I looked into the platform in more depth. (They also have a really cool write-up from the team that helped migrate them from Wordpress to Statamic here)
Please come along on the ride with me as I try to boot this thing up and rebuild my website with Stamatic.
Another tool I had recently learned about is Lando, which is a very simple Docker-based site configuration tool that makes spinning up new web development projects super easy. Docker makes everything easier to develop and release since it is all self contained, and Lando takes a lot of the initial overhead of Docker container setup out of the equation. It even handles the creation and management of HTTPS certs, so you can develop securely on your localhost right out of the box. I highly urge you to check it out.
Step 1 is to install Lando which varies depending on your operating system. On Linux, you can follow their simple four step process which includes installing Docker Community Edition. The Windows installer includes Docker Desktop, as well.
After you have installed, verify your installation by attempting to use the
lando versioncommand -- which should print out the current version installed.
The beauty of Docker (and Lando) is that you don't have to have any of your dependencies installed on your local machine, you can use the containers to do everything for you. Lando makes this super simple. Without composer installed locally, we can install the Statamic installer and start up a new application folder with a few commands.
$ mkdir my-cool-project $ cd my-cool-project $ lando init \ > --source cwd \ > --recipe lamp \ > --webroot public \ > --name my-statamic-site
It will create the
.lando.yml file for you:
name: my-statamic-site recipe: lamp config: webroot: public
Lando comes with several recipes out of the box, and LAMP, LEMP, or even the Laravel recipe will work (if you install Statamic's Laravel package). For this tutorial, I chose the LAMP stack.
I did not configure much at this point, but before building your images and containers, now is a great time to check out the Lando documentation to see the additional services and configuration you can add to your project. Statamic doesn't require anything beyond the LAMP recipe's defaults.
Each recipe has it's own available options, so make sure to read through the available configuration for the one you choose.
From the base Lando configuration, we can use the composer image to install Statamic (from your newly created project directory):
$ lando ssh -c "composer global require statamic/cli && statamic new placeholder"
NOTE I was unable to figure out how to install statamic into the current directory, so we're installing it into
placeholder and then we'll move everything up to our root directory afterwards.
After it's installed everything, move the project files up a directory (frustrating, but if you actually do want to keep this directory, you can just use that instead of the placeholder name -- just make sure to update your webroot in the
$ cd placeholder $ mv * .* .. $ cd .. $ rm -rf placeholder
You now have Lando configured, which will take care of your technology stack, and you have installed Statamic which is the software we will be using to build the site!
Let's turn it on! From our working directory, type the following command:
$ lando start
This will build all the Docker containers and images and get everything up and running. At the end, Lando will provide URLs where you can access your new shiny website!
___ __ __ __ __ ______ / _ )___ ___ __ _ ___ / / ___ _/ /_____ _/ /__ _/ /_____ _/ / / / / _ / _ \/ _ \/ ' \(_-</ _ \/ _ `/ '_/ _ `/ / _ `/ '_/ _ `/_/_/_/ /____/\___/\___/_/_/_/___/_//_/\_,_/_/\_\\_,_/_/\_,_/_/\_\\_,_(_|_|_) Your app has started up correctly. Here are some vitals: NAME statamic LOCATION /home/<your_user>/workspace/statamic SERVICES appserver, database APPSERVER_NGINX URLS https://localhost:49155 http://localhost:49156 http://statamic.lndo.site/ https://statamic.lndo.site/
Now your new site is up and running with only a few commands!
The final step is to make your super user and get started on the control panel. Make sure you choose
yes when asked if you want your user to be a super user!
$ lando php please make:user Email: > email@example.com Name : > John Smith Password (Your input will be hidden): > Super user (yes/no) [no]: > y User created successfully.
In this post, I went over how to install Lando to get a really quick LAMP or LEMP stack up and running and also installed Statamic! As I work more on building my new website, I will update with Part 2 -- which will include basic content creation and a little bit of tinkering with the layout and theme.