Spin up a working Statamic instance quickly & easily with Docker

Overview

Spin Up Statamic

Allows you to create your own self-contained Statamic project complete site config, Antlers/Blade/Twig template files, assets, and devops shrink-wrapped with Docker, which you can distribute to others or use yourself.

Use it for:

  • Spinning up a Statamic site in a browser in GitHub Codespaces
  • Shipping a self-contained Statamic site to others
  • Providing working example code & projects to others
  • Spinning up a local Statamic project using someone else's composer.json for support

N.B.: This is not intended to be a fully functional local development environment for client sites (there is no buildchain, for example).

Making a new Statamic project

This is a template repository. Click on Use this template on GitHub and select Create a new repository.

You will then be able to name the new repository, and a clone of this repo will be created there.

The project you'll get is the default Statamic starter you might create with statamic new, with the Spin Up Statamic scaffolding around it.

If you intend to use this as a Template Repository (like Spin Up Statamic is), you'll want to go to the repo Settings and check the Template repository checkbox.

You can also consider adding an Open in Codespaces button.

Using your Statamic project in a browser via GitHub Codespaces

  1. Go to your repo in GitHub
  2. Click on Use this template and select Open in a codespace if your repository is a Template Repository. If it is a regular repository, click on Code, then click on the Codespaces tab, and click on the Creat codespace on ... button
  3. In the resulting Terminal window, type make dev to start the project up
  4. Wait until you see output like this, and then access the site via the credentials that are output on the console:
queue_1    | ### Your Statamic site is ready!
queue_1    | Frontend URL: https://khalwat-opulent-xylophone-q59g6p5vqj3rvr-8050.preview.app.github.dev/
queue_1    | CP URL: https://khalwat-opulent-xylophone-q59g6p5vqj3rvr-8050.preview.app.github.dev/cp
queue_1    | CP User: [email protected]
queue_1    | CP Password: password

This lets anyone use the project without having to do any local setup.

You can use the Codespaces editor to edit template files, load the site frontend, or log into the Statamic CP, all from within a browser!

The first time you start up your project in Codespaces, it'll take some time to set everything up. However, subsequent startups will be very quick.

You can access your existing Codespaces here:

https://github.com/codespaces

Click on one to resume it. If you don't see a Terminal window, go to the hamburger menu in the top-left, and click on Terminal > New Terminal

You are limited to 5 active Codespaces on the free plan, but you can go in and delete any older Codespaces you're not using at any time.

Using your Statamic CMS project in local dev

  1. Have Docker Desktop installed
  2. Clone your newly created repo down to your computer
  3. cd to your repo in your terminal
  4. Get the project up and running with make dev
  5. Wait until you see output like this, and then access the site via the credentials that are output on the console:
spin-up-statamic-queue-1  | ### Your Statamic site is ready!
spin-up-statamic-queue-1  | Frontend URL: http://localhost:8050/
spin-up-statamic-queue-1  | CP URL: http://localhost:8050/cp
spin-up-statamic-queue-1  | CP User: [email protected]
spin-up-statamic-queue-1  | CP Password: password

Hit Control-C to terminate the project and spin down the containers

The first time you start up your project, it'll take some time to set everything up. However, subsequent startups will be very quick.

Available make commands

This project uses make to execute various commands in the appropriate containers. Here's a list of available commands:

  • make dev - Start the dev server
  • make artisan xxx - Execute a php artisan CLI command in the PHP container
  • make composer xxx - Execute a composer command in the PHP container
  • make npm xxx - Execute an npm command in the PHP container
  • make please xxx - Execute a please command in the PHP container
  • make statamic xxx - Execute a statamic CLI command in the PHP container
  • make ssh - Open up a shell in the PHP container

If the project is already running via make dev you can use a second terminal tab/window to execute additional commands.

Adding to an existing Statamic project

You can use the Start Up Statatmic starter kit to add the Spin Up Scaffolding to your existing Statamic project.

Creating your Statamic project

Develop the site as you normally would by editing templates, adding content, adding assets, etc.

Commit your changes to the repository.

People wanting to use the project will simply need to git clone the repo down, and get up and running with make dev

Using Spin Up Statamic for support

If you're using Spin Up Statamic to try to replicate an issue someone else is having:

  1. Clone a clean version of your repo down
  2. Copy their composer.json and their composer.lock files to overwrite the project's respective files
  3. Copy over any database files they have provided

Then start the project up with:

make dev

Usually the composer.json, composer.lock, and database files are all you need to replicate issues. But if additional config/template files are needed, obtain them as well.

Random notes

  • The .env file is created by copying example.env file when you start the project up
  • The server will use the INITIAL_SERVER_PORT in the .env file for the initial port to start looking for unused ports from. It will increment it until it finds and unused port, and then use it
  • If instead you want to used a fixed port, you can explicitly set the DEV_SERVER_PORT in the .env file
  • The Docker containers will be named after the project directory, so give it a unique name for each project

To Do

  • Await orders from Jack

Brought to you by nystudio107

You might also like...
A small library to help run PHP servers easily and quickly.

PHP Server A small library to help run PHP servers easily and quickly. Installation composer require ahmard/php-server Usage PHP Built-In Server An i

