mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-23 00:32:25 +01:00
516 lines
12 KiB
Markdown
516 lines
12 KiB
Markdown
<!-- DO NOT EDIT THIS FILE! -->
|
||
<!-- Instead edit recipe/laravel.php -->
|
||
<!-- Then run bin/docgen -->
|
||
|
||
# How to Deploy a Laravel Project
|
||
|
||
```php
|
||
require 'recipe/laravel.php';
|
||
```
|
||
|
||
[Source](/recipe/laravel.php)
|
||
|
||
Deployer is a free and open source deployment tool written in PHP.
|
||
It helps you to deploy your Laravel 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](/docs/getting-started.md).
|
||
|
||
The [deploy](#deploy) task of **Laravel** consists of:
|
||
* [deploy:prepare](/docs/recipe/common.md#deployprepare) – Prepares a new release
|
||
* [deploy:info](/docs/recipe/deploy/info.md#deployinfo) – Displays info about deployment
|
||
* [deploy:setup](/docs/recipe/deploy/setup.md#deploysetup) – Prepares host for deploy
|
||
* [deploy:lock](/docs/recipe/deploy/lock.md#deploylock) – Locks deploy
|
||
* [deploy:release](/docs/recipe/deploy/release.md#deployrelease) – Prepares release
|
||
* [deploy:update_code](/docs/recipe/deploy/update_code.md#deployupdate_code) – Updates code
|
||
* [deploy:shared](/docs/recipe/deploy/shared.md#deployshared) – Creates symlinks for shared files and dirs
|
||
* [deploy:writable](/docs/recipe/deploy/writable.md#deploywritable) – Makes writable dirs
|
||
* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors) – Installs vendors
|
||
* [artisan:storage:link](/docs/recipe/laravel.md#artisanstoragelink) – Creates the symbolic links configured for the application
|
||
* [artisan:config:cache](/docs/recipe/laravel.md#artisanconfigcache) – Creates a cache file for faster configuration loading
|
||
* [artisan:route:cache](/docs/recipe/laravel.md#artisanroutecache) – Creates a route cache file for faster route registration
|
||
* [artisan:view:cache](/docs/recipe/laravel.md#artisanviewcache) – Compiles all of the application\'s Blade templates
|
||
* [artisan:event:cache](/docs/recipe/laravel.md#artisaneventcache) – Discovers and cache the application\'s events and listeners
|
||
* [artisan:migrate](/docs/recipe/laravel.md#artisanmigrate) – Runs the database migrations
|
||
* [deploy:publish](/docs/recipe/common.md#deploypublish) – Publishes the release
|
||
* [deploy:symlink](/docs/recipe/deploy/symlink.md#deploysymlink) – Creates symlink to release
|
||
* [deploy:unlock](/docs/recipe/deploy/lock.md#deployunlock) – Unlocks deploy
|
||
* [deploy:cleanup](/docs/recipe/deploy/cleanup.md#deploycleanup) – Cleanup old releases
|
||
* [deploy:success](/docs/recipe/common.md#deploysuccess) –
|
||
|
||
|
||
The laravel recipe is based on the [common](/docs/recipe/common.md) recipe.
|
||
|
||
## Configuration
|
||
### shared_dirs
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L8)
|
||
|
||
Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`.
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
['storage']
|
||
```
|
||
|
||
|
||
### shared_files
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L9)
|
||
|
||
Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`.
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
['.env']
|
||
```
|
||
|
||
|
||
### writable_dirs
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L10)
|
||
|
||
Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`.
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
[
|
||
'bootstrap/cache',
|
||
'storage',
|
||
'storage/app',
|
||
'storage/app/public',
|
||
'storage/framework',
|
||
'storage/framework/cache',
|
||
'storage/framework/cache/data',
|
||
'storage/framework/sessions',
|
||
'storage/framework/views',
|
||
'storage/logs',
|
||
]
|
||
```
|
||
|
||
|
||
### log_files
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L22)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
'storage/logs/*.log'
|
||
```
|
||
|
||
|
||
### laravel_version
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L23)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
$result = run('{{bin/php}} {{release_or_current_path}}/artisan --version');
|
||
preg_match_all('/(\d+\.?)+/', $result, $matches);
|
||
return $matches[0][0] ?? 5.5;
|
||
```
|
||
|
||
|
||
|
||
## Tasks
|
||
|
||
### artisan:down
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L90)
|
||
|
||
Puts the application into maintenance / demo mode.
|
||
|
||
|
||
|
||
|
||
### artisan:up
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L93)
|
||
|
||
Brings the application out of maintenance mode.
|
||
|
||
|
||
|
||
|
||
### artisan:​key:generate
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L100)
|
||
|
||
Sets the application key.
|
||
|
||
|
||
|
||
|
||
### artisan:passport:keys
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L103)
|
||
|
||
Creates the encryption keys for API authentication.
|
||
|
||
|
||
|
||
|
||
### artisan:db:seed
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L110)
|
||
|
||
Seeds the database with records.
|
||
|
||
|
||
|
||
|
||
### artisan:migrate
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L113)
|
||
|
||
Runs the database migrations.
|
||
|
||
|
||
|
||
|
||
### artisan:migrate:fresh
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L116)
|
||
|
||
Drops all tables and re-run all migrations.
|
||
|
||
|
||
|
||
|
||
### artisan:migrate:rollback
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L119)
|
||
|
||
Rollbacks the last database migration.
|
||
|
||
|
||
|
||
|
||
### artisan:migrate:status
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L122)
|
||
|
||
Shows the status of each migration.
|
||
|
||
|
||
|
||
|
||
### artisan:cache:clear
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L129)
|
||
|
||
Flushes the application cache.
|
||
|
||
|
||
|
||
|
||
### artisan:config:cache
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L132)
|
||
|
||
Creates a cache file for faster configuration loading.
|
||
|
||
|
||
|
||
|
||
### artisan:config:clear
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L135)
|
||
|
||
Removes the configuration cache file.
|
||
|
||
|
||
|
||
|
||
### artisan:event:cache
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L138)
|
||
|
||
Discovers and cache the application\'s events and listeners.
|
||
|
||
|
||
|
||
|
||
### artisan:event:clear
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L141)
|
||
|
||
Clears all cached events and listeners.
|
||
|
||
|
||
|
||
|
||
### artisan:event:list
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L144)
|
||
|
||
Lists the application\'s events and listeners.
|
||
|
||
|
||
|
||
|
||
### artisan:optimize
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L147)
|
||
|
||
Cache the framework bootstrap files.
|
||
|
||
|
||
|
||
|
||
### artisan:optimize:clear
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L150)
|
||
|
||
Removes the cached bootstrap files.
|
||
|
||
|
||
|
||
|
||
### artisan:route:cache
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L153)
|
||
|
||
Creates a route cache file for faster route registration.
|
||
|
||
|
||
|
||
|
||
### artisan:route:clear
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L156)
|
||
|
||
Removes the route cache file.
|
||
|
||
|
||
|
||
|
||
### artisan:route:list
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L159)
|
||
|
||
Lists all registered routes.
|
||
|
||
|
||
|
||
|
||
### artisan:storage:link
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L162)
|
||
|
||
Creates the symbolic links configured for the application.
|
||
|
||
|
||
|
||
|
||
### artisan:view:cache
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L165)
|
||
|
||
Compiles all of the application\'s Blade templates.
|
||
|
||
|
||
|
||
|
||
### artisan:view:clear
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L168)
|
||
|
||
Clears all compiled view files.
|
||
|
||
|
||
|
||
|
||
### artisan:queue:failed
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L175)
|
||
|
||
Lists all of the failed queue jobs.
|
||
|
||
|
||
|
||
|
||
### artisan:queue:flush
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L178)
|
||
|
||
Flushes all of the failed queue jobs.
|
||
|
||
|
||
|
||
|
||
### artisan:queue:restart
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L181)
|
||
|
||
Restarts queue worker daemons after their current job.
|
||
|
||
|
||
|
||
|
||
### artisan:horizon
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L184)
|
||
|
||
Starts a master supervisor in the foreground.
|
||
|
||
|
||
|
||
|
||
### artisan:horizon:clear
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L187)
|
||
|
||
Deletes all of the jobs from the specified queue.
|
||
|
||
|
||
|
||
|
||
### artisan:horizon:continue
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L190)
|
||
|
||
Instructs the master supervisor to continue processing jobs.
|
||
|
||
|
||
|
||
|
||
### artisan:horizon:list
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L193)
|
||
|
||
Lists all of the deployed machines.
|
||
|
||
|
||
|
||
|
||
### artisan:horizon:pause
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L196)
|
||
|
||
Pauses the master supervisor.
|
||
|
||
|
||
|
||
|
||
### artisan:horizon:purge
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L199)
|
||
|
||
Terminates any rogue Horizon processes.
|
||
|
||
|
||
|
||
|
||
### artisan:horizon:status
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L202)
|
||
|
||
Gets the current status of Horizon.
|
||
|
||
|
||
|
||
|
||
### artisan:horizon:terminate
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L205)
|
||
|
||
Terminates the master supervisor so it can be restarted.
|
||
|
||
|
||
|
||
|
||
### artisan:horizon:publish
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L208)
|
||
|
||
Publish all of the Horizon resources.
|
||
|
||
|
||
|
||
|
||
### artisan:​telescope:clear
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L215)
|
||
|
||
Clears all entries from Telescope.
|
||
|
||
|
||
|
||
|
||
### artisan:​telescope:prune
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L218)
|
||
|
||
Prunes stale entries from the Telescope database.
|
||
|
||
|
||
|
||
|
||
### artisan:octane
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L225)
|
||
|
||
Starts the octane server.
|
||
|
||
|
||
|
||
|
||
### artisan:octane:reload
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L228)
|
||
|
||
Reloads the octane server.
|
||
|
||
|
||
|
||
|
||
### artisan:octane:stop
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L231)
|
||
|
||
Stops the octane server.
|
||
|
||
|
||
|
||
|
||
### artisan:octane:status
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L234)
|
||
|
||
Check the status of the octane server.
|
||
|
||
|
||
|
||
|
||
### artisan:nova:publish
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L241)
|
||
|
||
Publish all of the Laravel Nova resources.
|
||
|
||
|
||
|
||
|
||
### artisan:pulse:check
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L248)
|
||
|
||
Starts the Pulse server.
|
||
|
||
|
||
|
||
|
||
### artisan:pulse:restart
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L251)
|
||
|
||
Restarts the Pulse server.
|
||
|
||
|
||
|
||
|
||
### artisan:pulse:purge
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L254)
|
||
|
||
Purges all Pulse data from storage.
|
||
|
||
|
||
|
||
|
||
### artisan:pulse:work
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L257)
|
||
|
||
Process incoming Pulse data from the ingest stream.
|
||
|
||
|
||
|
||
|
||
### deploy
|
||
[Source](https://github.com/deployphp/deployer/blob/master/recipe/laravel.php#L263)
|
||
|
||
Deploys your project.
|
||
|
||
Main deploy task.
|
||
|
||
|
||
This task is group task which contains next tasks:
|
||
* [deploy:prepare](/docs/recipe/common.md#deployprepare)
|
||
* [deploy:vendors](/docs/recipe/deploy/vendors.md#deployvendors)
|
||
* [artisan:storage:link](/docs/recipe/laravel.md#artisanstoragelink)
|
||
* [artisan:config:cache](/docs/recipe/laravel.md#artisanconfigcache)
|
||
* [artisan:route:cache](/docs/recipe/laravel.md#artisanroutecache)
|
||
* [artisan:view:cache](/docs/recipe/laravel.md#artisanviewcache)
|
||
* [artisan:event:cache](/docs/recipe/laravel.md#artisaneventcache)
|
||
* [artisan:migrate](/docs/recipe/laravel.md#artisanmigrate)
|
||
* [deploy:publish](/docs/recipe/common.md#deploypublish)
|
||
|
||
|