This script deploys SilverStripe based sites. It performs the following actions:
- Backs up current database & files
- Checks out the latest code
- Optionally updates composer & bower
- Synchronises the current site with the newly checked out code
- Synchronises the databases
./deployscript.sh [options]
-S Site Root - Path to the root (parent of the public directory) of the site. -v Verbose - log all output -m Mode - indicates whether we run bower & composer - 1 for "Lite" mode; 2 for "Full" mode -b Branch - the branch to deploy from -e Environment - The SilverStripe environment (e.g. "dev" or "live") -h Help - Display this help -i Non-interactive - Allow script to execute without waiting at each step. -t Theme - Theme to use when running bower -c Config - json file with default settings
Using a config file overrides all settings. Asking for the help prints out the description & usage & exits.
This is intended to run on a Linux environment. This has been tested with:
- Ubuntu 14.04
The following packages will need to be installed:
- realpath
- basename
- git
- composer
- bower
- mysqldump
- tar
- rsync
- php 5.6+
- MySQL
- Apache (nginx is not supported currently)
- jq (https://stedolan.github.io/jq/)
The options that are passed into the CLI, may also be provided by an optional ison file. For example:
{
"apache_version": 2.4,
"environment": "dev",
"interactive": "true",
"root": "/var/www/silverstripe.domain",
"mysql": {
"host": "localhost",
"database_name": "ss_deployment",
"username": "silverstripe",
"password": "password"
},
"paths": {
"htdocs": "htdocs",
"versions": "versions",
"repo": "repo",
"sql_dumps": "sql-dumps",
"themes": "themes"
},
"default": {
"mode": 1,
"branch": "master",
"theme": "default"
},
"services": {
"bower": true,
"composer": true
}
}
apache_version - a simple string indicating the major release (i.e. 2.4 not 2.4.7)
root - root directory of the site (parent level of public directory - e.g. /var/www/hostname - not /var/www/hostname/htdocs). Ensure there is no trailing slash
The recommended way to install this is the following:
cd /user/lcoal/bin
git clone git@github.com:salted-herring/deployment-scripts.git ss-deployment
ln -s ss-deployment/deployment-script.sh ssdeploy
You should then be able to run this whereever you want - e.g. ssdeploy -c ./jsonpath