Elentra Deployment
Elentra Deployment Tool v2.0.0
As of Elentra ME 1.19, the recommended deployment strategy for deploying Elentra to servers is to use a PHP-based deployment tool called Deployer. The Elentra Deployment Tool v2.0.0 recipe is based off of Deployer v6.8.0, which comes pre-installed with the Elentra Developer Docker environment and can easily be installed on host workstations or CI/CD servers.

Obtaining Elentra Deployment Tool

To obtain the standard Elentra Deployment Tool template, you can either:
    1.
    If your local elentra-developer Docker environment is up to date, then the template already exists on your computer in the ~/Documents/elentra-developers/resources/templates/deployer/v6 directory. If you're not up to date, simply pull down the latest commits from the master branch.
    2.
    Alternatively, you can always download the latest from our elentra-developer GitHub repository.

Configuration Variables

The following describes the default available deployment variables.
Variable
Description
application
Application Name (e.g.,uni-elentra-1x-me)
packagist_token
Institutional Packagist.com Composer token
repository
Branded Edition Elentra ME Git repository location
branch
The default deployment branch (e.g., master) within your Branded Edition Elentra ME Git repository. This value is always overridden by the host configuration section (if present), so it not overly important.
repository_ejs
Branded Edition Elentra JS 2.x Git repository location.
branch_ejs
The default deployment branch (e.g., master) within your Branded Edition Elentra JS Git repository. This value is always overridden by the host configuration section (if present), so it not overly important.
enable_branded_api
If you have a Branded Edition Elentra API with your implementation of Elentra then please set this to true. Default value is false.
allow_anonymous_stats
It is not recommended to change this value. Default value is false.
build_directory
Local build directory where repositories are stored before deployment. Default value is /tmp.
clear_paths
Array of files or directories removed from host(s) after deployment. Default value is www-root/setup.
default_stage
Default stage to be deployed with dep deploy. Default value is staging.
enable_restart_supervisor
Restart supervisord during the deployment process. Requires appropriate permissions. Default value is true.
exclude_paths
Exclude any files or directories in Elentra's .deployignore from deployment upload. Default value is true.
git_tty
Allocate tty for git clone. Default value is false.
keep_releases
Number of previous deployments to keep on the server. Default value is 10.

Host Configuration

For more documentation related to host configuration options, please see the Deployer Hosts documentation, which is quite extensive.

Single Server

This section illustrates a single server that has multiple Apache virtual hosts defined, which are used for both staging and production.
1
// Staging Server
2
host('elentra.med.university.edu/staging')
3
->stage('staging')
4
->user('staging')
5
->set('branch', 'uni/staging')
6
->set('branch_ejs', 'develop')
7
->set('deploy_path', '/var/www/vhosts/elentra-staging.med.university.edu')
8
->roles('app')
9
->forwardAgent();
10
11
// Production Server
12
host('elentra.med.university.edu/production')
13
->stage('production')
14
->user('production')
15
->set('branch', 'uni/production')
16
->set('branch_ejs', 'master')
17
->set('deploy_path', '/var/www/vhosts/elentra.med.university.edu')
18
->roles('app')
19
->forwardAgent();
Copied!

Single Staging Server, Multiple Production Servers

This section illustrates a single staging server and multiple separate production server hosts.
Tip: When deploying to multiple production servers, you should use the -p or --parallel flag to deploy to multiple servers at the same time: dep deploy production -p
Deployer also supports host ranges (e.g., elentra[01:05].med.university.edu).
1
// Staging Server
2
host('elentra-staging.med.university.edu')
3
->stage('staging')
4
->user('staging')
5
->set('branch', 'uni/staging')
6
->set('branch_ejs', 'develop')
7
->set('deploy_path', '/var/www/vhosts/elentra-staging.med.university.edu')
8
->roles('app')
9
->forwardAgent();
10
11
// Production Server
12
host('elentra01.med.university.edu', 'elentra02.med.university.edu')
13
->stage('production')
14
->user('production')
15
->set('branch', 'uni/production')
16
->set('branch_ejs', 'master')
17
->set('deploy_path', '/var/www/vhosts/elentra.med.university.edu')
18
->roles('app')
19
->forwardAgent();
Copied!

Deployment Commands

Deployer deployment commands are typically executed from within your Elentra Developer Docker Environment within the /var/www/vhosts/uni-elentra-1x-me/deployment directory, but can also be executed by your CI/CD server to automate the deployment process.

Commonly Used Commands

Deployer
Notes
dep deploy staging
dep deploy production
Add -p flag to speed up multi-server deployments.
Add -v|vv|vvv flag to increase the verbosity of messages.
dep rollback staging
dep ssh hostname
Connect via SSH to the specified host.

Command Reference

1
Options:
2
-h, --help Display this help message
3
-q, --quiet Do not output any message
4
-V, --version Display this application version
5
--ansi Force ANSI output
6
--no-ansi Disable ANSI output
7
-n, --no-interaction Do not ask any interactive question
8
-f, --file[=FILE] Specify Deployer file
9
--tag=TAG Tag to deploy
10
--revision=REVISION Revision to deploy
11
--branch=BRANCH Branch to deploy
12
--first-run Skips deployment steps not required during initial deployment
13
--force-build Deletes the local build directories and forces a new build
14
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
15
16
Available commands:
17
autocomplete Install command line autocompletion capabilities
18
build Build all required application components
19
cleanup Cleaning up old releases
20
deploy Deploy Elentra ME to host(s)
21
help Displays help for a command
22
init Initialize deployer in your project
23
list Lists commands
24
rollback Rollback to previous release
25
run Run any arbitrary command on hosts
26
self-update Updates deployer.phar to the latest version
27
ssh Connect to host through ssh
28
build
29
build:clean Remove all build directories
30
build:ejs2 Local: Build Elentra JS 2.x, if required
31
build:ejs2:clean Local: Remove Elentra JS 2.x local build directory
32
build:me Local: Build Elentra ME
33
build:me:clean Local: Remove Elentra ME local build directory
34
build:prerequisites Local: Test for build prerequisites
35
config
36
config:current Show current paths
37
config:dump Print host configuration
38
config:hosts Print all hosts
39
debug
40
debug:task Display the task-tree for a given task
41
deploy
42
deploy:clear_paths Cleaning up files and/or directories
43
deploy:copy_dirs Copy directories
44
deploy:lock Lock deploy
45
deploy:migrate Once: Run database migrations (on first host in stage only)
46
deploy:prepare Preparing host for deploy
47
deploy:release Prepare release. Clean up unfinished releases and prepare next release
48
deploy:shared Creating symlinks for shared files and dirs
49
deploy:symlink Creating symlink to release
50
deploy:unlock Unlock deploy
51
deploy:writable Make writable dirs
52
finalize
53
finalize:clear_cache Clear the PHP opcode cache
54
finalize:restart_supervisor Restart supervisord daemon
Copied!
Last modified 1yr ago