deployphp and gitlab ci

Why deployphp ?

  • easy to setup
  • has built-in recipes
  • can be installed with composer
  • custom tasks
  • it's written PHP :)

Working example

require 'recipe/symfony.php';

server('prod', 'host', 22)
    ->user('name')
    ->forwardAgent()
    ->stage('production')
    ->env('deploy_path', '/your/project/path');
set('repository', 'git@github.com:org/app.git');

Custom tasks

task('reload:php-fpm', function () {
    run('sudo /usr/sbin/service php5-fpm reload');
});

after('deploy', 'reload:php-fpm');

Why Gitlab CI ?

  • integrated
  • continuous delivery
  • flexible
  • multiple languages

Architecture

https://about.gitlab.com/images/ci/arch-1.jpg

Working example

image: sideci/ubuntu14.04-php-composer
before_script:
  - eval $(ssh-agent -s)
  - ssh-add <(echo "$CI_SSH_PRIVATE_KEY") 
deployment:
  stage: deploy
  script:
    - scripts to run
  only:
    - develop

Some extras

  • pipelines
  • merge request integration
  • shared runners

Deploying with deployphp/

By lenardpalko

Deploying with deployphp/

  • 789