Deploy Laravel on Peon with a complete production-ready workflow. Connect your Git repository for automatic CI/CD deployments, run queue workers reliably, configure the Laravel scheduler, and manage your application on your own infrastructure with minimal setup and maximum control.
Deploying a Laravel application shouldn't require complicated infrastructure or hours of manual server configuration. Whether you're launching a new project or migrating an existing one, you need a deployment workflow that's reliable, repeatable, and easy to manage.
That means automatic deployments from Git, background queue processing, scheduled tasks, SSL, and environment management all without the complexity of traditional DevOps setups.
Laravel in production requires more than just a web process. This guide provides an end-to-end walkthrough for deploying a full Laravel stack—including a web application, database, queue worker, and scheduler—onto your own VPS using Peon.
Overview of the Stack
By following this guide, you will set up the following components:
Overview of the Stack
Before beginning, ensure you have the following ready:
On your local machine:
PHP 8.2+ and Composer.
Node.js + npm for frontend assets.
Git installed and a GitHub account.
On Peon:
A Peon workspace (Cloud or self-hosted).
A Linux VPS connected under Servers.
An SSH key configured if the server is not yet connected.
Step 1 — Create the Laravel Project Locally
Start by creating a new Laravel project and generating an application key:
composer create-project laravel/laravel laravel-webapp
cd laravel-webapp
php artisan key:generate
You can optionally create a queued job and register a schedule to test those components later:
php artisan make:job SayHello
In routes/console.php:
use Illuminate\Support\Facades\Schedule;
Schedule::command('inspire')->hourly();
Step 2 — Create a GitHub Repo and Push
Create a new, empty repository on GitHub named laravel-webapp.
Initialize Git in your local project and push to the main branch:
git init
git branch -M main
git add .
git commit -m "Initial Laravel application"
git remote add origin https://github.com/YOUR_USER/laravel-webapp.git
git push -u origin main
Step 3 — Provision a DigitalOcean Droplet and SSH key
Peon does not host your containers in its own cloud. It SSHs into your VPS, installs Docker, and runs your apps there. Create that machine first.
Generate an SSH key pair
On your laptop:
ssh-keygen -t ed25519 -C "peon-laravel-webapp" -f ~/.ssh/peon_laravel_webapp
Press Enter for an empty passphrase (or set one if you prefer).
Create the Droplet
In DigitalOcean → Create → Droplets.
Choose a region, image (Ubuntu LTS 22.04/24.04), and size (at least 1 GB RAM).
Authentication: SSH key → paste the public key from ~/.ssh/peon_laravel_ webapp.pub .
Create the Droplet and note its public IPv4 address.
Verify SSH from your laptop: ssh -i ~/.ssh/peon_laravel_webapp root@YOUR_DROPLET_IP.
Step 4 — Configure SSH authentication in Peon
Peon needs the private key to log in as the Droplet user.
Open Peon → sidebar Keys & Tokens.
Add a new SSH / private key.
Paste the full private key from ~/.ssh/peon_laravel_webapp .
Give the key a clear name (e.g., peon-laravel-webapp-droplet ) and save.
Step 5 — Provision the server in Peon
Open Servers → add / create a server.
Configure connection parameters:
a. Name: Descriptive ID (e.g., laravel-webapp-prod ).
b. IP / Hostname: Public IPv4 of the DigitalOcean Droplet.
c. Port : Default to 22
d. User: root.
e. SSH host key fingerprint : Optional; leave blank for automatic fingerprint recording upon first connection.
f. SSH key: The key you added in Step 4 .
g. Gateway type: Traefik.
Save and click Connect to server. Wait until the server status is Online.
Initiate the connection: Navigate to the server dashboard
select 'Connect to server', and monitor the activity log until the validation process confirms the server status is 'Online'.
Step 6 — Connect GitHub to Peon
In the Peon dashboard, navigate to Git Sources .
Add a GitHub App connection and install it on the account or organization owning the laravel-webapp repository.
Grant the app access to the specific repository.
Step 7 — Create a Peon Project
Create a dedicated space for your services:
Navigate to Projects → New project .
Name it laravel-webapp and open the project dashboard.
Step 8 — Add PostgreSQL
Within your project, select New service and choose Database .
Select PostgreSQL as the engine and assign it to your server.
After created the database service deploy the service and check once the status running
Once created, go to Configuration and copy the PostgreSQL URL (internal) .
Step 9 — Create the Laravel Web App
Add another New service of type Application (Git) .
Name it laravel-webapp and select the repository and main branch connected in Step 3.
Use Nixpacks as the build pack.
Step 10 — Environment, Domain, and First Deploy
Environment
In the Environment tab, paste your production configuration. Ensure you include the APP_KEY from your local machine and the database credentials from Step 5:
APP_NAME=laravel-webapp
APP_ENV=production
APP_KEY=base64:...
APP_DEBUG=true
APP_URL=https://your-domain.example
DB_CONNECTION=pgsql
DB_HOST=laravel-webapp-database-
DB_PORT=5432
DB_DATABASE=laravel-webapp_database
DB_USERNAME=peon
DB_PASSWORD=
QUEUE_CONNECTION=database
CACHE_STORE=database
Domain and Deployment
Configure your domain FQDN and point your DNS A record to the server IP. Once ready, click Deploy in the project overview.
Once deployed, navigate to the 'Terminal' tab in your Peon project dashboard and run the command php artisan migrate to ensure your database tables are up to date.
Step 11 — Enable CI/CD (Push-to-Deploy)
Open the web service settings and toggle Auto deploy to on.
To test, push a change from your local machine:
git add .
git commit -m "Trigger Peon deploy"
git push origin main
Peon will automatically detect the push and begin a new deployment.
Step 12 — Add the Laravel Scheduler
Instead of using the host crontab, use Peon's Scheduled Tasks feature on the web service:
Click Execute now to trigger the task immediately. Navigate to the Logs tab to verify the execution output; confirm that php artisan schedule:run exits with status 0, ensuring that the scheduler has correctly invoked the defined tasks. Given the cron expression * * * * * , verify that the log stream indicates consistent execution every minute, providing an audit trail for the scheduled events.
Step 13 — Add the Queue Worker
Create a second Application (Git) service named laravel-webapp-worker using the same repository.
Set the Start command to:
php artisan queue:work --sleep=3 --tries=3 --max-time=3600 .
Copy the environment variables from the web service to this worker service.
Step 14 — Final Smoke-Test
Verify your deployment by:
Visiting your live HTTPS domain.
Dispatching a job and checking the laravel-webapp-worker logs.
Manually triggering the scheduler via Execute now .
Conclusion
Deploying Laravel doesn't have to involve complex server management or fragile deployment scripts. By using Peon , you can create a production-ready deployment pipeline with Git integration, automated CI/CD, dedicated queue workers, and a reliable scheduler all from a single dashboard.
With your application automatically deploying on every push, background jobs processed efficiently, and scheduled tasks running consistently, you get a scalable and maintainable Laravel infrastructure that grows with your project. Whether you're building a SaaS product, an internal business application, or a high-traffic web platform, Peon provides the tools needed to deploy and manage Laravel with confidence.





















Top comments (0)