samdark / yii2-cookbook

Yii 2.0 Community Cookbook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Request] Deploying simultaneously to multiple servers

iadj opened this issue · comments

commented

Currently scaling.md (https://github.com/samdark/yii2-cookbook/blob/master/book/scaling.md) describes a quick and dirty method for keeping multiple servers in sync with a master branch.

A more clean & efficient method would be having a separate consistent server that acts as a webhook service. A git service like GitHub or BitBucket would send a POST request to the webhook service, and the webhook service would execute a script (ideally PHP for the sake of consistency with the guide) that lists all servers in an autoscaling group (i.e. Google Cloud Instance Groups), SSH into each of those servers, and call a 'git pull' and 'composer update' command on each of the servers.

2 PHP example scripts (one for Google Cloud Instance Groups and one for AWS) that display how to achieve this goal would be perfect. Could go in a repo so users can add additional examples for different services.