init
This commit is contained in:
21 files changed
+1394
No files matched your search
@@ -0,0 +1,110 @@
|
||||
# Laravel FTP Deploy
|
||||
|
||||
Deploy changed Laravel project files over FTP using a SamKirkland-compatible sync-state manifest.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
composer require meghdadfadaee/laravel-ftp-deploy
|
||||
```
|
||||
|
||||
The package registers itself through Laravel package discovery.
|
||||
|
||||
## Configuration
|
||||
|
||||
Add an FTP deploy disk to `config/filesystems.php`:
|
||||
|
||||
```php
|
||||
'ftp_deploy' => [
|
||||
'driver' => 'ftp',
|
||||
'host' => env('FTP_DEPLOY_HOST'),
|
||||
'username' => env('FTP_DEPLOY_USERNAME'),
|
||||
'password' => env('FTP_DEPLOY_PASSWORD'),
|
||||
'port' => (int) env('FTP_DEPLOY_PORT', 21),
|
||||
'root' => env('FTP_DEPLOY_ROOT'),
|
||||
'passive' => env('FTP_DEPLOY_PASSIVE', true),
|
||||
'ssl' => env('FTP_DEPLOY_SSL', false),
|
||||
'timeout' => (int) env('FTP_DEPLOY_TIMEOUT', 30),
|
||||
'throw' => true,
|
||||
'report' => false,
|
||||
],
|
||||
```
|
||||
|
||||
Customize deploy behavior in `config/services.php`:
|
||||
|
||||
```php
|
||||
'ftp_deploy' => [
|
||||
'disk' => env('FTP_DEPLOY_DISK', 'ftp_deploy'),
|
||||
'local_root' => env('FTP_DEPLOY_LOCAL_ROOT', base_path()),
|
||||
'state_path' => env('FTP_DEPLOY_STATE_PATH', 'storage/app/.ftp-deploy-sync-state.json'),
|
||||
'api_token' => env('FTP_DEPLOY_API_TOKEN'),
|
||||
'route' => [
|
||||
'enabled' => env('FTP_DEPLOY_ROUTE_ENABLED', true),
|
||||
'path' => env('FTP_DEPLOY_ROUTE_PATH', 'ftp/generate-sync-state'),
|
||||
'name' => env('FTP_DEPLOY_ROUTE_NAME', 'ftp-deploy.generate-sync-state'),
|
||||
'middleware' => ['api'],
|
||||
],
|
||||
'exclude' => array_filter(array_map('trim', explode(',', env(
|
||||
'FTP_DEPLOY_EXCLUDE',
|
||||
'.git,.idea,.vscode,.env,node_modules,storage/logs,storage/framework/cache,storage/framework/sessions,storage/framework/views,storage/app/.ftp-deploy-sync-state.json,.ftp-deploy-sync-state.json',
|
||||
)))),
|
||||
],
|
||||
```
|
||||
|
||||
Useful environment keys:
|
||||
|
||||
```dotenv
|
||||
FTP_DEPLOY_HOST=
|
||||
FTP_DEPLOY_USERNAME=
|
||||
FTP_DEPLOY_PASSWORD=
|
||||
FTP_DEPLOY_PORT=21
|
||||
FTP_DEPLOY_ROOT=
|
||||
FTP_DEPLOY_PASSIVE=true
|
||||
FTP_DEPLOY_SSL=false
|
||||
FTP_DEPLOY_TIMEOUT=30
|
||||
FTP_DEPLOY_DISK=ftp_deploy
|
||||
FTP_DEPLOY_STATE_PATH=storage/app/.ftp-deploy-sync-state.json
|
||||
FTP_DEPLOY_API_TOKEN=
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
Preview changed files:
|
||||
|
||||
```bash
|
||||
php artisan ftp:deploy --dry-run
|
||||
```
|
||||
|
||||
Upload changed files and update the remote sync-state:
|
||||
|
||||
```bash
|
||||
php artisan ftp:deploy --yes
|
||||
```
|
||||
|
||||
Generate a sync-state file locally:
|
||||
|
||||
```bash
|
||||
php artisan ftp:generate-sync-state --output=storage/app/.ftp-deploy-sync-state.json
|
||||
```
|
||||
|
||||
Extra excludes may be passed as repeated options or comma-separated values:
|
||||
|
||||
```bash
|
||||
php artisan ftp:deploy --exclude=vendor --exclude="*.map" --yes
|
||||
```
|
||||
|
||||
## JSON API
|
||||
|
||||
The package registers `GET /ftp/generate-sync-state` by default. It requires either:
|
||||
|
||||
```http
|
||||
Authorization: Bearer your-token
|
||||
```
|
||||
|
||||
or:
|
||||
|
||||
```http
|
||||
X-Ftp-Deploy-Token: your-token
|
||||
```
|
||||
|
||||
The route generates the current sync-state, persists it to `services.ftp_deploy.state_path`, and returns JSON with summary metadata and the full state payload.
|
||||
Reference in new issue
Block a user