laravel-netsons-deploy maintained by albertoarena
Laravel Netsons Deploy
Deploy Laravel applications to Netsons shared hosting (cPanel, SSD plans) via GitHub Actions, supporting both FTP upload and SSH/git-clone strategies.
Features
- Two deployment strategies: FTP (incremental sync) and Git (server-side clone)
- Release-based deployments with timestamped directories
- Zero-downtime release switching via proxy
index.php - Shared
.envandstorage/across releases - Automatic cache clearing and rebuilding
- Database migrations on deploy
- First-deploy seeder support
.htaccessmanagement for root and public directories- Configurable release retention (prune old releases)
- Works with Netsons SSH (port 65100) and cPanel PHP (
ea-phpXX)
Quick Start
1. Install the package
composer require albertoarena/laravel-netsons-deploy --dev
2. Run the installer
php artisan netsons:install
This will:
- Guide you through strategy selection (FTP or Git)
- Publish the config file to
config/netsons-deploy.php - Generate
.github/workflows/deploy.ymlwith your settings - Show the required GitHub Secrets and Variables
3. Configure GitHub Secrets
Add the required secrets to your GitHub repository (Settings > Secrets and variables > Actions). See GitHub Secrets Reference.
4. Review the workflow
Review .github/workflows/deploy.yml and adjust any settings if needed.
5. Deploy
Trigger the workflow from GitHub Actions > Deploy to Netsons > Run workflow.
Strategy Comparison
| Feature | FTP | Git |
|---|---|---|
| How it works | Builds locally, uploads via FTP | Clones repo on server via SSH |
| Asset building | In GitHub Actions runner | In GitHub Actions, uploaded via SCP |
| Composer install | In GitHub Actions runner | On server using Netsons PHP CLI |
| Requires on server | FTP access | Git + SSH access (SSD 30+ plans) |
| Transfer method | Incremental FTP sync | git clone --depth 1 |
| Speed | Slower (full upload first time) | Faster (shallow clone) |
| Best for | Any Netsons plan | SSD 30+ plans with git |
Usage as a Reusable GitHub Action
You can also use this as a reusable action in your workflow:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# ... build steps (PHP, Node, assets) ...
- uses: albertoarena/laravel-netsons-deploy@v1
with:
strategy: 'git'
environment: 'production'
deploy-path: 'public_html'
ssh-host: ${{ vars.SSH_HOST }}
ssh-user: ${{ vars.SSH_USER }}
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
git-repo: ${{ vars.GIT_REPO }}
See action.yml for all available inputs.
Artisan Commands
netsons:install
Interactive setup wizard. Publishes config and deploy workflow, shows required secrets/variables.
php artisan netsons:install
php artisan netsons:install --strategy=git
netsons:check
Shows your local configuration, checks that the workflow file exists, and lists required GitHub Secrets/Variables.
php artisan netsons:check
Configuration
The config file config/netsons-deploy.php covers:
- Strategy —
ftporgit - SSH — host, port (default 65100), user
- PHP binary — remote path (default
/usr/local/bin/ea-php84) - Deploy path — remote directory (default
public_html) - FTP — host, port, user, password, protocol
- Git — repo URL, branch
- Releases — number to keep (default 5)
- Post-deploy — toggle migrations, cache rebuilding, queue restart
- Seeders — classes to run on first deploy
See Configuration Reference for details.
Documentation
- Configuration Reference
- FTP Strategy Guide
- Git Strategy Guide
- Netsons Setup Guide
- GitHub Secrets Reference
- Troubleshooting
Requirements
- PHP 8.2+
- Laravel 10, 11, 12, or 13
- GitHub Actions
- Netsons shared hosting (cPanel, SSD plans)
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/my-feature) - Write tests for your changes
- Ensure all tests pass (
composer test) - Commit your changes
- Push to the branch
- Open a pull request
License
MIT License. See LICENSE for details.