Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hpatoio/deploybundle
Porting of Symfony 1.4 project:deploy command to Symfony 2
https://github.com/hpatoio/deploybundle
deploy symfony-bundle
Last synced: about 14 hours ago
JSON representation
Porting of Symfony 1.4 project:deploy command to Symfony 2
- Host: GitHub
- URL: https://github.com/hpatoio/deploybundle
- Owner: hpatoio
- Created: 2012-03-19T08:52:54.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2019-12-17T12:57:54.000Z (almost 5 years ago)
- Last Synced: 2024-10-20T23:11:40.490Z (19 days ago)
- Topics: deploy, symfony-bundle
- Language: PHP
- Homepage:
- Size: 56.6 KB
- Stars: 34
- Watchers: 3
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
DeployBundle
=================[![Total Downloads](https://poser.pugx.org/hpatoio/deploy-bundle/downloads.png)](https://packagist.org/packages/hpatoio/deploy-bundle)
[![Latest Stable Version](https://poser.pugx.org/hpatoio/deploy-bundle/v/stable.png)](https://packagist.org/packages/hpatoio/deploy-bundle)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/b4556cd7-652f-4a58-9126-eb2c1abd6c89/mini.png)](https://insight.sensiolabs.com/projects/b4556cd7-652f-4a58-9126-eb2c1abd6c89)## Installation
Run the command:```bash
$ composer require hpatoio/deploy-bundle ~1.5
```**N.B.** This project follow [semantic versioning](http://semver.org/). Latest stable branch is `1.5`.
### Enable the bundle in your project
```php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Hpatoio\DeployBundle\DeployBundle(),
// ...
);
}
```
## Configuration
Configuration is all about defining environments. You can define as many environments as you want, the only mandatory value is `host`. The deploy is made via rsync so default value are used if none are specified.
Remember that to get the configuration reference for this bundle you can run:
```bash
bin/console config:dump-reference DeployBundle
```Configuration example:
```yaml
# app/config/config.yml
deploy:
prod:
rsync-options: '-azC --force --delete --progress -h --checksum'
host: my.destination.env
dir: /path/to/project/root
user: root
port: 22
timeout: 120 # Connection timeout in seconds. 0 for no timeout.
uat:
host: 192.168.1.10
user: root2
dir: /path/to/project/root
port: 22022
post_deploy_operations:
- bin/console cache:clear --env=prod
- bin/console assets:install --env=prod
- bin/console assetic:dump --env=prod
```Most of the keys don't need explanation except:
#### post_deploy_operations
You can add a list of command you want run on the remote server after the deploy. In the configuration above you can see the common command you run after a deploy (clear the cache, publish assets etc)
These commands are run as a shell command on the remote server. So you can enter whichever shell command you want (cp, rm etc)Please don't confuse Symfony environment with deploy environment. As you can see in the configuration above we run `post_deploy_operations` for Symfony environment `prod` on deploy environment `uat`
#### rsync-options
If you add the key `rsync-options` to your environment you will override the default options used for rsync. So the system is using:* "-azC --force --delete --progress -h --checksum" if nothing is specified
* the value for the key `rsync-options` if specified it in `config.yml` for the target environment
* the value of the command line option `--rsync-options`### Rsync Exclude
Create a `rsync_exclude.txt` file under `app/config` to exclude files from deploy. [here](https://github.com/hpatoio/DeployBundle/blob/master/.rsync_exclude.txt.dist) a good starting point.You can also create a per-environment rsync_exclude. Just create a file in `app/config` with name `rsync_exclude_{env}.txt`. For more details you can read here #3 and here #7
## Force vendor syncronization
Usually `vendor` dir is excluded from rsync. If you need tou sync it you can add `--force-vendor`. (see later for an example)## Use
Deployment is easy:
```shell
php bin/console project:deploy --go prod
```
Feel a bit unsure ? Simulate the deploy
```shell
php bin/console project:deploy prod
```
Need to update vendor ? Use the option --force-vendor (Usually vendor is excluded from rsync)
```shell
php bin/console project:deploy --go --force-vendor prod
```
Custom parameters for rsync
```shell
php bin/console project:deploy --rsync-options="-azChdl" prod
```
License
-------------
DeployBundle is licensed under the CC-BY-SA-3.0 - see [here](http://www.spdx.org/licenses/CC-BY-SA-3.0) for details