SYS://VISION.ACTIVE
VIEWPORT.01
LAT 28.0222° N
SIGNAL.NOMINAL
VISION Loading
Back to Blog

Container Orchestration with Docker Swarm

Shane Barron

Shane Barron

Laravel Developer & AI Integration Specialist

Simpler Than Kubernetes

Docker Swarm provides container orchestration with less complexity than Kubernetes. For many Laravel deployments, it offers the right balance of features and simplicity.

Initialize Swarm

# On manager node
docker swarm init --advertise-addr 

# Join workers
docker swarm join --token  :2377

Stack Definition

# docker-stack.yml
version: '3.8'
services:
  app:
    image: myregistry/laravel-app:latest
    deploy:
      replicas: 3
      update_config:
        parallelism: 1
        delay: 10s
      restart_policy:
        condition: on-failure
    networks:
      - webnet
    secrets:
      - app_key

  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
      - "443:443"
    deploy:
      replicas: 2
    networks:
      - webnet

networks:
  webnet:

secrets:
  app_key:
    external: true

Deploy Stack

# Deploy
docker stack deploy -c docker-stack.yml laravel

# Check services
docker service ls

# Scale service
docker service scale laravel_app=5

# Update service
docker service update --image myregistry/laravel-app:v2 laravel_app

Rolling Updates

deploy:
  update_config:
    parallelism: 1      # Update one container at a time
    delay: 10s          # Wait between updates
    failure_action: rollback
    monitor: 30s
  rollback_config:
    parallelism: 1
    delay: 10s

Conclusion

Docker Swarm provides production orchestration without Kubernetes complexity. For many Laravel applications, it's the right tool for the job.

Share this article
Shane Barron

Shane Barron

Strategic Technology Architect with 40 years of experience building production systems. Specializing in Laravel, AI integration, and enterprise architecture.

Need Help With Your Project?

I respond to all inquiries within 24 hours. Let's discuss how I can help build your production-ready system.

Get In Touch