Automating Production Deployments on DigitalOcean
Deploying web applications manually gets painful fast — especially once your project grows.
For azan.lk, a Laravel + React application running on a hardened DigitalOcean droplet, I moved from manual SSH-based deployments to a fully automated CI/CD pipeline using GitHub Actions.
Every push to main now builds, deploys, and optimizes the app automatically — safely and consistently.
This article gives you a practical, production-ready overview of how to automate deployments without overengineering.
⚙️ What This Covers
This guide focuses on real-world CI/CD for VPS-based deployments, not platform-locked solutions.
You’ll learn how to:
- Automate deployments using GitHub Actions
- Build Laravel & React outside the server
- Deploy via SSH securely
- Run database migrations and optimizations remotely
- Keep your DigitalOcean droplet lean and stable
- Eliminate repetitive SSH workflows
Perfect for portfolios, SaaS apps, client projects, or APIs running on a VPS.
Prerequisites (Important)
Before adding automation, your server must already be production-ready.
Make sure you’ve completed these first:
Server Hardening
- Non-root user
- SSH keys
- Firewall & Fail2Ban
Fortify Your DigitalOcean Droplet: A Step-by-Step Security Guide for Ubuntu 24.04
HTTPS & SSL
- Nginx
- Let’s Encrypt
- Auto-renewal
Unlock Free HTTPS with Let’s Encrypt SSL
Manual Deployment Setup
- Laravel + PHP-FPM
- Nginx
- MySQL
- Node & Vite
Streamlined App Deployment on Ubuntu 24.04
Once those are done, CI/CD becomes the final layer — not a replacement.
The Problem with Traditional Deployments
A typical manual deployment looks like this:
- SSH into the server
- Pull latest code
- Run Composer
- Run NPM builds
- Fix permissions
- Run migrations
- Hope nothing breaks
On small VPS instances, Composer and NPM can consume memory, slow the server, or even crash builds.
And doing this repeatedly?
That’s technical debt waiting to happen.
What You’ll Accomplish with CI/CD
By the end of this setup, you’ll have:
- Automatic deployments on every push to
main
- Builds handled by GitHub, not your VPS
- Secure SSH-based file sync
- Zero manual server logins for deploys
- Reliable, repeatable production releases
Push code → GitHub Actions runs → App goes live
Why This Approach Works
This setup is optimized for developers who:
- Use VPS hosting instead of managed platforms
- Want full control over infrastructure
- Care about performance and stability
- Prefer simple, understandable pipelines
No Kubernetes.
No overcomplicated workflows.
Just clean automation that works.
Read the Full Step-by-Step Guide
The full article includes:
- Complete
deploy.yml workflow
- GitHub Secrets setup
- SSH key best practices
- Common CI/CD pitfalls (and how to avoid them)
- Production-safe Artisan commands
Effortless Web App Deployments: Mastering GitHub Actions with DigitalOcean
✨ Final Thoughts
CI/CD isn’t about complexity — it’s about removing friction.
Once this pipeline is in place:
- Deployments become boring (that’s good)
- Servers stay fast
- Mistakes drop dramatically
- Your workflow scales with your project
Pair this guide with Streamlined App Deployment on Ubuntu 24.04, and your readers get a complete journey:
Manual setup → hardened server → automated production deployments