Skip to content

FTP Strategy

The FTP strategy builds your application in the GitHub Actions runner and uploads it to the server via FTP.

How It Works

  1. Build — GitHub Actions installs Composer dependencies and builds Node assets (with dependency caching)
  2. Prepare — A new release directory is created on the server via SSH, copying the current release as a base
  3. UploadSamKirkland/FTP-Deploy-Action syncs files incrementally
  4. First deploy — If first deploy, generates APP_KEY and runs configured seeders
  5. Post-deploy — Symlinks set up, .env values updated, migrations run, caches rebuilt
  6. Switch — The current symlink is updated to point to the new release
  7. 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 uses DEPLOY_PATH/releases/....
  • Site-scoped root — FTP root is /home/user/mysite.com/. The workflow uses releases/... 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 directories
  • node_modules/ — Node dependencies
  • tests/ — Test files
  • .env, .env.* — Environment files
  • storage/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', ''),
],