Skip to content

Commit d132ed2

Browse files
committed
Merge branch 'release/0.4.0'
2 parents b34e632 + fa956e7 commit d132ed2

File tree

5 files changed

+94
-6
lines changed

5 files changed

+94
-6
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ 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.4.0] - 2016-04-25
7+
### Added
8+
- Enable ssl in apache config (Philip Chase)
9+
- Add an alias, dump_redcap_db, to do a standardized dump of the REDCap MySQL DB (Philip Chase)
10+
- Add set_redcap_config for updating the redcap_config table (Philip Chase)
11+
12+
### Changed
13+
- Disable stream edits of the SHIB configuration in a test environment (Philip Chase)
14+
- Set hook_functions_file to the path used in deployment_functions.sh (Philip Chase)
15+
- Configure REDCap VM according to recommendations: install php-gd, activate redcap cron, adjust php ini vars, and move edocs folder (Philip Chase)
16+
- Fix patching of default-ssl in autonotify plugin deploy script. (Philip Chase)
17+
18+
619
## [0.3.0] - 2016-04-01
720
### Changed
821
- Update autonotify plugin with security improvements (Philip Chase)

aliases

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ alias remove_ban='echo "Query run: DELETE FROM redcap_ip_banned;" && mysql -ured
2828
alias show_columns='mysql -uredcap -ppassword redcap -e "SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, DATA_TYPE FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = \"redcap\" " '
2929
alias show_logs='mysql -uredcap -ppassword redcap -e "SELECT log_event_id, ip, object_type, event_id, data_values, description, sql_log FROM redcap_log_event ORDER BY log_event_id DESC LIMIT 10" '
3030
alias redcap_version='mysql -uredcap -ppassword redcap -se "select value from redcap.redcap_config WHERE field_name = \"redcap_version\";" | tail -n 1'
31+
alias dump_redcap_db='mysqldump --single-transaction=TRUE --skip-add-locks --skip-comments --skip-extended-insert --no-create-db --no-create-info redcap > redcap.sql'

bootstrap.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ check_redcap_status
3838
# deploy extensions with developer settings
3939
export REDCAP_ROOT=/var/www/redcap
4040
export HOOKS_CONFIGURATION=redcap.dev
41+
export SHIB=0
4142
/vagrant/deploy_extensions.sh

bootstrap_functions.sh

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export DATABASE_ROOT_PASS=123
2323
export development_hostname=redcap.dev
2424
export redcap_base_url=http://$development_hostname/redcap/
2525
export smtp_smarthost=smtp.ufl.edu
26+
export max_input_vars=10000
27+
export upload_max_filesize=32M
28+
export post_max_size=32M
29+
2630

