How to Deploy a Spiral Project
require 'recipe/spiral.php';
Deployer is a free and open source deployment tool written in PHP. It helps you to deploy your Spiral 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 Spiral 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:env – Configure .env file
- deploy:shared – Creates symlinks for shared files and dirs
- deploy:writable – Makes writable dirs
- deploy:vendors – Installs vendors
- spiral:encrypt-key – Generate new encryption key, if it doesn't exist
- spiral:configure – Configure project
- deploy:download-rr – Download RoadRunner
- deploy:publish – Publishes the release
- deploy:symlink – Creates symlink to release
- deploy:unlock – Unlocks deploy
- deploy:cleanup – Cleanup old releases
- deploy:success – Deploys your project
- deploy:restart-rr – Restart RoadRunner
The spiral recipe is based on the common recipe.
Configuration
shared_dirs
Overrides shared_dirs from recipe/deploy/shared.php
.
Spiral shared dirs
['runtime']
writable_dirs
Overrides writable_dirs from recipe/deploy/writable.php
.
Spiral writable dirs
['runtime', 'public']
roadrunner_path
Path to the RoadRunner server
'{{release_or_current_path}}'
dotenv_example
Overrides dotenv_example from recipe/deploy/env.php
.
'.env.sample'
Tasks
spiral:configure
Configure project.
Spiral Framework console commands
spiral:cycle
Update (init) cycle schema from database and annotated classes.
spiral:migrate
Perform all outstanding migrations.
spiral:update
Update project state.
spiral:cache:clean
Clean application runtime cache.
spiral:i18n:reset
Reset translation cache.
spiral:encrypt-key
Generate new encryption key, if it doesn't exist.
spiral:views:compile
Warm-up view cache.
spiral:views:reset
Clear view cache.
cycle:migrate
Generate ORM schema migrations.
Cycle ORM and migrations console commands
cycle:render
Render available CycleORM schemas.
cycle:sync
Sync Cycle ORM schema with database without intermediate migration (risk operation).
migrate:init
Init migrations component (create migrations table).
migrate:replay
Replay (down, up) one or multiple migrations.
migrate:rollback
Rollback one (default) or multiple migrations.
migrate:status
Get list of all available migrations and their statuses.
roadrunner:serve
Start RoadRunner server.
RoadRunner console commands
roadrunner:stop
Stop RoadRunner server.
roadrunner:reset
Reset workers of all services.
deploy:download-rr
Download RoadRunner.
Download and restart RoadRunner
deploy:restart-rr
Restart RoadRunner.
deploy
Deploys your project.
Main task
This task is group task which contains next tasks: