Installation Add the package via Composer:
composer require bugbyte/deployer-bundle:1.0.*
Enable the bundle in app/AppKernel.php:
$bundles[] = new Bugbyte\DeployerBundle\BugbyteDeployerBundle();
Configuration
Copy the default config.yml from vendor/bugbyte/deployer-bundle/Resources/config/config.yml to app/config/config.yml and customize it for your deployment targets (e.g., prod, staging).
First Deployment Run the deploy command with a target:
php app/console bb:deploy deploy prod
For help, use:
php app/console bb:deploy
Deployment Automation
Use the bb:deploy command to automate server-side deployments (e.g., Git pulls, symlink updates, cache clearing). Example workflow:
# Deploy to production
php app/console bb:deploy deploy prod
# Rollback if needed
php app/console bb:deploy rollback prod
Environment-Specific Configs
Define separate configs for prod, staging, etc., in config.yml:
bugbyte_deployer:
servers:
prod:
host: user@prod.example.com
deploy_path: /var/www/prod
repository: git@github.com:user/repo.git
staging:
host: user@staging.example.com
deploy_path: /var/www/staging
Integration with Symfony Tasks Chain deployments with other Symfony commands (e.g., database migrations):
php app/console doctrine:migrations:migrate --env=prod
php app/console bb:deploy deploy prod
Custom Deployment Scripts
Extend the bundle by overriding the Deployer class or adding custom tasks in config.yml:
bugbyte_deployer:
tasks:
- 'deploy:prepare'
- 'deploy:update_code'
- 'custom:task' # Your custom script
Zero-Downtime Deployments
Use the shared and writable directories in config.yml to manage symlinks and avoid downtime:
bugbyte_deployer:
shared:
- app/cache
- app/logs
writable:
- app/config/parameters.yml
Symfony 2.1.x Dependency The bundle is only compatible with Symfony 2.1.x. Attempting to use it with newer versions (e.g., 3.x, 4.x) will fail. Verify your Symfony version first:
php app/console --version
SSH Key Configuration Ensure SSH keys are set up for passwordless authentication to your servers. Test connectivity manually:
ssh user@prod.example.com
Missing deploy.php
The underlying bugbyte/deployer package expects a deploy.php file in your project root. If missing, create one with basic tasks or copy from the bundle’s resources.
Permission Issues
Deployments may fail if the Symfony user lacks permissions on the remote server. Use chmod or chown to fix:
ssh user@prod.example.com "chmod -R 755 /var/www/prod"
Verbose Output Enable verbose mode for detailed logs:
php app/console bb:deploy deploy prod -v
Dry Runs Test deployments without executing changes:
php app/console bb:deploy --dry-run deploy prod
Custom Logging Redirect output to a file for debugging:
php app/console bb:deploy deploy prod >> deploy.log 2>&1
Override Default Tasks
Extend the bundle by creating a custom command or service that integrates with Bugbyte\DeployerBundle\Command\DeployCommand.
Add Pre/Post Hooks Use Symfony’s event system to trigger actions before/after deployment (e.g., send Slack notifications):
# config.yml
bugbyte_deployer:
hooks:
after_deploy: ['app:notify:slack']
Custom Deployment Strategies
Replace the default Deployer class by binding your own implementation in services.yml:
services:
bugbyte_deployer.deployer:
class: AppBundle\Service\CustomDeployer
arguments: [@bugbyte_deployer.deployer]
How can I help you explore Laravel packages today?