Skip to content

Instantly share code, notes, and snippets.

@maximz
Last active December 21, 2015 08:03
Show Gist options
  • Save maximz/a6fdf6ba750b4aeb33c5 to your computer and use it in GitHub Desktop.
Save maximz/a6fdf6ba750b4aeb33c5 to your computer and use it in GitHub Desktop.
Test how often google calendar pulls ics feeds

Testing to see how often google calendar really pulls our ics feeds. The ics file we are hosting has a 15 minute TTL. This docker container hosts it in nginx and stores logs.

(Using a docker container so that easy to find in logs and not polluted by other things)

on host:

  1. in /etc/nginx/sites-available/recaltest.conf:
upstream recaltest.localhost {
    server 127.0.0.1:3165;
}

server {

    #listen 80;

    gzip_types text/plain text/css application/json application/x-javascript
               text/xml application/xml application/xml+rss text/javascript;

    server_name dev.recal.io;

    location / {
        proxy_pass http://recaltest.localhost;
        include /etc/nginx/proxy_params;
    }
}
  1. make symlink to it in sites-enabled

  2. sudo service nginx reload

  3. run.sh

  4. add to gcal, look at logs after a few hours. then stop.sh.

server {
root /var/www;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
#try_files $uri $uri/ /index.html;
}
location = /monitoring/health {
return 200;
access_log off; # don't log the healthcheck calls
}
}
FROM nginx:1.9.2
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN mkdir /etc/nginx/ssl
#RUN echo "include /etc/nginx/sites-enabled/*;" >> /etc/nginx/nginx.conf
#RUN mkdir /etc/nginx/sites-enabled
#ADD default /etc/nginx/sites-available/custom
#RUN ln -s /etc/nginx/sites-available/custom /etc/nginx/sites-enabled/
# Overwrite existing default
ADD default /etc/nginx/conf.d/default.conf
COPY . /var/www/
CMD service nginx start
docker build -t recal-ical .;
docker tag -f recal-ical recal-ical:latest;
docker run -p 3165:80 --name=recal-ical -d recal-ical:latest;
echo 'docker logs recal-ical | grep test2';
docker stop recal-ical;
docker rm recal-ical;
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Recal Course Planner//recal.io//
X-PUBLISHED-TTL:PT15M
X-WR-CALDESC:ReCal Schedule
X-WR-CALNAME:ReCal S16 (maximz)
BEGIN:VEVENT
SUMMARY:COS 333 L01
DTSTART;TZID=US/Eastern;VALUE=DATE-TIME:20160202T100000
DTEND;TZID=US/Eastern;VALUE=DATE-TIME:20160202T105000
DTSTAMP;VALUE=DATE-TIME:20160201T050000Z
LOCATION:50 McCosh Hall\, Princeton\, NJ
RRULE:FREQ=WEEKLY;UNTIL=20160531T000000;BYDAY=TU,TH;WKST=SU
END:VEVENT
END:VCALENDAR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment