Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Docker Deploy Laravel Package

adacto-company/laravel-docker-deploy

Deploy Laravel with a Docker Stack using an Artisan installer and environment generator. Installs required deployment files, helps manage multiple .env.* configs, and works alongside Laravel Sail for local development. Set APP_ENV per deployment environment.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Purpose Alignment: The package automates Docker-based Laravel deployments, aligning well with CI/CD pipelines for containerized PHP applications. It abstracts Docker orchestration (e.g., docker-compose, Kubernetes) behind a Laravel-specific facade, reducing DevOps complexity for PHP teams.
  • Laravel Integration: Leverages Laravel’s service container and Artisan commands, ensuring consistency with existing workflows (e.g., php artisan deploy). Compatible with Laravel’s event system for pre/post-deployment hooks.
  • Isolation: Encapsulates Docker-specific logic, preventing "Docker sprawl" in application code. Ideal for teams using Docker but lacking DevOps expertise.

Integration Feasibility

  • Prerequisites:
    • Docker/Docker Compose or Kubernetes (for k8s driver) installed on deployment targets.
    • Laravel 8+ (composer dependency).
    • SSH access for remote deployments or local Docker daemon for direct deployments.
  • Customization Points:
    • Configurable via .env (e.g., DOCKER_DEPLOY_DRIVER=ssh, DOCKER_COMPOSE_FILE=docker-compose.prod.yml).
    • Supports custom scripts (e.g., postDeploy in config/docker-deploy.php).
  • Limitations:
    • No built-in rollback mechanism (requires manual docker-compose down or custom logic).
    • Assumes Dockerfiles are pre-configured (no dynamic image building).

Technical Risk

  • Dependency Stability:
    • Low risk for core Docker operations, but ssh driver may introduce variability across environments.
    • No active maintenance (last commit: 2021), though Apache-2.0 license mitigates fork risks.
  • Security:
    • SSH keys and Docker socket access must be secured (package doesn’t enforce best practices).
    • Risk of credential leakage if .env is committed (mitigate via .env.example + CI secrets).
  • Performance:
    • Overhead from Docker layer caching; rebuilds may slow deployments if not optimized.

Key Questions

  1. Deployment Strategy:
    • Will this replace existing CI/CD (e.g., GitHub Actions, Jenkins) or augment it? How will triggers (e.g., Git pushes) map to Artisan commands?
  2. Environment Parity:
    • How will local development Docker setups align with production (e.g., .dockerignore, volumes)?
  3. Rollback Plan:
    • How will failed deployments be reverted? Will this integrate with Laravel’s migrate:rollback or require external tooling?
  4. Monitoring:
    • Are Docker logs/health checks observable post-deployment? Will this integrate with Laravel Horizon or third-party tools?
  5. Scaling:
    • For multi-container setups (e.g., queues, workers), how will service discovery (e.g., laravel-queues config) adapt?

Integration Approach

Stack Fit

  • Best For:
    • Laravel monoliths or microservices using Docker Compose/Kubernetes.
    • Teams prioritizing developer self-service deployments over DevOps tooling (e.g., ArgoCD, ECS).
  • Compatibility:
    • Pros:
      • Native PHP/Laravel syntax (e.g., Deploy::run() in controllers).
      • Works with Forge, Envoyer, or bare-metal servers.
    • Cons:
      • Not suitable for serverless PHP (e.g., Bref) or non-Docker environments.
      • May conflict with packages like laravel-deployer if both are used.

Migration Path

  1. Assessment Phase:
    • Audit existing Dockerfiles and docker-compose.yml for compatibility.
    • Map current deployment steps (e.g., rsync, pm2) to package equivalents.
  2. Pilot Deployment:
    • Start with non-production environments (e.g., staging).
    • Test ssh driver for remote deployments or local driver for CI.
  3. Incremental Rollout:
    • Replace manual docker-compose up commands with php artisan deploy.
    • Gradually migrate hooks (e.g., database migrations) to Laravel events.
  4. Fallback Plan:
    • Document manual Docker commands as backup (e.g., docker-compose -f docker-compose.prod.yml up --build).

Compatibility

  • Docker Compose:
    • Requires docker-compose v1 or v2 syntax. Validate with docker-compose config.
  • Kubernetes:
    • Limited support; ensure k8s driver aligns with Helm or raw YAML deployments.
  • Laravel Ecosystem:
    • Conflicts unlikely, but test with:
      • laravel-envoy (SSH deployments may overlap).
      • laravel-telescope (for monitoring deployments).
  • CI/CD:
    • Can be triggered via Git hooks or CI scripts (e.g., php artisan deploy --env=production).

Sequencing

  1. Pre-Deployment:
    • Run composer require adacto-company/laravel-docker-deploy.
    • Configure .env and config/docker-deploy.php.
  2. Deployment:
    • Add Artisan command to CI pipeline:
      php artisan deploy --driver=ssh --host=server.com --user=deploy --env=production
      
  3. Post-Deployment:
    • Verify with docker ps and Laravel logs (tail -f storage/logs/laravel.log).
    • Test critical paths (e.g., API endpoints, queues).

Operational Impact

Maintenance

  • Pros:
    • Centralized configuration reduces ad-hoc Docker commands.
    • Laravel’s service container enables easy swapping of deployment drivers.
  • Cons:
    • Package abandonment risk (last update: 2021). Plan for forks or alternatives (e.g., roave/infection for testing, but not deployments).
    • Dockerfile updates require manual sync with deployment config.

Support

  • Debugging:
    • Use --verbose flag for Artisan commands.
    • Check Docker logs: docker-compose logs --tail=50.
    • Laravel’s Deploy::failing() event can trigger alerts (e.g., Slack).
  • Troubleshooting:
    • Common issues:
      • Permission denied (SSH keys, Docker socket).
      • Missing volumes in docker-compose.yml.
      • PHP version mismatches between host and container.
    • Mitigation: Add health checks in docker-compose.yml (e.g., healthcheck).

Scaling

  • Horizontal Scaling:
    • Package supports scaling via docker-compose up --scale worker=4.
    • For Kubernetes, ensure k8s driver aligns with HPA (Horizontal Pod Autoscaler).
  • Performance:
    • Layer caching in Dockerfiles speeds up rebuilds.
    • Consider multi-stage builds to reduce image size.
  • Resource Limits:
    • Configure deploy.php to set Docker resource constraints (e.g., --memory=1g).

Failure Modes

Failure Scenario Impact Mitigation
Docker daemon unavailable Deployment blocks Use health checks; retry logic in CI.
SSH connection fails Remote deployments fail Fallback to local Docker or manual intervention.
Corrupted container state Application crashes Use docker-compose down && up as recovery.
Config mismatch Services fail to start Validate docker-compose config pre-deploy.
Package update breaks changes Deployments fail Pin version in composer.json (e.g., ^1.0).

Ramp-Up

  • Onboarding:
    • For Developers:
      • Document Artisan commands (e.g., deploy:staging, deploy:production).
      • Train on Docker basics (e.g., volumes, networks).
    • For DevOps:
      • Audit existing Docker setups for compatibility.
      • Set up monitoring for deployment events.
  • Training:
    • Workshop: "Laravel Docker Deployments" covering:
      • Configuring .env and deploy.php.
      • Debugging common failures.
      • Integrating with CI/CD.
  • Documentation:
    • Internal wiki with:
      • Example docker-compose.yml for Laravel.
      • Checklist for pre-deployment validation.
      • Rollback procedures.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver