just-scored

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2018 License: MIT

README

Just Scored!

AWS Lambda Build status Test coverage Release License

Ever wanted to be notified in Slack when somebody scored a goal in the World Cup? No? Well, that's also fine - this was made mostly to play around with Go and Lambda, so no harm done. But in case you are interested - read on!

Slack message

Architecture

The project is made of two AWS Lambda functions:

  • goal-checker, which runs every minute, checks for scored goals in currently played matches and saves them to a DynamoDB table
  • goal-notifier, which is triggered on DynamoDB table item creation and sends a notification to the configured Slack webhook(s)

The third piece of it all is worldcup - a very simple API wrapper I made for http://worldcup.sfg.io/. I may put it in a separate repository after I implement all endpoints, but I decided to leave it here at the moment.

Running it yourself

Given the serverless nature of this project and usage of the awesome Serverless framework, the entire deploy comes up to running serverless deploy - 🎉.

If you never used it, then I'd recommend at least skimming through its AWS docs, but the only thing you need to set up locally are the AWS credentials and the Slack webhook URL exported as a SLACK_WEBHOOK_URLS environment variable (it supports multiple comma separated URLs).

So, all in all, it should look similar to:

$ # Setup
$ npm install serverless -g
$ serverless config credentials --provider aws --key FOO --secret BAR
$ export SLACK_WEBHOOK_URLS='https://hooks.slack.com/services/...'
$ git clone https://github.com/pawelad/just-scored && cd just-scored
$ make build 
$ # Deployment
$ serverless deploy

And if you want to go all the way, you can fork this repository and plug it into CircleCI - it will use the existing config I built, which implements a full CI / CD pipeline. It runs tests on each push and deploys the app on each version tag.

Contributions

Package source code is available at GitHub.

Feel free to use, ask, fork, star, report bugs, fix them, suggest enhancements, add functionality and point out any mistakes.

Authors

Developed and maintained by Paweł Adamczak.

Released under MIT License.

Directories

Path Synopsis
Program goal-checker is a AWS Lambda function that checks for scored goals in currently played World Cup matches and saves them to DynamoDB (if they're not already there).
Program goal-checker is a AWS Lambda function that checks for scored goals in currently played World Cup matches and saves them to DynamoDB (if they're not already there).
Program goal-notifier is a AWS Lambda function that's invoked via DynamoDB stream events, processes the added goal and sends Slack notifications to configred Slack webhook URLs.
Program goal-notifier is a AWS Lambda function that's invoked via DynamoDB stream events, processes the added goal and sends Slack notifications to configred Slack webhook URLs.
Package justscored contains shared DynamoDB code used by goal-checker and goal-notifier Lambda functions.
Package justscored contains shared DynamoDB code used by goal-checker and goal-notifier Lambda functions.
Package worldcup is a simple API wrapper for http://worldcup.sfg.io/ At the moment it only implements the '/matches/current' and '/matches/today' endpoints.
Package worldcup is a simple API wrapper for http://worldcup.sfg.io/ At the moment it only implements the '/matches/current' and '/matches/today' endpoints.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL