Case Studies

SportsBet Remote Deployment

Images courtesy of Magriet Perold from AtticSalt.co.za.

The Challenge:
Automating Everything

While working for Sepel SportsBet in South Africa (now part of Betfred), we needed to find a way to automate and schedule the deployment of apps and advertisements to be used in dozens of stores, scattered across the country.

The apps were run on servers and Raspberry Pi’s housed in individual stores. Functionality included placing bets and playing games on tablets, as well as to display advertisements, leader boards, and live feeds of international lotteries on televisions.

Up until that point, the memory cards for the Raspberry Pi’s were sent back and forth between the shops and the company’s headquarters in Johannesburg, to be programmed manually every time updates were made to an app. And updating a server at a shop required an in-person visit. There was also a limitation on what could be displayed on each TV screen.

Solution


We created a dashboard using Laravel and Vue.js, which was used to schedule deployment of these apps to individual devices; and I programmed the Raspberry Pi’s to be auto-configured. As soon as a new one was powered up, it automatically installed all necessary APT packages and started an Apache server. It then registered itself through a secure process using OTPs. Failed registrations caused the device to “self destruct”, by wiping all app files from the system and locking out the Linux user.

The apps were standalone websites downloaded from a server at the headquarters, and hosted in Apache on the edge devices. They could be updated to new versions remotely from the dashboard, without any staff intervention in the shops, by uploading a zip file to the dashboard for every new version. Rolling back versions was also possible.

Apps could be scheduled to run at specific times, and updates were scheduled as well. Apps could also be run in loops, like for instance when looping between advertisements and live feeds.

Doing all of this required some serious Bash scripting in Ubuntu, as well as a standardised way for apps to listen on sockets and initialise downloads of updates or new apps in the background.

We could monitor and debug individual Raspberry Pi’s as well, directly from the dashboard.

In the end, the need to courier memory cards all over the country was eliminated, the bandwidth for displaying advertisements was reduced, security was increased, and anybody could set and edit schedules directly in the dashboard, freeing up development time.