index.md
One-liner deployment like ./vendor/bin/dep deploy
and your current Git-repo makes it into a release on your server and creates a DB-dump. You also can ./vendor/bin/dep rollback
or have multiple stages whatsoever. It's suits for collaboration, since you deploy a git-repo and the deployment-script comes as dev-dependency per composer.
You need the same PHP Version on HTTP & CLI on both your development-machine and the server you deploy to. Furthermore shell-access to your server is needed and git must be available.
You'll need to install deployer either globally or with composer in the project: https://deployer.org/docs/installation
composer require deployer/deployer
The deploy.php recipe assumes, that you have a dev-deploy
folder in your project-folder and deploy.php in your project root-folder.
dev-deploy
must contain an .htaccess
and _ss_environment.php
, prefixed with the server_name for example live
, it should be deployed to. So those files are specific for each server you define. The ones in assets not.
live.htaccess
(required): The .htaccess file that will be copied to the live server.live_ss_environment.php
(required): The _ss_environement.php file that will be copied to the live server.stage.htaccess
(required): The .htaccess file that will be copied to the staging server.stage_ss_environment.php
(required): The _ss_environement.php file that will be copied to the staging server.- ./assets/.htaccess
- ./assets/web.config
Make sure you can access your server per ssh-key (without passphrase). Use forwardAgent() or add the public key of the server as a "Access keys" on e.g. Bitbucket. In addition the server needs your Git-Repo-Server in the "known_hosts". You can easily achieve this, if you manually do a "git clone ..." on the server and say "yes" when prompted. https://help.github.com/articles/connecting-to-github-with-ssh/
This recipe has some additional tasks and creates a new silverstrpe-cache with each release. ?flush becomes pointless, since it happens anyway with an empty silverstripe-cache
folder, so there is not much left compared to "dep init" except /dev/build and that's a one-liner.
https://github.com/deployphp/deployer/blob/master/recipe/silverstripe.php
These are the additional tasks that are added by the deploy.php
recipe. ./vendor/bin/dep deploy
uses them all, but you also can for example just create a dump with ./vendor/bin/dep silverstripe:dump
- silverstripe:createdirs create dumps & log directory with a path like SS_Log::add_writer(new SS_LogFileWriter('../../../log/silverstripe.log'), SS_Log::ERR);
- silverstripe:dump dump DB into dumps-dir on the server
- silverstripe:installtools install composer & sspak in ~/bin
- silverstripe:migrate Run SilverStripe /dev/build
- silverstripe:prepare uploads .htaccess, web.config to assets
- silverstripe:setup create silverstripe-cache, upload .htaccess & _ss_environment.php
- silverstripe:sspak dump DB & assets in a sspak-tarball into dumps-dir on the server
[ ] split up and sanitize tasks to make them usable for different strategies without copy/past
I've modified this on the basis of @bummzack 's, so he did on mine before. If you are looking for a SS-rsync-strategy with gulp integration, you should check (still 3.x ATM): https://gist.github.com/bummzack/b9e4a3ef0d16ab303aab66a779f92c6e