Download the PHP package yidas/deployer-php-cli without Composer

On this page you can find all versions of the php package yidas/deployer-php-cli. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package deployer-php-cli

Deployer PHP-CLI

CI/CD Deployment tool written in PHP supported for popular frameworks

Latest Stable Version License

FEATURES

Helping developers to deploy codes from local instance to remote instances.


OUTLINE


DEMONSTRATION

Basic Flow

Command Line

Deploy local project to remote servers by just executing the deployer in command after installation:

Alternatively, you could call the original bootstrap: $ ./deployer, $ php ./deployer

The interactive result could like be:

Or you could run by non-interactive mode with the same purpose:


REQUIREMENTS

This library requires the following:


INSTALLATION

Composer Installation

Using Composer by sudoer or root to install is the easiest way with auto-installer:

Wget Installation

You could see Release for picking up the package with version, for example:

After download, uncompress the package:

In addition, you can rename the unzipped folder by mkdir deployer-php-cli && tar -zxvf deployer-php-cli.tar.gz --strip-components 1 -C deployer-php-cli

Make Command

To make a command for deployer, if the package folder is deployer-php-cli then create a symbol by following command:

Startup

After installation, you could start to set up the config.inc.php for deployer, and enjoy to use:

Upgrade

To upgrade, you could re-install the deployer and copy the old config.inc.php to the new one, for example:


CONFIGURATION

Project Setting:

You need to set up the projects configuration such as servers, source and destination in config.inc.php file:

You could refer config.inc.php file as an example..

Config Options:

Configuration provides many features' setting, you could customize and pick up the setting you need.

Key Type Description
servers array Distant server host list
user array|string Local/Remote server user, auto detect current user if empty
source string Local directory for deploy, use / as end means *
destination string Remote path for synchronism
exclude array Excluded files based on sourceFile path
verbose bool Enable verbose with more infomation or not

Git

To use Git into deploy task, you need to init or clone Git to the source directory at the first time:

Key Type Description
enabled bool Enable git or not
checkout bool Execute git checkout -- . before git pull
branch string Branch name for git pull, pull default branch if empty
submodule bool Git submodule enabled

Composer

To use Composer into deploy task, make sure that there are composer files in the source directory.

Key Type Description
enabled bool Enable Composer or not
path string Composer executing relative path which supports multiple array paths
command string Update command likes composer update

Test

To use Test into deploy task, make sure that there are test configuration in the source directory.

Key Type Description
enabled bool Enable Test or not
name string The test name for display
type string Test type, support phpunit.
command string The test bootstrap command supported relative filepath such as ./vendor/bin/phpunit
configuration string The test configuration file supported relative filepath such as ./phpunit.xml

Tests

For multiple test tasks, using array to declare each test options:

Rsync

Key Type Description
enabled bool Enable rsync or not
params string Addition params of rsync command
timeout int Timeout seconds of each rsync connections
sleepSeconds int Seconds waiting of each rsync connections
identityFile string Identity file path for appling rsync

Commands

Commands provides you to customize deploy tasks with many trigger hooks.

Key Type Description
init array Addition commands triggered at initialization
before array Addition commands triggered before deploying
after array Addition commands triggered after deploying

Example


USAGE

Interactive Project Select

Non-Interactive Project Select

Skip Flows

You could force to skip flows such as Git and Composer even when you enable then in config.

Revert & Reset back

You could reset git to specified commit by using --git-reset option when you get trouble after newest release.

This option is same as executing git reset --hard 79616d in source project.


IMPLEMENTATION

Assuming project1 is the developing project which you want to deploy.

Developers must has their own site to develop, for example:

In general, you would has stage project1 which the files are same as production:

The purpose is that production files need to be synchronous from stage:

This tool regard stage project as source, which means production refers to destination, so the config file could like:

After running this tool to deploy project1, the stage project's files would execute processes likes git pull then synchronise to production.

Permissions Handling

1. Local and Remote Users

You could create a user on local for runing Deployer with umask 002. It will run process by the local user you set even you run Deployer by root:

2. Application File Permissions

Deployer uses rsync to deploy local source project to remote without --no-perms, which means that the source files' permission would keep on remote, but the files' owner would re-generate by remote user including root with --no-owner --no-group.

On the remote user, you could set the user's default groud ID to www-data in /etc/passwd, which the local user generates 664/775 mod files to deploy for remote www-data access.

For local user, umask 002 could be set in ~/.bashrc or global. Note that the permission need to apply for source files such as init from Git clone.


CI/CD

Webhook

Deployer provides webhook feature for triggering project deployment by any webhook service such as Gitlab.

To use webhook, you need add webhook setting into the projects you needed in config.inc.php:

Key Type Description
enabled bool Enable Webhook or not
provider string Webhook provider such as gitlab
project string Provider's project name likes username/project
token string Webhook secret token
branch string Listening branch for push event
log bool|string Enabled log and specify the log file

PHP Web Setting

Deployer need a user to excute deployment, and the user is usually not the PHP web user.

For PHP-FPM, you could add a new PHP pool socket with the current user setting for the webhook site, for example /etc/php/fpm/pool.d/deployer.conf:

Then give the new socket to the webhook server setting, for Nginx eaxmple /etc/nginx/site-enabled/webhook:

After a successful webhook, Deployer would prepare to process while responding the status and the result url for checking the deployment result.

Note: The PATH environment variable between Shell and PHP should be set to the same to prevent any unexpected problems.

Gitlab

According to above Nginx website setting, the webhook URL could be https://webhook.your.com/gitlab. After setting config.inc.php and setting up scecret token, you could give a push event to go!

Note: Default setting is listen release branch's push event to trigger.

To browse the web page for result log report, enter the same webhook URL with log and token parameters to access. For example: https://webhook.your.com/gitlab?log={project-name}&token={project-token}


ADDITIONS

Rsync without Password:

You can put your local user's SSH public key to destination server user for authorization.

Save Binary Encode File:

While excuting script, if you get the error like Exception: Zend Extension ./deployer does not exist, you may save the script file with binary encode, which could done by using vim:

Yii2 Deployment

For yii2-app-advanced, you need to enable Composer and set yii2 init command in config.inc.php:

Minify/Uglify by Gulp

1. Install NPM, for Debian/Ubuntu:

2. Install Gulp by NPM

3. Create Gulp Project

4. Set Gulp with packages

Package: gulp-uglify

gulpfile.js:

5. Set Gulp Process into Deployer


All versions of deployer-php-cli with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yidas/deployer-php-cli contains the following files

Loading the files please wait ....