- How do I install Laravel Docker Deploy and set up my first deployment environment?
- Run `composer require adacto-company/laravel-docker-deploy` to install, then execute `php artisan docker-deploy:install` to scaffold the deployment files. Use `php artisan docker-deploy:generate-environment` to create environment-specific configs (e.g., `.env.prod`). Set `APP_ENV` to match your target environment before deploying.
- Can I use this package alongside Laravel Sail for local development?
- Yes, this package is designed to coexist with Laravel Sail. Use Sail for local development and switch to Docker Stack deployments for production or staging by setting `APP_ENV` appropriately. The package ensures no conflicts between local and production Docker setups.
- What Laravel versions does this package support, and are there breaking changes?
- The package officially supports Laravel 8+. No major breaking changes have been documented, but always check the package’s changelog or GitHub issues for updates. If using Laravel 9+, verify compatibility with the package’s Artisan commands and Docker orchestration logic.
- How do I customize the Docker Compose files or add environment-specific configurations?
- After running `php artisan docker-deploy:generate-environment`, edit the generated `.env.*` files (e.g., `.env.prod`, `.env.staging`) for environment-specific settings like database URLs or queue drivers. Override the default `docker-compose.yml` by specifying a custom file path in `.env` (e.g., `DOCKER_COMPOSE_FILE=docker-compose.prod.yml`).
- Does this package support remote deployments (e.g., to a VPS or cloud server)?
- Yes, the package supports remote deployments via SSH. Configure the `DOCKER_DEPLOY_DRIVER=ssh` in your `.env` file and ensure SSH keys are properly set up. The package will handle pushing and deploying the Docker Stack to the remote server using the SSH driver.
- What happens if my deployment fails? Can I roll back easily?
- The package does not include a built-in rollback mechanism. For rollbacks, manually run `docker-compose down` or use `docker-compose -f docker-compose.prod.yml down` to stop the failed stack. For database rollbacks, use Laravel’s `migrate:rollback` or integrate custom scripts via the package’s `postDeploy` hook in `config/docker-deploy.php`.
- Will this package work with Kubernetes, or is it Docker Compose-only?
- The package primarily supports Docker Compose (v1 or v2) but includes limited Kubernetes driver support. If using Kubernetes, ensure your `docker-compose.yml` aligns with Helm or raw YAML deployments. Test the `k8s` driver in a staging environment first, as it may require additional configuration for service discovery and scaling.
- How do I integrate this with my CI/CD pipeline (e.g., GitHub Actions, Jenkins)?
- Trigger deployments via CI/CD by running `php artisan docker-deploy:deploy` in your pipeline script. Set `APP_ENV` to the target environment (e.g., `staging` or `production`) before deployment. For GitHub Actions, use a workflow step to execute the Artisan command after code checks pass. Example: `run: php artisan docker-deploy:deploy --env=production`.
- Are there any security risks I should be aware of when using this package?
- Secure SSH keys and Docker socket access manually, as the package does not enforce best practices. Avoid committing sensitive `.env.*` files to version control; use `.env.example` as a template and manage secrets via CI/CD environment variables. Ensure your Docker images are scanned for vulnerabilities and use non-root users in containers.
- What alternatives exist for Docker-based Laravel deployments, and how does this compare?
- Alternatives include `laravel-deployer` (for non-Docker deployments), `Envoyer` (paid, feature-rich), or custom scripts with `docker-compose`. This package stands out by offering Laravel-native Artisan commands, seamless Sail integration, and environment-specific `.env.*` management. Unlike Envoyer, it’s free and open-source but lacks built-in monitoring or rollback features.