Skip to content

Commit ab101b0

Browse files
committed
Merge branch 'release/0.5.0'
2 parents b8f803a + 42aa69b commit ab101b0

19 files changed

+1002
-239
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.env
12
.vagrant
23
~$*
34
redcap*.zip
5+
redcap/

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ All notable changes to the REDCap Deployment project will be documented in this
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

55

6+
## [0.5.0] - 2016-06-14
7+
### Changed
8+
- Refactor dev VM and its related deployment scripts to use the vagrant-env plugin, Debian Jessie, and MySQL Community Server (Philip Chase)
9+
- Fix formatting errors in 'Creating the Test VM With Vagrant' and embellish content (Philip Chase)
10+
- Use our apache ssl configuration (Philip Chase)
11+
- Check for box file updates at 'vagrant up' (Philip Chase)
12+
- Reconfigure how the autonotify plugin deployment integrates with apache (Philip Chase)
13+
14+
615
## [0.4.1] - 2016-04-25
716
### Changed
817
- Correct documentation and make it more suitable for public consumption (Philip Chase)

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,30 @@ production and staging instances of REDCap at the CTSI.
1212

1313
## Requirements
1414

15-
A user of these tools will need to download and provide their own REDCap bits,
15+
A user of these tools will need to download and provide their own REDCap zip file,
1616
downloaded from Vanderbilt. This REDCap .zip should be placed in the root folder.
1717
It should not be renamed.
1818

19-
This VM requires that Vagrant, VirtualBox and the vagrant-hostsupdater plugin be installed on the host system.
19+
This VM requires that Vagrant, VirtualBox, the vagrant-hostsupdater plugin and the vagrant-env plugin be installed on the host system.
2020

21-
See [Creating the Test VM With Vagrant](docs/creating_the_test_vm_with_vagrant.rst) for details on how to mee those requirements.
21+
See [Creating the Test VM With Vagrant](docs/creating_the_test_vm_with_vagrant.rst) for details on how to meet those requirements.
2222

2323

24-
## Using the Development environment
24+
## Configure the Development Environment
2525

26-
To with the above requirements met, start the VM with the command
26+
The development environment needs to be configured before it can be started.
27+
Copy the file _example.env.txt_ to the name _.env_ and customize it for your
28+
use. Minimally, you will need to set _smtp\_smarthost_ the dns name of a mail
29+
server your development host can use to deliver mail. This will allow you to
30+
better test features that send email.
31+
32+
## Using the Development Environment
33+
34+
With the above requirements and configuration completed, start the VM with the command
2735

2836
vagrant up
2937

