Sharing is caring

Here is where we like to share our knowledge with you

Deployer is a great tool we used in our last ongoing project in Symfony 3.3, php7.1, MariaDB, github.

Development of customer portal requires a continuous deployment to staging and production according to Lean Development approach. Crucial part was security issue and regulations.

Deployer written in PHP with wide amount of recipes including Symfony3. The code of the tool is really clean and understandable. Easy and straightforward configuration in nomad style buys you off the moment you dive into API.

Documentation at this moment good enough if you are not required to do stuff out of the box.In other way – open the code and look like other tasks are implemented. No judgment, cause developer has done a great job and tool still in the state of forming.

check it here

The only issue I’ve faced – symlinks. Cause NGINX/php-fpm are not really happy with symlinks. So we have added extra task on after deployment:

task('nginx:reload', function () {
    run('service nginx reload');
    run('service php7.1-fpm restart');
})->desc('reload nginx for symlink to current');
after('deploy:unlock', 'nginx:reload');

But it is not all. On every deployment staging or production it is great to have a reference point in repository. Tag with a date, time, deployment number and deployment type would be good enough. Automating this part would be great! With deployer life is really easy, just a couple of lines we have wrote and we were done! Chill!

And the task code itself:

task('git:tag', function () {
    $git = get('bin/git');

    $release = get('release_name');
    $date = run('date +"%Y%m%d%H%M%S"');
    $stage = get('stage');

    $releaseTag = $stage . '.' . $release . '.' . $date;
    run("cd {{release_path}} && $git tag $releaseTag");
    run("cd {{release_path}} && $git push origin --tags");
})->desc('Adding new deployment tags to repo');
// run automatically in the end of deployment process
after('deploy:unlock', 'git:tag');

Link to github example gist:

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!