Urgent.News

What's breaking now, across thousands of outlets.

Tech

Moving Off PaaS: Deploying Production Laravel Stacks with Kamal 2

Platform-as-a-Service (PaaS) providers make launching a web application simple. You push code, and they handle the infrastructure. However, as your application grows, the cost scales aggressively. What starts as a $20/month hobby server can scale to hundreds or thousands of dollars for simple database upgrades, extra RAM, or custom background workers. In the past, moving off a PaaS meant adopting…

Platform-as-a-Service (PaaS) providers simplify launching web applications by handling infrastructure once code is pushed. However, as applications grow, costs rise dramatically due to factors like database upgrades, extra RAM, or custom background workers. Traditionally, moving away from a PaaS involved using complex container orchestrators like Kubernetes or writing custom server setup scripts.

Kamal 2, developed by 37signals, provides an alternative. It is an infrastructure-agnostic deployment tool that enables deploying containerized applications to any virtual private server (such as Hetzner, DigitalOcean, or bare metal) with zero downtime, all using a clean SSH-based workflow. Here's a step-by-step guide to deploying a production Laravel application using Kamal 2.

First, ensure your application is containerized with a production-ready Dockerfile that includes PHP-FPM, Nginx, and necessary PHP extensions. Create this Dockerfile in the root of your Laravel project and specify the required dependencies and configurations. Next, install Kamal on your local development machine using the command `gem install kamal`.

After installation, initiate the deployment process by running `kamal init` in your Laravel project directory. This command generates three crucial files: `config/deploy.yml`, `.env`, and `.kamal/secrets`.

The `config/deploy.yml` file configures your servers, container image registry, and service settings. For a production Laravel app with a Redis server on a single VPS, define your service, image, servers, and registry details in this file. Additionally, manage your environment secrets securely by defining local variables in your `.env` file, such as `KAMAL_REGISTRY_PASSWORD`, `APP_KEY`, and `DB_PASSWORD`.

Kamal retrieves these secrets from your local `.env` file during deployment and injects them into the running container securely.

Finally, execute the first deployment using the command `kamal setup`. This command SSHs into your target server, installs Docker if necessary, sets up Traefik as a reverse proxy, manages accessories like Redis, builds and pushes Docker images, and starts the containers while handling traffic routing. For subsequent updates, use `kamal deploy` for seamless zero-downtime rolling updates.

For additional details, including the full code repository and a security checklist, visit [klytron.com](https://klytron.com/blog/moving-off-paas-kamal-2-laravel).

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Digital Sovereignty: Europe's Path to Infra-Independence

Digital sovereignty in the EU: From slogan to practice We're surfing on the wrong server. That's one of the harshest realities we're facing as IT professionals today.

  • "Digital Sovereignty" in EU discussed as political slogan, but operational challenge
  • US-CLOUD Act allows US authorities to demand data access regardless of data center location
  • EU initiatives DGA and GAIA-X aim to create framework for sovereign data markets

Production API Key Rotation Explained: 6 Least-Privilege Checks for Node.js GitHub Actions

Short answer: use two narrowly scoped API keys, switch traffic with an explicit activation step, and revoke the old key only after logs and live requests prove the cutover.

  • Rotate production API keys in Node.js GitHub Actions to reduce security risks
  • Use two narrowly scoped keys with explicit activation for traffic switch
  • Revoke old key after verification to minimize downtime and prevent disruptions

Mastering Advanced Server-Side Caching Patterns in Next.js 14

Originally published on tamiz.pro . In modern React architectures, the distinction between client-side and server-side execution is no longer just about where the code runs; it is about where the data…

  • Default caching in Next.js has limitations and requires custom solutions
  • Implement fine-grained memoization to cache individual data slices
  • Use Stale-While-Revalidate pattern with ETag headers for optimized data fetching

Medicine Safety Gatekeeper: Building a Real-Time Drug Interaction & Expiration Checker with YOLOv10

We’ve all been there: digging through a cluttered medicine cabinet, wondering if that half-empty blister pack of Ibuprofen is still safe to take, or if it will play nice with the cold medicine you…

  • AI-powered Medicine Safety Gatekeeper uses YOLOv10 for medicine container detection.
  • Tesseract OCR extracts expiration dates and ingredients from medicine images.
  • System checks extracted data against SQLite database for expired products and drug interactions.

Never Miss Twice: What 2,066 Habits Say About the Second Day

TL;DR. I measured the "never miss twice" rule against 2,066 real habits from 1,006 people. Once a habit has one missed day behind it, 80.9% of those gaps still end with a check.

  • "Never miss twice" rule suggests missed habits become harder to resume.
  • 80.9% of habits resumed after one missed day, 71.1% after two.
  • Return rate decreases sharply with each additional missed day.

More from Sunday 13 September →