The SFU Summer Festival 2022: Timelapse – Behind The Scenes

The SFU Summer Festival came back this year after a two year hiatus from COVID. The club's Rengineers team set up a timelapse for the event. This post goes over some of the high level details happening behind the scenes.

The SFU Summer Festival, presented by SFU Anime, came back this year in full swing on Saturday, August 27, 2022. Unfortunately, I had already made prior plans before they announced the date, so I had to miss it. That being said, I was already working on a slightly improved version of the timelapse we did back in 2019. So today, I want to talk a little bit about how we hooked this up to Ren, the SFU Anime Club’s mascot and Discord bot.

In 2019, we used a Raspberry Pi 3 B+ for three things:

  1. Host an instance of our club’s bot, Ren.
  2. Take snapshots from a webcam.
  3. Take snapshots from a DSLR camera.

We hosted the bot on the Pi because it allowed users to view the webcam images; however, it presents a few problems. First, running the bot on the Pi takes energy. In addition to having to poll images, it has to handle the plethora of Discord API events from the gateway, for which it would only care about the ones containing the command to invoke sending the latest webcam image to a text channel. Second, having another instance means that the bot’s API token can be stolen by physically removing the Pi’s SD card. Since Ren is very permissive on the SFU Anime Discord, we should do our best to reduce the risk of it being taken.

To alleviate the aforementioned concerns, I decided to change it so that the Pi sends images to an API, and the Discord bot, which lives on AWS, can request the image via the API and post it. This would then decouple the image fetching from the bot interactions.

I am working on my personal API on my spare time, so it is very much a work in progress. I’ve still got lots to learn, but crucially I didn’t have any form of authentication, so I needed to figure out a way to lock it down while being exposed to the Internet. The solution I went with was Cloudflare Access. It’s a pretty neat solution by Cloudflare that uses their authoritative DNS for a protected resource to present a login screen users to authenticate, and an administrator (such as myself) can determine who is authorized to access said resource. It looks like the following:

  • On Cloudflare’s dashboard, authorizes users on the Rengineers team within the SFUAnime organization to access the API.
  • On the API server side, the CLI daemon cloudflared is used to connect to Cloudflare’s edge network. It instructs Cloudflare to send requests to to the API server.
  • On the Pi side, I use cloudflared to authenticate and retrieve a token to perform HTTP POST requests towards
  • On the Discord bot side, I use cloudflared to authenticate and retrieve a token to perform HTTP GET requests towards

Cloudflare’s free tier us with 50 free user seats to authenticate towards the API, which is plenty for our intents and purposes: I only needed 1.

The Cloudflare Access authentication screen.

On the bot side of things, we updated the SFU cog with a few commits to fetch the webcam images with the rensfu cam fest command.

GitHub commits pertaining to the Summerfest webcam changes.

On the day of, I had a few of my friends (Tatsu, KaguneAstra, MajinExia, and TheDarkBot) help me set up and watch over the set up. Majin helped supply a tripod, Kagune helped tether the Pi to Wi-Fi as I was unable to get WPA2-Enterprise configured :'( . We also didn’t have AC power at the venue, so we had to rely on a portable USB power bank to supply DC power to the Raspberry Pi. This wouldn’t have happened without their help, so I am very thankful to have them watch over it while I was away. I put the final timelapse on YouTube, here it is below:

The final timelapse.

Anyways, that’s all I have this time around. My goal for next year will be to continue iterating on the API side of things to make it a bit better.

Until next time!


Just some guy on the Internet that writes code for fun and for a living, and also collects anime figures.

Articles: 268

Feel free to leave a reply