PHPackages                             totallydave/auto-deploy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. totallydave/auto-deploy

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

totallydave/auto-deploy
=======================

Auto deployment module for Zend Framework 2

0.0.11(10y ago)099MITPHPPHP &gt;=5.4.0

Since Jan 12Pushed 10y ago1 watchersCompare

[ Source](https://github.com/totallydave/auto-deploy)[ Packagist](https://packagist.org/packages/totallydave/auto-deploy)[ Docs](https://github.com/totallydave/AutoDeploy)[ RSS](/packages/totallydave-auto-deploy/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (14)Used By (0)

What is AutoDeploy?
===================

[](#what-is-autodeploy)

AutoDeploy is framework agnostic auto deployment application with added support as a *ZF2*-Module which provides a service to auto deploy code utilising web hooks from VCS providers.

AutoDeploy is still in development

\##Available services

- Vcs (Git)
- Dm - Dependency Manager (Composer)
- Db - Database Migrations (Executing MySql migration file/s)

\###Notes

- Dm and Db services depend on a Vcs service
- Db service will be run last
- Db migration files must begin with '\_auto\_deploy\_' this allows them to be ommitted from auto deployment
- An error on the Db service will roll the other services back so it's important Vcs is run first (@todo force this)
- An email log will be sent to any commiters in the update
- If logging is enables a log will be written to the file system

Installation
------------

[](#installation)

```
composer require totallydave/auto-deploy dev-master

```

Add the below to the top of your index.php or web root php file

```
define('APPLICATION_ROOT', realpath(dirname(__DIR__)));

```

### ZF2 CONFIGURATION

[](#zf2-configuration)

Create an auto\_deploy.php and place in config/autoload by running the below

```
cp vendor/totallydave/auto-deploy/config/module.config.php config/autoload/auto_deploy.php

```

Update the default configuration as you need (below is the minimum you'll need to get up and running)

```
 ...

 'application' => [
     'email' => [
         'allowedDevEmailDomains' => [
             [YOUR EMAIL DOMAIN] // use regex pattern e.g. 'github\.com' for foo@github.com
         ],
     ]
 ],

  ...

 'auto_deploy' => [
     'services' => [
         'vcs' => [
             'originUrl' => '[GIT REPOSITORY URL]' // This is the git branch that you wish to auto deploy
         ],

         ...

         'dm' => [
             'name' => '[COMPOSER PACKAGE NAME]' // This is required to identify the correct composer.json file
         ],

        ...

         'db' => [
             'type' => 'mysql',

              // This is where the db migration files are kept relative to the vcs root
              // migration files will only be applied if they start with '_auto_deploy_' - this is
              // to allow you the flexibility to pick and choose when auto db migration is applied
              // as it is not advised to use this feature for any heavy lifting
             'migrationDir' => '[MIGRATION FILE DIRECTORY]',

             // This is where the backup taken prior to a db migration are kept relative to the vcs root
             // make sure this directory is excluded from version control
             'backupDir' => '[MIGRATION BACKUP DIRECTORY]',

             // the below is required to perform db migrations - this is the target db
             'connection' => [
                 'hostname' => '[DB HOST]',
                 'username' => '[DB USERNAME]',
                 'password' => '[DB PASSWORD]',
                 'database' => '[DB NAME]'
             ],
             // the below is required to perform db migrations - multiple databases can be backed up if required
             'backup_connections' => [[
                 'hostname' => '[DB HOST]',
                 'username' => '[DB USERNAME]',
                 'password' => '[DB PASSWORD]',
                 'database' => '[DB NAME]'
             ]],
         ],

         ...
     ],

      // This is a list of white-listed IP addresses for the modules internal firewall
     'ipAddresses' => [
          [GIT SERVER PROVIDER IP]
     ],
  ]

 ...

```

Add 'AutoDeploy' to your registered modules in application.config.php

```
return array(
    'modules' => array(
        // other modules
        ...

        'AutoDeploy'

        ...
    ),
    // other content
);

```

### GENERAL CONFIGURATION (NOT ZF2)

[](#general-configuration-not-zf2)

Create an auto\_deploy.php somewhere outside your web root in the following example I will be using 'config/auto\_deploy.php' relative to the project root

```
cp vendor/totallydave/auto-deploy/config/generic.config.php config/auto_deploy.php

```

Replace the values in \[\] below - i.e. \[GIT BRANCH\]

```
