How to Deploy a Statamic Project
require 'recipe/statamic.php';
Deployer is a free and open source deployment tool written in PHP. It helps you to deploy your Statamic application to a server. It is very easy to use and has a lot of features.
Three main features of Deployer are:
- Provisioning - provision your server for you.
- Zero downtime deployment - deploy your application without a downtime.
- Rollbacks - rollback your application to a previous version, if something goes wrong.
Additionally, Deployer has a lot of other features, like:
- Easy to use - Deployer is very easy to use. It has a simple and intuitive syntax.
- Fast - Deployer is very fast. It uses parallel connections to deploy your application.
- Secure - Deployer uses SSH to connect to your server.
- Supports all major PHP frameworks - Deployer supports all major PHP frameworks.
You can read more about Deployer in Getting Started.
The deploy task of Statamic consists of:
- deploy:prepare – Prepares a new release
- deploy:info – Displays info about deployment
- deploy:setup – Prepares host for deploy
- deploy:lock – Locks deploy
- deploy:release – Prepares release
- deploy:update_code – Updates code
- deploy:shared – Creates symlinks for shared files and dirs
- deploy:writable – Makes writable dirs
- deploy:vendors – Installs vendors
- artisan:storage:link – Creates the symbolic links configured for the application
- artisan:cache:clear – Flushes the application cache
- statamic:stache:clear – Clears the "Stache" cache
- statamic:stache:warm – Builds the "Stache" cache
- deploy:publish – Publishes the release
- deploy:symlink – Creates symlink to release
- deploy:unlock – Unlocks deploy
- deploy:cleanup – Cleanup old releases
- deploy:success –
The statamic recipe is based on the laravel recipe.
Configuration
statamic_version
$result = run('{{bin/php}} {{release_or_current_path}}/please --version');
preg_match_all('/(\d+\.?)+/', $result, $matches);
return $matches[0][0] ?? 'unknown';
Tasks
statamic:addons:discover
Rebuilds the cached addon package manifest.
statamic:assets:generate-presets
Generates asset preset manipulations.
statamic:assets:meta
Generates asset metadata files.
statamic:git:commit
Git add and commit tracked content.
statamic:glide:clear
Clears the Glide image cache.
statamic:responsive:generate
Generates responsive images.
statamic:responsive:regenerate
Regenerate responsive images.
statamic:search:insert
Inserts an item into its search indexes.
statamic:search:update
Update a search index.
statamic:stache:clear
Clears the "Stache" cache.
statamic:stache:doctor
Diagnose any problems with the Stache.
statamic:stache:refresh
Clears and rebuild the "Stache" cache.
statamic:stache:warm
Builds the "Stache" cache.
statamic:static:clear
Clears the static page cache.
statamic:static:warm
Warms the static cache by visiting all URLs.
statamic:support:details
Outputs details helpful for support requests.
statamic:updates:run
Runs update scripts from specific version.
deploy
Deploys your project.
This task is group task which contains next tasks: