Skip to content

Serverless / Kotlin / Kotless lunch data screen scraper which sends scraped, parsed and formatted data to Slack. Uses Kotless framework and deploys to AWS using Terraform under the hood.

License

Notifications You must be signed in to change notification settings

pihlajus/lunch-whisperer

Repository files navigation

Lunch whisperer

Serverless Kotlin application which screen scrapes and parses lunch info from lounaat.info and sends wanted data to Slack channel. This is also my first touch to Kotlin/Kotless.

Table of contents

How it works

Lunch whisperer uses Kotless - Kotlin serverless framework. Kotless generates Terraform code from your application code and by its own words, gives you one magic button to deploy your Web application as a serverless application on AWS!

Prerequisites

Slack application

Slack is free to use and you can create Slack application very quickly and without any programming.

AWS account

You have to have AWS account and which can be used with Kotless framework. Kotless uses Terraform under the hood to create the needed AWS resources and configurations. Hadr Hariri has written an instruction how to set up your AWS account for Kotless.

Configuration

There are few constant variables which you have to fill in to Main.kt. Currently, there is no possibility to use environment variables with Kotless like in Serverless framework. If there are some secrets that you don't want to keep in VCS you can use e.g. AWS secrets manager.

Variable Description
LOUNAAT_INFO_URL API key that enables Grafana API usage
SLACK_OAUTH_TOKEN Created automatically by Slack app, enables request verification
SLACK_CHANNEL_ID Slack channel id
MENUS_TO_SENT Restaurant names, which menus you want to send to Slack
FAVOURITE_DISHES List you favourite dishes and if you favourite is available somewhere, menu is sent to Slack

For deployment purposes fill AWS specific parameters to build.gradle.kts.

Running

Running locally

You can run application locally using kotless local Gradle task.

Deployment

Deploying is done using kotless deploy Gradle task.

Debugging

The only way I managed to debug the application locally was using remote JVM debugging with good old VM options -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 and attaching to process.

About

Serverless / Kotlin / Kotless lunch data screen scraper which sends scraped, parsed and formatted data to Slack. Uses Kotless framework and deploys to AWS using Terraform under the hood.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published