30-
After about two minutes, the VM should be accessible at [http://redcap.dev/redcap/](http://redcap.dev/redcap/) and at [https://redcap.dev/redcap/](https://redcap.dev/redcap/)
38+
After about two minutes, the VM should be accessible at [http://redcap.dev/redcap/](http://redcap.dev/redcap/) and at [https://redcap.dev/redcap/](https://redcap.dev/redcap/) (or whatever URL _URL\_OF\_DEPLOYED\_APP_ is set to in _.env_)
3139

3240

3341
## Hook and Plugin deployment
@@ -49,7 +57,7 @@ ToDo: Convert steps of wiki article to shell script.
4957

5058
## REDCap installation
5159

52-
We do not currently have a bare-metal installation procedure. That said, the
60+
CTS-IT does not currently have a bare-metal installation procedure. That said, the
5361
vagrant files presented in this repo contain many of the required steps in
5462
such a deployment process. Other steps can be found in the above upgrade
5563
instructions.

Vagrantfile

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,52 @@
11
# -*- mode: ruby -*-
22
# vi: set ft=ruby :
33

4-
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5-
VAGRANTFILE_API_VERSION = "2"
4+
Vagrant.configure(2) do |config|
65

7-
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8-
config.vm.box = "puppetlabs/debian-7.8-64-nocm"
9-
config.vm.hostname = "redcap-deployment"
6+
# Enable the vagrant env plugin
7+
config.env.enable
8+
9+
config.vm.hostname = ENV["HOSTNAME_IN_GUEST"]
10+
config.vm.box = ENV["CONFIG_VM_BOX"]
11+
12+
# Disable automatic box update checking. If you disable this, then
13+
# boxes will only be checked for updates when the user runs
14+
# `vagrant box outdated`. This is not recommended.
15+
config.vm.box_check_update = true
16+
17+
config.vm.network "forwarded_port", guest: 80, host: ENV["FORWARDED_PORT_80"]
18+
config.vm.network "forwarded_port", guest: 443, host: ENV["FORWARDED_PORT_443"]
19+
20+
# Create a private network, which allows host-only access to the machine using a specific IP.
21+
config.vm.network "private_network", ip: ENV["VM_IP"]
22+
23+
# Set the hostname using the vagrant hostupdater plugin
1024
config.hostsupdater.remove_on_suspend = false
11-
config.hostsupdater.aliases = ["redcap.dev"]
12-
config.vm.network "private_network", ip: "192.168.33.113"
25+
config.hostsupdater.aliases = [ENV["HOSTNAME_IN_HOST"]]
26+
27+
config.vm.synced_folder "redcap", ENV["PATH_TO_APP_IN_GUEST_FILESYSTEM"],
28+
owner: "www-data",
29+
group: "vagrant"
30+
31+
config.vm.provider "virtualbox" do |vb|
32+
# vb.memory = "1024"
33+
# Get virtual box name vagrant env plugin
34+
vb.name = ENV["HOSTNAME_IN_GUEST"]
35+
end
36+
37+
# Run our customizations
1338
config.vm.provision "shell" do |s|
1439
s.path = "bootstrap.sh"
1540
end
16-
end
1741

42+
# Restart apache when all done (if using apache)
43+
config.vm.provision "shell", run: "always", inline: "service apache2 restart"
44+
45+
# Help the developer to find the app :)
46+
if Vagrant.has_plugin?('vagrant-triggers')
47+
config.trigger.after [:up] do
48+
system("open -a 'Google Chrome.app' #{ENV['URL_OF_DEPLOYED_APP']}")
49+
end
50+
end
51+
52+
end

apache-default.conf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<VirtualHost *:80>
2+
ServerAdmin webmaster@localhost
3+
4+
DocumentRoot /var/www
5+
6+
<Directory "/var/www" >
7+
AllowOverride all
8+
</Directory>
9+
10+
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
11+
# error, crit, alert, emerg.
12+
# It is also possible to configure the loglevel for particular
13+
# modules, e.g.
14+
#LogLevel info ssl:warn
15+
LogLevel info
16+
17+
ErrorLog ${APACHE_LOG_DIR}/error.log
18+
CustomLog ${APACHE_LOG_DIR}/access.log combined
19+
20+
# Allow code to detect the testing environment and redirect emails
21+
# using EMAIL_DEV_STAG_* php constants such as [email protected]
22+
# defined in app/Config/constants.php for cake applications
23+
SetEnv IS_MODE_STAGING
24+
25+
</VirtualHost>

apache-ssl.conf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<IfModule mod_ssl.c>
2+
<VirtualHost _default_:443>
3+
ServerAdmin webmaster@localhost
4+
5+
DocumentRoot /var/www
6+
7+
<Directory "/var/www" >
8+
AllowOverride all
9+
</Directory>
10+
11+
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
12+
# error, crit, alert, emerg.
13+
# It is also possible to configure the loglevel for particular
14+
# modules, e.g.
15+
#LogLevel info ssl:warn
16+
LogLevel info
17+
18+
ErrorLog ${APACHE_LOG_DIR}/error.log
19+
CustomLog ${APACHE_LOG_DIR}/access.log combined
20+
21+
# SSL Engine Switch:
22+
# Enable/Disable SSL for this virtual host.
23+
SSLEngine on
24+
25+
# A self-signed (snakeoil) certificate can be created by installing
26+
# the ssl-cert package. See
27+
# /usr/share/doc/apache2/README.Debian.gz for more info.
28+
# If both key and certificate are stored in the same file, only the
29+
# SSLCertificateFile directive is needed.
30+
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
31+
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
32+
33+
# Allow code to detect the testing environment and redirect emails
34+
# using EMAIL_DEV_STAG_* php constants such as [email protected]
35+
# defined in app/Config/constants.php for cake applications
36+
SetEnv IS_MODE_STAGING
37+
38+
</VirtualHost>
39+
</IfModule>
40+
41+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

bootstrap.sh

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export DEBIAN_FRONTEND=noninteractive
2020
# Exit on first error
2121
set -e
2222

23+
echo "Import environment variables from /vagrant/.env"
24+
. /vagrant/.env
25+
2326
# Indicate where the vagrant folder is mounted in the guest file system
2427
SHARED_FOLDER=/vagrant
2528

@@ -28,15 +31,62 @@ REDCAP_ZIP=`ls $SHARED_FOLDER/redcap*.zip | grep "redcap[0-9]\{1,2\}\.[0-9]\{1,2
2831

2932
# import helper functions
3033
. $SHARED_FOLDER/bootstrap_functions.sh
34+
. $SHARED_FOLDER/redcap_deployment_functions.sh
35+
36+
# Pick a fast mirror...or at least one that works
37+
log "Picking a fast mirror in the US..."
38+
apt-get install -y netselect-apt
39+
cd /etc/apt/
40+
netselect-apt -c US > ~/netselect-apt.log 2>&1
3141

32-
install_prereqs
33-
install_redcap
42+
# Update our repos
43+
log "Updating apt package indicies..."
44+
apt-get update
45+
46+
# Install developer tools
47+
log "Execute: install_utils..."
3448
install_utils
49+
50+
log "Execute: install_prereqs..."
51+
install_prereqs $MYSQL_REPO $DB_ROOT_PASS
52+
apt-get install -y php-pear php5-curl
53+
54+
# prep the /var/www directory
55+
log "Prep the /var/www file system"
56+
rm -rf /var/www/redcap/*
57+
58+
# extract a standard REDCap zip file as downloaded from Vanderbilt.
59+
unzip -o -q $REDCAP_ZIP -d /var/www/
60+
61+
# adjust ownership so apache can write to the temp folders
62+
chown -R www-data.root $PATH_TO_APP_IN_GUEST_FILESYSTEM/edocs/
63+
chown -R www-data.root $PATH_TO_APP_IN_GUEST_FILESYSTEM/temp/
64+
65+
REDCAP_VERSION_DETECTED=`ls $PATH_TO_APP_IN_GUEST_FILESYSTEM | grep redcap_v | cut -d 'v' -f2 | sort -n | tail -n 1`
66+
log "$REDCAP_ZIP content indicates REDCap version: $REDCAP_VERSION_DETECTED"
67+
68+
# create the empty databases and update the cake configuration
69+
create_database $DB $DB_APP_USER $DB_APP_PASSWORD $DB_HOST $DB_ROOT_PASS
70+
71+
# Configure REDCap to use this database
72+
update_redcap_connection_settings $PATH_TO_APP_IN_GUEST_FILESYSTEM $DB $DB_APP_USER $DB_APP_PASSWORD $DB_HOST $SALT
73+
74+
# make a config file for the mysql clients
75+
write_dot_mysql_dot_cnf $DB $DB_APP_USER $DB_APP_PASSWORD $DB_ROOT_PASS
76+
77+
create_redcap_tables $DB $DB_APP_USER $DB_APP_PASSWORD $PATH_TO_APP_IN_GUEST_FILESYSTEM $REDCAP_VERSION_DETECTED
78+
79+
configure_redcap
80+
configure_php_for_redcap
81+
configure_redcap_cron
82+
move_edocs_folder
83+
set_hook_functions_file
84+
make_twilio_features_visible
3585
configure_exim4
3686
check_redcap_status
3787

3888
# deploy extensions with developer settings
39-
export REDCAP_ROOT=/var/www/redcap
40-
export HOOKS_CONFIGURATION=redcap.dev
41-
export SHIB=0
89+
90+
export PATH_TO_APP_IN_GUEST_FILESYSTEM
91+
4292
/vagrant/deploy_extensions.sh

0 commit comments

Comments
 (0)