2731
function install_prereqs() {
2832
# Install the REDCap prerequisites:
@@ -34,11 +38,15 @@ function install_prereqs() {
3438
apache2 \
3539
mysql-server \
3640
php5 php-pear php5-mysql php5-curl \
41+
php5-gd \
3742
unzip git php5-mcrypt
3843

3944
# configure MySQL to start every time
4045
update-rc.d mysql defaults
4146

47+
# configure https
48+
configure_ssl
49+
4250
# restart apache
4351
service apache2 restart
4452
}
@@ -67,12 +75,17 @@ function install_redcap() {
6775
create_redcap_tables
6876
# STEP 5: Configure REDCap
6977
configure_redcap
70-
# STEP 6: Configuration Check
78+
# STEP 6: Configure PHP
79+
configure_php_for_redcap
80+
configure_redcap_cron
81+
move_edocs_folder
82+
set_hook_functions_file
83+
make_twilio_features_visible
7184
}
7285

7386
function create_redcap_database() {
7487
echo "Creating database..."
75-
mysql -uroot <<SQL
88+
mysql <<SQL
7689
DROP DATABASE IF EXISTS redcap;
7790
CREATE DATABASE redcap;
7891
@@ -149,7 +162,58 @@ function create_redcap_tables() {
149162
function configure_redcap() {
150163
echo "Setting redcap_base_url to $redcap_base_url..."
151164
echo "update redcap_config set value='$redcap_base_url' where field_name = 'redcap_base_url';" | mysql
165+
}
166+
167+
# Adjust PHP vars to match REDCap needs
168+
function configure_php_for_redcap() {
169+
echo "Configuring php to match redcap needs..."
170+
php5_confd_for_redcap="/etc/php5/conf.d/90-settings-for-redcap.ini"
171+
echo "max_input_vars = $max_input_vars" > $php5_confd_for_redcap
172+
echo "upload_max_filesize = $upload_max_filesize" >> $php5_confd_for_redcap
173+
echo "post_max_size = $post_max_size" >> $php5_confd_for_redcap
174+
}
175+
176+
# Turn on REDCap Cron
177+
function configure_redcap_cron() {
178+
echo "Turning on REDCap Cron job..."
179+
crond_for_redcap=/etc/cron.d/redcap
180+
echo "# REDCap Cron Job (runs every minute)" > $crond_for_redcap
181+
echo "* * * * * root /usr/bin/php /var/www/redcap/cron.php > /dev/null" >> $crond_for_redcap
182+
}
183+
184+
# move the edocs folder
185+
function move_edocs_folder() {
186+
echo "Moving the edocs folder out of web space..."
187+
edoc_path="/var/edocs"
188+
default_edoc_path="/var/www/redcap/edocs"
189+
if [ ! -e $edoc_path ]; then
190+
if [ -e $default_edoc_path ]; then
191+
rsync -ar $default_edoc_path $edoc_path && rm -rf $default_edoc_path/*
192+
else
193+
mkdir $edoc_path
194+
fi
195+
# adjust the permissions on the new
196+
chown -R www-data.www-data $edoc_path
197+
find $edoc_path -type d | xargs -i chmod 775 {}
198+
find $edoc_path -type f | xargs -i chmod 664 {}
199+
fi
200+
set_redcap_config "Adjusting DB for edocs move..." edoc_path $edoc_path
201+
}
202+
203+
function set_redcap_config() {
204+
info_text=$1
205+
field_name=$2
206+
value=$3
207+
echo "$1"
208+
mysql -e "UPDATE redcap.redcap_config SET value = '$value' WHERE field_name = '$field_name';"
209+
}
210+
211+
function set_hook_functions_file() {
212+
set_redcap_config "Setting hook_functions_file..." "hook_functions_file" "/var/www/redcap/hooks/redcap_hooks.php"
213+
}
152214

215+
function make_twilio_features_visible() {
216+
set_redcap_config "Making twilio features visible..." "twilio_enabled_by_super_users_only" "0"
153217
}
154218

155219
# Check if the Apache server is actually serving the REDCap files
@@ -211,3 +275,10 @@ function configure_php_mail() {
211275
sed -e "sX.*sendmail_path.*Xsendmail_path = /usr/sbin/sendmail -t -iX;" -i /etc/php5/apache2/php.ini
212276
sed -e "sX.*mail.log.*Xmail.log = syslogX;" -i /etc/php5/apache2/php.ini
213277
}
278+
279+
function configure_ssl() {
280+
echo "Configure SSL..."
281+
282+
a2enmod ssl
283+
ln -s /etc/apache2/sites-available/default-ssl /etc/apache2/sites-enabled
284+
}

plugins/autonotify/deploy.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ cat << EOF > /etc/logrotate.d/redcap-autonotify
3131
EOF
3232

3333
# patch the apache SSL host config file and restart apache if this patch has never been applied
34-
cd /etc/apache2/sites-available/
35-
if [ `grep -c "/redcap/plugins/autonotify/det.php" default-ssl` == 0 ] ; then
36-
patch -p1 < $DIR/default-ssl.patch
37-
service apache2 restart
34+
if [ ! $SHIB == "0" ]; then
35+
cd /etc/apache2/sites-available/
36+
if [ `grep -c "/redcap/plugins/autonotify/det.php" default-ssl` == 0 ] ; then
37+
patch -p3 < $DIR/default-ssl.patch
38+
service apache2 restart
39+
fi
3840
fi
3941

4042
# Alert the admin to turn on DET for the REDCAP system

0 commit comments

Comments
 (0)