dep deploy stage=uat
dep deploy stage=uat --branch=master
dep deploy stage=prod --tag=1.0.1
dep sitehost:prepare
dep sitehost:prepare:deploy stage=uat --branch=master
dep sitehost:backup
dep savefromremote:latest
dep savefromremote
dep savefromremote:db
dep savefromremote:assets
dep savefromremote:logs
dep loadtoremote:assets
To keep normal set up - add to your docker file environment
- DEPLOYER_VERSION=6.8.0
-
Make sure you are running the latest docker image (you can pull this from inside docker desktop). deployer 7 currently works with 8.1 and 8.0 docker images.
-
Install the new module
composer require --dev PlasticStudio/ps-deployerthis now contains all the tasks that were present in the old deploy.php -
Rename your
deploy.phptodeploy-backup.php -
Create new
deploy.phpand add below new code all.<?php namespace Deployer; require 'vendor/plasticstudio/ps-deployer/ps_silverstripe.php'; //Legacy deployer v6 path to use //set('current_path', '/container/application/current'); set('repository', '[email protected]:PlasticStudio/skeletor.git'); set('remote_assets_backup_path', '/container/backups/containers/latest/application/shared/public/assets'); //no trailing slash is important set('remote_assets_path', '/container/application/shared/public/assets/'); set('local_assets_path', '/var/www/html/public/assets/'); //Staging host('uat.domain.co.nz') ->set('labels', ['stage' => 'uat']) ->set('http_user', 'uatuser') ->set('remote_user', 'uatuser'); //Production host('production.domain.co.nz') ->set('labels', ['stage' => 'prod']) ->set('http_user', 'produser') ->set('remote_user', 'uatuser'); -
Open files side by side copying across all site specific variables such as user, host, and files paths
-
After copying you can now delete your old
deploy-backup.php -
NEW CONTAINER: If this is a new container then we will need to prepare sitehost
dep sitehost:prepareThis will delete public folder and have it ready for symlink Set up ssh key for you to copy Set up php default configEXISITING CONTAINER: If this is an existing container then we will need to prepare sitehost. You will want to keep the current path for deploying. Uncomment the below line in your deploy.php file.
//set('current_path', '/container/application/current');UPGRADING CONTAINER: todo
-
If this is an existing container then the final thing we will need to do is on your FIRST deployment, deploy by release_name. This will be the current release +1. To find our the current release, ssh into the container and check the releases folder.
dep deploy stage=uat --branch=master -o release_name=43
composer require PlasticStudio/ps-deployer
Create a new deploy.php file with the following contents and update where required:
<?php
namespace Deployer;
require 'vendor/plasticstudio/ps-deployer/ps_silverstripe.php';
//Legacy deployer v6 path to use
//set('current_path', '/container/application/current');
set('repository', '[email protected]:PlasticStudio/skeletor.git');
set('remote_assets_backup_path', '/container/backups/containers/latest/application/shared/public/assets'); //no trailing slash is important
set('remote_assets_path', '/container/application/shared/public/assets/');
set('local_assets_path', '/var/www/html/public/assets/');
//Staging
host('uat.domain.co.nz')
->set('labels', ['stage' => 'uat'])
->set('http_user', 'uatuser')
->set('remote_user', 'uatuser')
->set('sitehost_server_name', 'ch-xxx')
->set('sitehost_stack_name', 'xxxxxxxxx')
->set('sitehost_restart_mode', 'apache-php'); //Optional
//Production
host('production.domain.co.nz')
->set('labels', ['stage' => 'prod'])
->set('http_user', 'produser')
->set('remote_user', 'uatuser');
todo follow guru card to set up, then you can run this command - this only needs to be run once
dep sitehost:prepare
This will:
- Delete public directory which is created on first creation of a Sitehost server, so we can use this path as a symlink
- Generates ssh key which you can copy to deployment keys on github project
- Create php default config
If you are doing a container upgrade on Sitehost then you will want to run this command immediately after
dep sitehost:prepare:deploy stage=uat --branch=master
This will update the config to the defaults and fix the symlink
It’s as easy as dep deploy. This will give you the option of which host to deploy to and will get current git HEAD to deploy.
dep deploy stage=uat
# Deploy the dev branch
dep deploy stage=uat --branch=master
# Deploy tag 1.0.1 to production
dep deploy stage=prod --tag=1.0.1
Make sure your deployer.php paths are set up correctly
Make a new backup, then save both db and assets from remote
dep savefromremote:latest
Save both db and assets from remote
dep savefromremote
Saves the most recent backup i.e. previous nights DB
dep savefromremote:db
Saves the most recent backup i.e. previous nights Assets
dep savefromremote:assets
Makes a temporary copy of current live assets, rolls back to this if there is a transfer issue.
loadtoremote:assets
Whenever you deploy to sitehost, it will update teh symlink, apache needs to be restarted in order for this to take effect.
All deployments run sitehost:restart which will restart the container.
A new option which is better is to set the sitehost_restart_mode to apache-php in your deploy.php file. This will restart the apache and php only and not the whole container.
This is only available on certain containers.
->set('sitehost_restart_mode', 'apache-php');
Deployer comes with ps docker image.
make sure to include - ~/.ssh:/tmp/.ssh:ro as a mounted volume in the docker-compose.yml
Keep old version of