We earn commissions when you shop through the links below.
Shipping code without taking your app offline used to feel like enterprise territory — something only big companies with dedicated platform teams could pull off. But zero-downtime deployment strategies for small teams are absolutely achievable today, and they don’t require a 10-person DevOps department or a six-figure infrastructure budget. In this post I’ll walk through the core strategies, real configuration examples, and the tooling choices that actually make sense when you’re a team of two to five developers trying to ship fast without waking up at 3am to restart a server.
Why Downtime Hurts More Than You Think
Even 30 seconds of downtime during a deploy can mean lost revenue, failed webhook deliveries, dropped WebSocket connections, or a frustrated user who never comes back. For SaaS products especially, users have zero tolerance for instability. And if you’re deploying multiple times a day — which you should be — that risk compounds quickly.
The good news is that the building blocks are simpler than ever. You need: a load balancer or proxy, a strategy for swapping out application instances, and a disciplined approach to database migrations. That’s it.
The Core Strategies
1. Blue-Green Deployments
Blue-green is the classic approach. You run two identical environments — blue (live) and green (staging). You deploy to green, run your smoke tests, then switch traffic over. If something breaks, you flip back to blue instantly.
This works great when your infrastructure supports fast environment swaps. Railway makes this surprisingly easy for small teams — you can maintain separate environments per project and promote deployments without touching DNS or load balancer configs manually.
The tradeoff: you’re running double the infrastructure during the swap window. For most small teams, that’s acceptable — you’re talking minutes, not hours.
2. Rolling Deployments
Rolling deployments update instances one at a time (or in small batches) while the rest continue serving traffic. This is what Kubernetes does natively, and it’s also the default strategy for most managed container platforms.
Here’s a simple Nginx upstream config that supports rolling restarts behind a load balancer:
upstream app_servers {
server 10.0.0.1:3000;
server 10.0.0.2:3000;
server 10.0.0.3:3000;
}
server {
listen 80;
location / {
proxy_pass http://app_servers;
proxy_next_upstream error timeout http_502 http_503 http_504;
proxy_connect_timeout 5s;
proxy_read_timeout 30s;
}
}With proxy_next_upstream configured, Nginx will automatically route around any instance that goes down during a restart. Your deploy script then restarts servers one by one with a health check between each step:
#!/bin/bash
SERVERS=("10.0.0.1" "10.0.0.2" "10.0.0.3")
HEALTH_URL="http://localhost:3000/health"
for SERVER in "${SERVERS[@]}"; do
echo "Deploying to $SERVER..."
ssh deploy@$SERVER "cd /app && git pull && npm ci && pm2 reload app"
# Wait for health check to pass
for i in {1..10}; do
STATUS=$(ssh deploy@$SERVER "curl -s -o /dev/null -w '%{http_code}' $HEALTH_URL")
if [ "$STATUS" == "200" ]; then
echo "$SERVER is healthy"
break
fi
echo "Waiting for $SERVER... ($i/10)"
sleep 3
done
done
echo "Rolling deploy complete"This script is intentionally simple — it’s the kind of thing a small team can actually understand, maintain, and debug at midnight.
3. Canary Releases
Canary deployments send a small percentage of traffic (say 5-10%) to the new version before fully committing. This is overkill for most small teams unless you’re seeing significant traffic or deploying risky changes.
When it does make sense: you’re changing a core billing flow, refactoring an authentication system, or rolling out a major infrastructure change. In those cases, canary releases give you real user validation before full rollout.
Nginx Plus supports weighted upstreams natively. With open-source Nginx you can approximate it using multiple upstream blocks with different weights:
upstream app_stable {
server 10.0.0.1:3000 weight=9;
server 10.0.0.2:3000 weight=9;
}
upstream app_canary {
server 10.0.0.3:3000;
}
split_clients "${request_id}" $upstream_pool {
10% app_canary;
* app_stable;
}
server {
listen 80;
location / {
proxy_pass http://$upstream_pool;
}
}The Database Migration Problem
This is where most zero-downtime deployments fall apart. If your new code expects a column that doesn’t exist yet, or your migration drops a column the old code still reads, you’re going to have a bad time.
The solution is the expand-contract pattern:
- Expand: Add new columns/tables without removing anything. Both old and new code work.
- Deploy new code: Now running against the expanded schema.
- Contract: In a later deploy, remove the old columns/tables no longer needed.
This means your migrations are always additive first. Never drop or rename a column in the same deploy that ships code depending on that change.
For Laravel teams using Artisan migrations, run migrations before swapping traffic:
# In your deploy pipeline
php artisan migrate --force
# Health check the app
curl -f https://yourapp.com/health || exit 1
# Then swap traffic / restart workersRunning migrations before the swap means your new schema is in place before any new code hits it, and your old code (still serving traffic) is compatible because you used the expand pattern.
Infrastructure That Makes This Easy
You don’t need to build all of this from scratch. Managed platforms handle most of the heavy lifting.
DigitalOcean App Platform supports zero-downtime deploys out of the box — it spins up the new container, waits for it to pass its health check, then terminates the old one. For small teams running Node, Python, or PHP apps, this removes almost all of the operational complexity described above. You get rolling deploys, automatic rollback on health check failure, and managed SSL without any of the Nginx wrangling.
If you prefer raw VMs with more control, DigitalOcean Droplets with a managed load balancer give you the rolling deploy setup I described earlier at a very reasonable cost.
Health Checks Are Non-Negotiable
Every zero-downtime strategy depends on health checks. If your load balancer or platform can’t tell whether an instance is actually ready to serve traffic, you’ll route requests to half-started processes and get errors.
Build a /health endpoint that checks the things that matter:
// Express.js example
app.get('/health', async (req, res) => {
try {
// Check DB connection
await db.query('SELECT 1');
// Check Redis if you use it
await redis.ping();
res.json({ status: 'ok', timestamp: Date.now() });
} catch (err) {
res.status(503).json({ status: 'error', error: err.message });
}
});Keep it fast (under 500ms), keep it honest (don’t return 200 if your DB is down), and make sure it’s excluded from authentication middleware.
Graceful Shutdown
When you restart an instance, you need to drain in-flight requests before killing the process. Node.js with Express:
const server = app.listen(3000);
process.on('SIGTERM', () => {
console.log('SIGTERM received. Closing server gracefully...');
server.close(() => {
console.log('All connections closed. Exiting.');
process.exit(0);
});
// Force exit after 30s if connections hang
setTimeout(() => {
console.error('Forced exit after timeout');
process.exit(1);
}, 30000);
});PM2 sends SIGINT by default — configure it to send SIGTERM and give your app a kill timeout:
// ecosystem.config.js
module.exports = {
apps: [{
name: 'app',
script: 'server.js',
kill_timeout: 30000,
listen_timeout: 10000,
wait_ready: true
}]
};Putting It All Together
Implementing zero-downtime deployment strategies for small teams doesn’t mean you need Kubernetes or a platform engineer on staff. Start simple:
- Add a real health check endpoint to your app
- Implement graceful shutdown handling
- Adopt the expand-contract pattern for database migrations
- Use a managed platform (Railway, DigitalOcean App Platform) that handles rolling deploys for you, or set up Nginx with the rolling script above on your own VMs
These zero-downtime deployment strategies for small teams scale with you. Start with the managed platform approach to get the wins quickly, then introduce more sophisticated patterns (canary, feature flags) as your team and traffic grow. The goal is confident deploys at any hour — not perfection from day one.