FTP Strategy
The FTP strategy builds your application in the GitHub Actions runner and uploads it to the server via FTP.
How It Works
- Build — GitHub Actions installs Composer dependencies and builds Node assets (with dependency caching)
- Prepare — A new release directory is created on the server via SSH, copying the current release as a base
- Upload — SamKirkland/FTP-Deploy-Action syncs files incrementally
- First deploy — If first deploy, generates
APP_KEYand runs configured seeders - Post-deploy — Symlinks set up,
.envvalues updated, migrations run, caches rebuilt - Switch — The
currentsymlink is updated to point to the new release - Cleanup — Old releases removed, SSH agent cleaned up
When to Use
- Works on all Netsons plans (no git required on server)
- Good for projects where you want full control over what gets uploaded
- First deploy is slower (full upload), subsequent deploys are incremental
Required Secrets & Variables
See GitHub Secrets for the complete list. FTP strategy additionally requires FTP_HOST, FTP_USER, FTP_PASS, and FTP_PORT secrets.
FTP Root Path
The FTP account root directory affects how files are uploaded:
- Home directory root (default) — FTP root is
/home/user/. The workflow usesDEPLOY_PATH/releases/.... - Site-scoped root — FTP root is
/home/user/mysite.com/. The workflow usesreleases/...directly.
Set this in config/netsons-deploy.php:
'ftp' => [ // ... 'root_path' => env('NETSONS_FTP_ROOT_PATH', '/home/user/mysite.com'),],Check your FTP root in cPanel > Files > FTP Accounts > Configure FTP Client.
Server Directory Structure
After deployment, your server will look like:
~/public_html/├── .htaccess # Root rewrite to public/├── index.php # Proxy to active release├── current -> releases/20240101120000/├── shared/│ ├── .env│ └── storage/└── releases/ ├── 20240101120000/ # Current release ├── 20231215100000/ # Previous release └── ...FTP Exclusions
The following paths are excluded from the FTP upload:
.git*— Git files and directoriesnode_modules/— Node dependenciestests/— Test files.env,.env.*— Environment filesstorage/logs/— Log files
Configuration
Set the strategy in config/netsons-deploy.php:
'strategy' => env('NETSONS_DEPLOY_STRATEGY', 'ftp'),
'ftp' => [ 'host' => env('NETSONS_FTP_HOST'), 'port' => env('NETSONS_FTP_PORT', 21), 'user' => env('NETSONS_FTP_USER'), 'password' => env('NETSONS_FTP_PASS'), 'protocol' => env('NETSONS_FTP_PROTOCOL', 'ftp'), 'root_path' => env('NETSONS_FTP_ROOT_PATH', ''),],