2017 © Pedro Peláez
 

symfony-bundle deploy-bundle

Easy deploy via rsync. Porting of Symfony 1 project:deploy command.

image

hpatoio/deploy-bundle

Easy deploy via rsync. Porting of Symfony 1 project:deploy command.

  • Thursday, April 27, 2017
  • by hpatoio
  • Repository
  • 4 Watchers
  • 34 Stars
  • 26,762 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 15 Forks
  • 0 Open issues
  • 13 Versions
  • 4 % Grown

The README.md

DeployBundle

Total Downloads Latest Stable Version SensioLabsInsight, (*1)

Installation

Run the command:, (*2)

$ composer require hpatoio/deploy-bundle ~1.5

N.B. This project follow semantic versioning. Latest stable branch is 1.5., (*3)

Enable the bundle in your project

// 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:, (*4)

bin/console config:dump-reference DeployBundle

Configuration example:, (*5)

# 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:, (*6)

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), (*7)

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, (*8)

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:, (*9)

  • "-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 a good starting point., (*10)

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, (*11)

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), (*12)

Use

Deployment is easy:, (*13)

php bin/console project:deploy --go prod

Feel a bit unsure ? Simulate the deploy, (*14)

php bin/console project:deploy prod

Need to update vendor ? Use the option --force-vendor (Usually vendor is excluded from rsync), (*15)

php bin/console project:deploy --go --force-vendor prod

Custom parameters for rsync, (*16)

php bin/console project:deploy --rsync-options="-azChdl" prod

License

DeployBundle is licensed under the CC-BY-SA-3.0 - see here for details, (*17)

The Versions

27/04 2017

dev-master

9999999-dev http://github.com/hpatoio/DeployBundle

Easy deploy via rsync. Porting of Symfony 1 project:deploy command.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

18/02 2016

1.5.3

1.5.3.0 http://github.com/hpatoio/DeployBundle

Easy deploy via rsync. Porting of Symfony 1 project:deploy command.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

04/02 2016

dev-dev

dev-dev http://github.com/hpatoio/DeployBundle

Easy deploy via rsync. Porting of Symfony 1 project:deploy command.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

16/01 2016

1.5.1

1.5.1.0 http://github.com/hpatoio/DeployBundle

Easy deploy via rsync. Porting of Symfony 1 project:deploy command.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

16/01 2016

1.5.2

1.5.2.0 http://github.com/hpatoio/DeployBundle

Easy deploy via rsync. Porting of Symfony 1 project:deploy command.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

26/11 2014

1.5.0

1.5.0.0 http://github.com/hpatoio/DeployBundle

Easy deploy via rsync. Porting of Symfony 1 project:deploy command.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

01/09 2014

1.4.2

1.4.2.0 http://github.com/hpatoio/DeployBundle

Easy deploy via rsync. Porting of Symfony 1 project:deploy command.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

18/08 2014

1.4.1

1.4.1.0 http://github.com/hpatoio/DeployBundle

Easy deploy via rsync. Porting of Symfony 1 project:deploy command.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

11/12 2013

1.4

1.4.0.0 http://github.com/hpatoio/DeployBundle

Easy deploy via rsync. Porting of Symfony 1 project:deploy command.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

04/04 2013

1.3

1.3.0.0 http://github.com/hpatoio/DeployBundle

Brings Symfony 1.4 project:deploy command to Symfony2.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

24/12 2012

1.2

1.2.0.0 http://github.com/hpatoio/DeployBundle

Brings Symfony 1.4 project:deploy command to Symfony2.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

22/10 2012

1.1

1.1.0.0 http://github.com/hpatoio/DeployBundle

Brings Symfony 1.4 project:deploy command to Symfony2.

  Sources   Download

CC-BY-SA-3.0

The Requires

 

command deploy

12/10 2012

1.0

1.0.0.0 http://github.com/hpatoio/DeployBundle

Brings Symfony 1.4 project:deploy command to Symfony2.

  Sources   Download

GPL

The Requires

 

command deploy