Skip to content

Deploy Laravel with Queues, Scheduler and Redis (No Extra Servers)

Run Laravel in production with queue workers, the scheduler, Redis and MySQL or PostgreSQL in one deploy: no Supervisor config, no cron entry, no extra server.

Published
Reading time
4 min
On this page

Key takeaways

  • Each deploy runs composer install, artisan migrate and config:cache, then starts a queue worker and the scheduler.
  • Attach managed MySQL or PostgreSQL plus Redis; QUEUE_CONNECTION and cache settings are set for you.
  • Use Hobby ($4/mo) or higher in production: Free apps sleep, so scheduled tasks wouldn't run on time.

A real Laravel app is more than PHP-FPM. You need a queue worker for emails and jobs, the scheduler for schedule:run, Redis for cache and queues, and a database.

On shared hosting you usually get PHP-FPM and nothing else. On a VPS you write Supervisor configs and crontabs yourself and look after the server. This guide shows how to get all four pieces from one deploy.

What a deploy does for Laravel

DockHosting recognizes Laravel by its artisan file. On every deploy it:

  1. Runs composer install.
  2. Runs php artisan migrate.
  3. Runs php artisan config:cache.
  4. Starts the web server: production PHP-FPM with opcache and tuned workers.
  5. Starts a managed queue worker.
  6. Runs the scheduler (schedule:run).

Common extensions are preinstalled: gd, curl, mbstring, pdo and redis.

1. Prepare the app

Make sure your production config comes from the environment, which is Laravel's default. Check that config/database.php reads DB_URL or DATABASE_URL, or the DB_* variables, and doesn't contain hard-coded values.

Add your APP_KEY as a secret in the dashboard. Generate one locally:

bash
php artisan key:generate --show

Set APP_ENV=production and APP_DEBUG=false. Leaving debug on in production leaks stack traces and environment details.

2. Install the CLI and deploy

bash
# macOS / Linux
curl -fsSL https://cli.dockhosting.dev/install.sh | sh
 
# Windows (PowerShell)
irm https://cli.dockhosting.dev/install.ps1 | iex
 
dock login
dock deploy

You get a live https://<project>.dockhosting.cloud URL with HTTPS. To deploy on every push instead, connect your GitHub repository from the dashboard.

3. Attach MySQL (or PostgreSQL) and Redis

From the dashboard, create a managed MySQL, MariaDB or PostgreSQL database and a managed Redis, then attach both to the project.

  • The database connection string arrives as DATABASE_URL.
  • Redis arrives as REDIS_URL, and QUEUE_CONNECTION and the cache settings are set automatically.

Both are reached over a private network, with no public port. Redis gets daily backups on paid plans as well, so jobs that are still queued aren't lost.

4. Write a job and a schedule

Nothing here is specific to DockHosting. It's standard Laravel, and it runs as-is:

php
// app/Jobs/SendWelcomeEmail.php
class SendWelcomeEmail implements ShouldQueue
{
    use Queueable;
 
    public function __construct(public User $user) {}
 
    public function handle(): void
    {
        Mail::to($this->user)->send(new WelcomeMail($this->user));
    }
}
 
// Dispatch it from a controller
SendWelcomeEmail::dispatch($user);
php
// routes/console.php (Laravel 11)
use Illuminate\Support\Facades\Schedule;
 
Schedule::command('reports:daily')->dailyAt('06:00');
Schedule::job(new PruneOldSessions)->hourly();

The managed worker picks up the job from Redis, and the scheduler runs your tasks on time. You don't need a Supervisor file or a crontab line.

5. Logs and restarts

bash
dock logs      # build, web and app logs
dock restart   # e.g. after changing environment variables

Run a quick query against your database with dock db sql.

Custom domain and always-on

On the Free plan, apps sleep when idle and wake on the next request. That's fine for a demo, but not when a scheduler has to fire at 06:00. For production Laravel, use Hobby ($4/month, always on, your own domain) or Pro ($9/month, 5 custom domains, database admin panels). HTTPS certificates are issued and renewed automatically for custom domains too.

How it compares

Shared hostingVPS + control panelDockHosting
Queue workerUsually not availableYou configure SupervisorManaged
SchedulerSometimes, via cPanel cronYou add the crontabManaged
RedisRarelyYou install itOne click
Server upkeepHost'sYoursPlatform's
PricingPer siteServer + panelFlat: Free, $4, $9, $19

See the Laravel hosting page for details, or check how to connect any app to managed PostgreSQL.

Frequently asked questions

Which Laravel and PHP versions are supported?

Laravel 10.x and 11.x on PHP 8.2 and 8.3. The PHP version follows the constraint in your composer.json.

Do I need to configure Supervisor or cron for Laravel?

No. Each deploy starts a managed queue worker and runs the scheduler (schedule:run) for you. Queues and the scheduler are platform features, not extra servers.

Does php artisan migrate run automatically?

Yes. Deploys run composer install, artisan migrate and config:cache before the new release takes traffic.

How much does Laravel hosting cost?

There's a Free plan with 2 projects and 1 database. Paid plans are flat: Hobby $4/month, Pro $9/month, Team $19/month (unlimited projects). There's no per-site or per-visitor fee.

  • Laravel
  • PHP
  • Redis
  • Deployment
  • Tutorial

Written by Doughmi ILYAS

Doughmi builds DockHosting, the developer-first platform behind dock deploy: the build system, the managed databases and the dashboard. On this blog: guides to shipping apps without running servers, written with the commands the platform actually ships.

Summarize with

Share

All posts

Create an account, run dock deploy, and get a live HTTPS URL in minutes.