{"id":15589542,"url":"https://github.com/sokil/deploybundle","last_synced_at":"2025-09-03T00:49:03.999Z","repository":{"id":57055153,"uuid":"62667417","full_name":"sokil/DeployBundle","owner":"sokil","description":"Symfony application deploy bundle. Full stack deply task management tool","archived":false,"fork":false,"pushed_at":"2017-07-04T08:23:00.000Z","size":177,"stargazers_count":3,"open_issues_count":24,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T07:22:27.156Z","etag":null,"topics":["bower","cli","composer","deploy","grunt","php","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sokil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-05T20:27:40.000Z","updated_at":"2018-01-10T19:05:38.000Z","dependencies_parsed_at":"2022-08-24T14:00:25.648Z","dependency_job_id":null,"html_url":"https://github.com/sokil/DeployBundle","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2FDeployBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2FDeployBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2FDeployBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sokil%2FDeployBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sokil","download_url":"https://codeload.github.com/sokil/DeployBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250572638,"owners_count":21452334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bower","cli","composer","deploy","grunt","php","symfony","symfony-bundle"],"created_at":"2024-10-02T23:02:24.978Z","updated_at":"2025-04-24T05:33:04.553Z","avatar_url":"https://github.com/sokil.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"DeployBundle\n============\n\nTask runner for Symfony project\n\n[![Latest Stable Version](https://poser.pugx.org/sokil/deploy-bundle/v/stable.png)](https://packagist.org/packages/sokil/deploy-bundle)\n[![Total Downloads](http://img.shields.io/packagist/dt/sokil/deploy-bundle.svg)](https://packagist.org/packages/sokil/deploy-bundle)\n[![Build Status](https://travis-ci.org/sokil/DeployBundle.png?branch=master\u00261)](https://travis-ci.org/sokil/DeployBundle)\n[![Coverage Status](https://coveralls.io/repos/github/sokil/DeployBundle/badge.svg?branch=master)](https://coveralls.io/github/sokil/DeployBundle?branch=master)\n\n* [Installation](#installation)\n* [Configuration](#configuration)\n* [Tasks](#tasks)\n  * [Git](#git)\n    * [Configuring git task](#configuring-git-task)\n    * [Private repositories](#private-repositories)\n  * [Npm](#npm)\n  * [Webpack](#webpack)\n  * [Bower](#bower)\n  * [Grunt](#grunt)\n  * [Migrations](#migrations)\n  * [Install Assets](#install-assets)\n  * [Dump Assetic](#dump-assetic)\n  * [Composer](#composer)\n  * [Clear cache](#clear-cache)\n  * [Sync](#sync)\n  * [Writting own tasks](#writting-own-tasks)\n\n\n# Installation\n\nAdd Composer dependency:\n```\ncomposer.phar require sokil/deploy-bundle\n```\n\nAdd bundle to your `AppKernel`:\n\n```php\n\u003c?php\n\nclass AppKernel extends Kernel\n{\n    public function registerBundles()\n    {\n        $bundles = array(\n            new Sokil\\DeployBundle\\DeployBundle(),\n        );\n    }\n}\n```\n\n# Configuration\n\nConfigure tasks required to run in your app in `app/config/config.yml`:\n\n```yaml\ndeploy:\n  config:\n    git: {}\n    composer: {}\n    npm: {}\n    bower: {}\n    grunt: {}\n    asseticDump: {}\n    assetsInstall: {}\n  tasks:\n    updateBack: [git, composer]\n    updateFront: [npm, bower]\n    compileAssets: [grunt, asseticDump, assetsInstall]\n    release: [updateBack, updateFront, compileAssets]\n```\n\nSection `config` declared options of every task, able to run. \nSection `tasks` declares bundles of tasks, which run sequentially.\nTasks may be run by defining task aliases in cli command:\n\n```\n$ ./app/console deploy --git --npm\n```\n\nAlso tasks bundles may be defined:\n```\n$ ./app/console deploy --compileAssets\n```\n\nIf no task specified then `default` task bundle will be run. This task \nbundle may be defined in configuration, but if it omitted, \nthen default task consists of all tasks in order of `config` section.\nTasks and task bundles both may be specified in cli options, then tasks \nwill be run in order of first occurrence. Task bundle also may contain \nother bundles.\n\nTo get list of all configured tasks run:\n```\n$ ./bin/console deploy --env=prod -h\nUsage:\n  deploy [options]\n\nOptions:\n      --composer                   Update composer dependencies\n      --composer-update            Update dependencies instead of install it\n      --migrate                    Migrate datbase\n      --npm                        Updating npm dependencies\n      --bower                      Updating bower dependencies\n      --grunt                      Run grunt tasks in bundles\n      --grunt-tasks[=GRUNT-TASKS]  List of bundles with specified grunt tasks, e.g. \"bundle1Name:task1Name,task2Name;bundle2Name;\"\n      --asseticDump                Dump assetic assets\n      --assetsInstall              Install bundle assets\n      --clearCache                 Clear cache\n      --updateFront                Task bundle for tasks \"npm\",\"bower\"\n      --compileAssets              Task bundle for tasks \"grunt\",\"asseticDump\",\"assetsInstall\",\"clearCache\"\n      --release                    Task bundle for tasks \"composer\",\"migrate\",\"updateFront\",\"compileAssets\"\n      --default                    Task bundle for tasks \"composer\",\"migrate\",\"npm\",\"bower\",\"grunt\",\"asseticDump\",\"assetsInstall\",\"clearCache\"\n```\n\n# Tasks\n\n* [Git](#git)\n* [Npm](#npm)\n* [Webpack](#webpack)\n* [Bower](#bower)\n* [Grunt](#grunt)\n* [Migrations](#migrations)\n* [Install Assets](#install-assets)\n* [Dump Assetic](#dump-assetic)\n* [Composer](#composer)\n* [Writing own tasks](#writting-own-tasks)\n\n## Git\n\n### Configuring git task\n\nAdd configuration to your `./app/config/config.yml`:\n\n```yaml\ndeploy:\n  config:\n    git:\n        defaultRemote: origin       # Optional. Default: origin. Set default remote for all repos\n        defaultBranch: master       # Optional. Default: master. Set default branch for all repos\n        repos:                      # List of repos\n          core:                     # Alias of repo\n            path: /var/www/project  # Path to repo\n            remote: origin          # Optional. Default: origin. Set remote for this repo\n            branch: master          # Optional. Default: master. Set branch for this repo\n            tag: false              # Tag release after pull\n```\n\n### Private repositories\n\nIf repository is private, password will be asked on pull:\n\n```\nPermission denied (publickey).\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n```\n\nFor example web server started under www-data user. To prevent asking password, \nadd ssh keys to `/home/$USER/.ssh` directory, using ssh key generation tool. \n\n1) Generate keys: \n\n```\n$ sudo -u www-data ssh-keygen -t rsa\nGenerating public/private rsa key pair.\nEnter file in which to save the key (/home/www-data/.ssh/id_rsa): \nEnter passphrase (empty for no passphrase): \nEnter same passphrase again: \nYour identification has been saved in /home/www-data/.ssh/id_rsa.\nYour public key has been saved in /home/www-data/.ssh/id_rsa.pub.\nThe key fingerprint is:\n...\n```\n\n2) Add public key to your repository to fetch changes without password prompt.\n\n3) Test your connection:\n```\n$ sudo -H -u www-data git pull origin master\n```\n\nFind out who use this key already:\n```\nssh -T git@github.com\nssh -T git@bitbucket.com\n```\n\n## Webpack\n\nYou can optionally specify path to webpack  in `pathToWebpack` parameter. If omitted , then `webpack` will be used.\nIn this case webpack must be installed globally.\n\n```yaml\ndeploy:\n  config:\n    webpack:\n      pathToWebpack: assets/node_modules/.bin/webpack # (Optional) Path to webpack\n      projects: # list of webpack projects with own webpack.config.js inside\n        assets:\n          config: \"assets/webpack.config.js\" # (required) path to config. Context will be set to dirname of config.\n          progress: true # (optional) Show build progress\n          p: true # (optional) Build for production. For \"prod\" environment defined automatically\n          ...\n```\n\nThis will run command, where `context` value is dirname of config in parameters `config`:\n```\nassets/node_modules/.bin/webpack --config assets/webpack.config.js -p --progress --context assets\n```\n\n## Npm\n\n```yaml\ndeploy:\n  config:\n    npm:\n      dirs: # Optional list of dirs to search package.json and install dependencies\n        - \"assets\"\n      bundles: # Optional list of bundles where to search package.json\n        SomeBundle: true\n        SomeOtherBundle:\n           package: ../ # path to project.json, relative to SomeOtherBundle.php file\n```\n\n## Bower\n\n```yaml\ndeploy:\n  config:\n    bower:\n      bundles:\n        SomeBundle: true\n        SomeOtherBundle: true\n```\n\n## Grunt\n\nAdd task configuration to your deploy config:\n\n```yaml\ndeploy:\n  config:\n    grunt:\n      bundles: # bundles where grunt need to be run\n        SomeBundle1: true\n        SomeBundle2:\n          tasks: [task1, task2, task3]\n          gruntfile: ../ # dir with Gruntfile.js, relatively to SomeBundle2.php\n            \n      parallel: true # run grunts from all bundles in parallel. Default: false\n```\n\nGrunt may have few tasks, and you can select which tasks to run.\n\nIn config:\n\n\n```yaml\ndeploy:\n  config:\n    grunt:\n      bundles:\n        SomeBundle:\n          tasks:\n            - newer:less \n            - newer:jade\n        SomeOtherBundle: true\n      parallel: true\n```\n\nAs CLI parameter:\n```\n./app/console deploy --grunt --grunt-tasks=\"SomeBundle=newer:less,newer:jade\u0026SomeOtherBundle\"\n```\n\n## Migrations\n\nAdd dependency:\n```\ncomposer.phar require doctrine/migrations\ncomposer.phar require doctrine/doctrine-migrations-bundle\n```\n\nRegister bundler in `AppKerner`:\n```php\nnew Doctrine\\Bundle\\MigrationsBundle\\DoctrineMigrationsBundle(),\n```\n\nFirst, configure migrations in `./app/config/config.yml`:\n\n```yaml\ndoctrine_migrations:\n    dir_name: %kernel.root_dir%/migrations\n    namespace: Migrations\n    table_name: migrations\n    name: Application Migrations\n```\n\nThen add task to deploy config in `./app/config/config.yml`:\n\n```yaml\ndeploy:\n  config:\n    migrate: {}\n```\n\n## Install Assets\n\nThen add task to deploy config in `./app/config/config.yml`:\n\n```yaml\ndeploy:\n  config:\n    assetsInstall: {}\n```\n\n## Dump Assetic\n\nThen add task to deploy config in `./app/config/config.yml`:\n\n```yaml\ndeploy:\n  config:\n    asseticDump: {}\n```\n\nBundles with Assetic assets must be defined in `./app/config/config.yml`:\n\n```yaml\nassetic:\n  bundles:\n    - AcmeBundle\n```\n\n## Composer\n\nThis task will run composer command:\n```\ncomposer.phar install --optimize-autoloader --no-interaction\n```\n\nFile `composer.phar` must be in path, or you can redefine path to composer by param `path`.\n\nAdd task config to `./app/config/config.yml`:\n\n```yaml\ndeploy:\n  config:\n    composer:\n      scripts: true # set true if you want to execute scripts. Default: true\n      update: true # Optional. If passed, update dependencied instead on install\n      path: composer.phar # Optiona. Default: composer.phar, specify path to composer\n```\n\n## Clear cache\n\n```yaml\ndeploy:\n  config:\n    clearCache: {}\n```\n\n## Sync\n\nTask userd to sync data to production servers. Add configuration:\n```yaml\ndeploy:\n  config:\n    parallel: 3\n    rules:\n      web:\n        src: '.'\n        dest:\n          - user@www1.server.com://var/www/some\n          - user@www2.server.com://var/www/some\n        delete: true\n        verbose: true\n        exclude:\n          - /var\n          - /app/conf/nginx/\n          - /.idea\n          - /app/config/parameters.yml\n        include:\n          - /app/conf/nginx/*.conf.sample\n```\n\nParameter `rules` define rules to sync files from source to destination.\nMay be configured any number of rules. Every rule consists of parameter\n`src` (defaults to \".\"), parameter `dest` which may be string or array of hosts.\nOther rule parameters same to `rsync` options. See man page of `rsync`\nto find description of this options.\n\n## Writing own tasks\n\nFirst, create task class which extends `Sokil\\DeployBundle\\Task\\AbstractTask`. Then add Symfony's service definition:\n\n```yaml\nacme.deploy.my_task:\n  class: Acme\\Deploy\\Task\\MyTask\n  abstract: true\n  public: false\n  tags:\n    - {name: \"deploy.task\", alias: \"myTask\"}\n```\n\nThis service must contain tag with name `deploy.task` and alias, which will be used as CLI command's option name and configuration section name.\n\nThen, you may add it to bundle's configuration in `app/config/config.yml` to `deploy` section in proper place of order, if you want it to be run automatically:\n\n```yaml\ndeploy:\n  config:\n    git: {}\n    grunt: {}\n    myTask: {}\n```\n\nNow, your task will be calld third after `git` and `grunt` by calling `deploy` command without arguments:\n```\n$ ./app/console deploy --env=prod\n```\n\nYou also may call your task directly from console:\n\n```\n$ ./app/console deploy --myTask\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsokil%2Fdeploybundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsokil%2Fdeploybundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsokil%2Fdeploybundle/lists"}