Certainly! Here’s a step-by-step approach to troubleshoot and resolve the “Tunnel exited with a non-zero code [1]” error during your Forge deployment:
1. Review Recent Changes
Even though you mention only minor changes, double-check if you’ve altered anything related to deployment scripts, environment variables, or SSH configurations.
2. Check Forge Deployment Logs
Go to your Forge dashboard → Select your site → Deployments tab. Click on “View Log” for the failed deployment. The log usually contains more details right before the tunnel error.
3. SSH Into The Server
Try logging in to the server manually using SSH:
ssh forge@your-server-ip
If you’re unable to connect, the issue might be with your SSH key, the server’s status, or network/firewall rules.
4. Inspect Server Disk Space & Status
Sometimes deployments fail because the server is out of disk space or resources. Once SSH'ed in, run:
df -h
free -m
Make sure there’s enough disk space and memory left.
5. Review Deployment Hooks
Check your deployment script/hooks in Forge for any commands that may exit with a non-zero code or require input (which isn’t available during an automated deploy process). Common issues can be missed environment variables, breaking shell commands, or failed Composer/NPM steps. For example, make sure none of your deployment commands fail:
cd /home/forge/your-site.com
git pull origin main
composer install --no-interaction --prefer-dist --optimize-autoloader
php artisan migrate --force
npm run production
If any of those fail, the deployment exits with a non-zero code.
6. Check For Scheduled Downtime Or Outages
Ensure there are no hosting outages or network issues:
- Forge Status
- Hosting Provider (DigitalOcean, Linode, etc.) Status page
7. Restart Forge Daemon (if applicable)
Sometimes restarting the Forge daemon or the server can help clear issues:
sudo service forge restart
sudo reboot
8. Re-deploy Manually
After taking the above steps, try deploying again from Forge or manually trigger a deployment to see if the error persists.
Summary
If after these steps, your Forge deployment still fails:
- Paste the full deployment log output here for more context.
- Double-check any recent changes to deployment scripts or environment variables.
- Ensure all dependencies (Node, Composer, etc.) are installed and working correctly.
Typical Deployment Script (for reference):
cd /home/forge/your-site.com
git pull origin main
composer install --no-interaction --prefer-dist --optimize-autoloader
php artisan migrate --force
npm install
npm run production
Remove or comment out commands one by one to narrow down the culprit.
Let me know the output of your deployment logs or if you see any specific errors after running these checks!