Skip to content

Commit

Permalink
Merge pull request #54 from kcmcg/kyle_env_updates
Browse files Browse the repository at this point in the history
Updates to add credentials folder and clean up REDCap cron
  • Loading branch information
123andy authored Sep 3, 2021
2 parents 1694f7b + 80f6da2 commit 1556295
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions credentials/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Credentials Folder
I've used this to store Google Cloud API keys and other API keys that I want stored outside the webroot
5 changes: 5 additions & 0 deletions rdc/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ LOGS_DIR=../logs
# WEBROOT_DIR=/Users/andy123/Desktop/redcap-local
WEBROOT_DIR=../www

# THIS IS WHERE YOUR CREDENTIALS ARE LOCATED (for outside APIs). SHOULD BE OUTSIDE WEBROOT
# CAN MOVE IT TO A DIFFERENT LOCATION ON YOUR COMPUTER, SUCH AS:
# WEBROOT_DIR=/Users/andy123/Desktop/credentials
CREDENTIALS_DIR=../credentials

# WILL REDCAP RUN AS THE DEFAULT WEB APP ON YOUR INSTANCE? (e.g. 'http://localhost' vs. 'http://localhost/redcap')
# TO HAVE REDCAP RUN AS THE DEFAULT APP (e.g. http://localhost) USE "/"
# TO HAVE REDCAP RUN UNDER A FOLDER (e.g http://localhost/redcap/) USE "/redcap/"
Expand Down
1 change: 1 addition & 0 deletions rdc/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ services:
volumes:
- ${WEB_OVERRIDES}:/etc/container-config-override
- ${WEBROOT_DIR}:/var/www/html
- ${CREDENTIALS_DIR}:/var/credentials
- ${LOGS_DIR}:/var/log/apache2
networks:
- redcap_network
Expand Down
1 change: 0 additions & 1 deletion rdc/docker-cron/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM alpine:3.8

RUN apk add --no-cache tzdata logrotate
ENV TZ America/Los_Angeles

COPY ./entrypoint.sh /
RUN chmod +x /entrypoint.sh
Expand Down
16 changes: 12 additions & 4 deletions rdc/docker-cron/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@ if [ ! -z "$APACHE_RUN_USER_ID" ]; then
fi
fi

# ADD REDCap CRON ENTRIES
echo "* * * * * wget web${REDCAP_WEBROOT_PATH}cron.php --spider >/dev/null 2>&1" >> /var/spool/cron/crontabs/root
if grep -Fq "cron.php" /var/spool/cron/crontabs/root
then
# code if found
echo "Found cron.php entry already exists"
else
# ADD REDCap CRON ENTRIES
echo "* * * * * wget web${REDCAP_WEBROOT_PATH}cron.php --spider >/dev/null 2>&1" >> /var/spool/cron/crontabs/root

# Add logrotate scripts
echo "*/5 * * * * /usr/sbin/logrotate /etc/logrotate.conf" >> /var/spool/cron/crontabs/root
echo "Added cron entry"
fi

# Add logrotate scripts
echo "*/5 * * * * /usr/sbin/logrotate /etc/logrotate.conf" >> /var/spool/cron/crontabs/root
# Log Rotate throws an error if this file doesn't exist
touch /var/log/messages

Expand Down

0 comments on commit 1556295

Please sign in to comment.