Commit 16e5be67 authored by Dave Lane's avatar Dave Lane

adding initial support for a cron container, tidying up twitter.js -> twitters.js

parent 5674fe23
FROM oeru/wenotes-tools
MAINTAINER Dave Lane dave@oerfoundation.org - @lightweight and https://tech.oeru.org
# cron is already installed in the base image
# set up cron tasks
RUN set -ex \
&& { \
echo "# created by Docker and the OER Foundation"; \
echo "MAILTO=webmaster@oerfoundation.org"; \
echo "LOG=/var/log/cron.log"; \
echo "WEDIR=/opt/wenotes/tools"; \
echo "PY=/usr/bin/python"; \
echo '8,18,28,38,48,58 * * * * root cd $WEDIR && nice $PY bookmarks.py && nice $PY medium.py'; \
echo '6,16,26,36,46,56 * * * * root cd $WEDIR && nice $PY mastodon.py && nice $PY hypothesis.py'; \
echo '4,14,24,34,44,54 * * * * root cd $WEDIR && nice $PY gplus.py && nice $PY feeds.py && nice $PY groups.py'; \
echo '2,12,22,32,42,52 * * * * root cd $WEDIR && nice $PY forums.py && nice $PY discourse.py --full'; \
echo '*/1 * * * * root echo "Cron ran at $(date)" >> $LOG'; \
} | tee /etc/cron.d/wenotes-cron
RUN chmod 0644 /etc/cron.d/wenotes-cron
RUN touch 0644 /var/log/cron.log
CMD cron && tail -f /var/log/cron.log
......@@ -21,9 +21,9 @@ MAINTAINER Dave Lane dave@oerfoundation.org
# The aim: to make a manageable fully functional dev environment which
# fosters remote API-ification for registering new blog users,
# updating details for session validation, and possibly integrating Mautic...
ENV APT_SERVER http://ucmirror.canterbury.ac.nz/ubuntu
ENV APT_FILE sources.list
ENV UBUNTU_NAME xenial
#ENV APT_SERVER http://ucmirror.canterbury.ac.nz/ubuntu
#ENV APT_FILE sources.list
#ENV UBUNTU_NAME xenial
# subdue the "Dialog" errors...
ENV DEBIAN_FRONTEND noninteractive
#
......@@ -32,12 +32,12 @@ RUN groupadd -r couchdb && useradd -d /opt/couchdb -g couchdb couchdb
#
# add local mirror to reduce build time :)
RUN echo "deb $APT_SERVER ${UBUNTU_NAME} main universe" > /etc/apt/${APT_FILE}
RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME} main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
#RUN echo "deb $APT_SERVER ${UBUNTU_NAME} main universe" > /etc/apt/${APT_FILE}
#RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
#RUN echo "deb $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
#RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME} main universe" >> /etc/apt/${APT_FILE}
#RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-updates main universe" >> /etc/apt/${APT_FILE}
#RUN echo "deb-src $APT_SERVER ${UBUNTU_NAME}-security main universe" >> /etc/apt/${APT_FILE}
# do one update and start installing...
RUN apt-get update -y && apt-get install -y --no-install-recommends \
apt-transport-https \
......
......@@ -14,7 +14,6 @@ GIT=`which git`
NPM=`which npm`
PM2=`which pm2`
CP=`which cp`
CRON=/etc/cron.d/wenotes
echo "CWD=$CWD, GIT=$GIT"
......@@ -35,15 +34,6 @@ fi
echo "starting services"
# start rsyslogd
echo "restarting rsyslog"
service rsyslog restart
echo `service rsyslog status`
# restart cron
echo "restarting cron"
service cron restart
echo `service cron status`
# remove default msmtprc
if [[ -f /opt/wenotes/tools/msmtprc ]] ; then
echo "moving our msmtprc to /etc and /etc/msmtprc to /etc/msmtprc.default"
......@@ -68,20 +58,6 @@ else
fi
# set up options.json
# set up Cron jobs...
echo "setting up cron jobs"
echo "# created by Docker and the OER Foundation" > $CRON
echo "MAILTO=webmaster@oerfoundation.org" >> $CRON
echo "LOG=/opt/wenotes/logs/crontest" >> $CRON
echo "WEDIR=/opt/wenotes/tools" >> $CRON
echo "PY=/usr/bin/python" >> $CRON
echo '8,18,28,38,48,58 * * * * root cd $WEDIR && nice $PY bookmarks.py && nice $PY medium.py' >> $CRON
echo '6,16,26,36,46,56 * * * * root cd $WEDIR && nice $PY mastodon.py && nice $PY hypothesis.py' >> $CRON
echo '4,14,24,34,44,54 * * * * root cd $WEDIR && nice $PY gplus.py && nice $PY feeds.py && nice $PY groups.py' >> $CRON
echo '2,12,22,32,42,52 * * * * root cd $WEDIR && nice $PY forums.py && nice $PY discourse.py --full' >> $CRON
echo '*/1 * * * * root echo "Cron ran at $(date)" >> $LOG' >> $CRON
chmod 0644 $CRON
# next start various Javascript services
if [[ -f $CONF/services.yml ]] ; then
cd $WENOTES/tools
......
......@@ -5,10 +5,10 @@ apps:
name : 'CouchWatch'
merge_logs : true
out_file : '/tmp/couchwatch.log'
- script : 'twitter.js'
name : 'Twitter Watcher'
- script : 'twitters.js'
name : 'Twitter Stream Watcher'
merge_logs : true
out_file : '/tmp/twitter.log'
out_file : '/tmp/twitters.log'
- script : 'irc.js'
name : 'IRC Watcher'
merge_logs : true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment