Skip to content
On this page

INFO

This chapter is work in progress (WIP) 🚧, browsersync / asset compilation needs to be implemented for example. Also support for vite would be awesome. Happy to hear your feedback / ideas!

Statamic

I published a series (work in progress) on dev.to as well: My Statamic deployment journey.

Example repositories

Quickstart

bash
mkdir my-new-statamic
cd my-new-statamic/

# Create configuration for DDEV project
ddev config --project-type=laravel --docroot=public --create-docroot

# Install latest statamic via DDEV + composer
# (https://ddev.readthedocs.io/en/stable/users/developer-tools/#ddev-and-composer)
ddev composer create statamic/statamic

# Generate config, set APP_URL & generate key
ddev exec "cp .env.example .env"
ddev exec 'sed -i "/APP_URL=/c APP_URL=$DDEV_PRIMARY_URL" .env'
ddev artisan key:generate

# Add support for CLI please command via simple DDEV-addon:
# (https://github.com/mandrasch/ddev-addon-statamic-please)
ddev get mandrasch/ddev-addon-statamic-please

# Compile JS/SCSS
ddev exec npm install
ddev exec npm run dev

ddev launch

Afterwards you can create your admin user:

bash
ddev please make:user
ddev launch /cp

Install a starter kit (Peak)

https://peak.1902.studio/

bash
mkdir my-new-statamic
cd my-new-statamic/
ddev config --project-type=laravel --docroot=public --create-docroot
ddev composer create statamic/statamic
# Add support for CLI please command:
ddev get mandrasch/ddev-addon-statamic-please
# Install starter kit
ddev please starter-kit:install studio1902/statamic-peak
# Generate config, set APP_URL & generate key
ddev exec "cp .env.example .env"
ddev artisan key:generate
ddev exec 'sed -i "/APP_URL=/c APP_URL=$DDEV_PRIMARY_URL" .env'
ddev launch

Afterwards you can create your admin user:

bash
ddev please make:user
ddev launch /cp

General source: https://peak.1902.studio/getting-started/installation.html#installation-via-the-cli

TODO:

Troubleshooting

If the starter kit install fails with Composer could not authenticate with GitHub!, generate a token with no permissions on GitHub and store it to DDEV:

bash
ddev composer config --global --auth github-oauth.github.com [your-token-here]

Pull content / media files from production

INFO

This chapter is work in progress (WIP) 🚧

DDEV offers an incredible feature called Hosting Provider Integration. This enables writing little scripts which can pull files from remote servers to your local development project.

Disclaimer: Statamic offers Git automation. This approach is not used here, since I want to separate config (git) from site content (on live server).

First add these lines to your .gitignore file. We will pull the site specific content from the production / live site and don't store it in git.

bash
# Don't store site specific content, we'll pull it from live site
# (Comment these lines if you wan't to use Git automation)
/content
/users
/public/assets
/storage/forms/

TODO: Add example for pull of these directories to local DDEV / use extension/.zip to implement this as well?

TODOs

Bonus info