Guest to Customer for Magento2 - Quickly and easily convert existing guest checkout customers to registered customers.
Guest to Customer for Magento2 - Quickly and easily convert existing guest checkout customers to registered customers.

Guest to Customer for Magento 2.0 For Magento 2.0.x, 2.1.x, 2.2.x, 2.3.x and 2.4.x In general E-commerce, shoppers do not like to create an account du

Quickly and easily preview and test your Magento 2 order confirmation page, without hacks or spending time placing new order each time
Quickly and easily preview and test your Magento 2 order confirmation page, without hacks or spending time placing new order each time

Preview Order Confirmation Page for Magento 2 For Magento 2.0.x, 2.1.x, 2.2.x and 2.3.x Styling and testing Magento's order confirmation page can be a

Easily install PHP extension in Docker containers

Easy installation of PHP extensions in official PHP Docker images This repository contains a script that can be used to easily install a PHP extension

A set of utilities for working with vk api!

vk-utils Документация на русском языке Installation composer require labile/vk-utils How to use it? Simple example use Astaroth\VkUtils\Client; $api

A plugin for working with popular money libraries in Pest

This package is a plugin for Pest PHP. It allows you to write tests against monetary values provided by either brick/money or moneyphp/money using the same declarative syntax you're used to with Pest's expectation syntax.

A PHPStan package that supports working with Extbase

PHPStan for Extbase This package provides a couple of stubs and services to make your life easier when working with PHPStan and Extbase. Examples clas

A simple package for working with money.

Money A simple package for working with money. Main features: Simple API Livewire integration Custom currency support Highly customizable formatting R

Iran decoration platform is an open source Php web application where you can find your job as a freelancer working in people home in decoration positions and others.

Iran-Decoration Platform Iran decoration platform is an open source Php web application where you can find your job as a freelancer working in people

Releases(1.0.1)
  • 1.0.1(May 25, 2023)

    Added

    • Added make please to the Makefile
    • Added starter-kit.yaml for creating a starter kit based on this project
    • Added MIT LiCENSE.md

    Changed

    • Simplify the preamble in config/app.php since we don't actually need to change the HTTP_HOST
    • Remove vestigial statamic/README.md
    • Add documentation about how to use Spin Up Craft Starter
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(May 24, 2023)

Owner
nystudio107
Consulting, Branding, Design, Development
nystudio107
This Statamic addon allows you to modify the tags rendered by the Bard fieldtype, giving you full control over the final HTML.

Bard Mutator This Statamic addon allows you to modify the tags rendered by the Bard fieldtype, giving you full control over the final HTML. You can ad

Jack Sleight 10 Sep 26, 2022
A widget that displays a Bible verse every day in the Statamic dashboard

Statamic Widget: Verse of the Day What is it A widget that displays a Bible verse every day in the Statamic dashboard. How to install it Install via c

Michael 2 Jan 27, 2022
Nextcloud AIO stands for Nextcloud All In One and provides easy deployment and maintenance with most features included in this one Nextcloud instance.

Nextcloud All In One Beta This is beta software and not production ready. But feel free to use it at your own risk! We expect there to be rough edges

Nextcloud 1.1k Jan 4, 2023
Silverstripe module allowing editors to create newsletters using elemental blocks and export them to a sendy instance

Silverstripe Sendy Silverstripe module allowing editors to create newsletters using elemental blocks and export them to a sendy instance. Introduction

Syntro Opensource 4 Apr 20, 2022
The fixture plugin is really helpful if you want to create some static demo data for your shopware instance.

Fixture Plugin The fixture plugin is really helpful if you want to create some static demo data for your shopware instance. Installation Just add it t

basecom 7 Nov 7, 2022
A webshell plugin and interactive shell for pentesting a Moodle instance.

Moodle webshell plugin for RCE A webshell plugin and interactive shell for pentesting a Moodle instance. Features Webshell plugin for Moodle. Execute

Podalirius 11 Oct 10, 2022
A complete stack for running Symfony 5 into Docker containers using docker-compose tool and with Certbot for the HTTPS certificate.

?? Docker + PHP 7.4 + MySQL8.0 + Nginx + Certbot(HTTPS) + Symfony 5 Boilerplate ?? Edited from https://github.com/ger86/symfony-docker version -> http

null 6 Nov 9, 2022
Docker-magento2 - 🐳 Docker containers with all required Magento 2 dependencies installed available as FPM through Nginx and CLI

Magento 2 Docker A collection of Docker images for running Magento 2 through nginx and on the command line. Quick Start cp composer.env.sample compose

Meanbee 454 Dec 27, 2022
Docker-magento - Docker image for Magento 1.6 to 1.9

Docker image for Magento 1.x This repo creates a Docker image for Magento 1.x. Please note The primary goal of this repo is to create Docker images fo

Fu Cheng 144 Nov 18, 2022
🐋 This project aims to broaden knowledge of system administration by using Docker: virtualizing several Docker images, creating them in a new personal virtual machine.

?? This project aims to broaden knowledge of system administration by using Docker: virtualizing several Docker images, creating them in a new personal virtual machine.

Anton Kliek 1 Jan 26, 2022