Starting notes of songs. A Telegram bot calling a GraphQL API sitting on top of a DynamoDB table.
How to get things up and running:
- Build lambda layers for Telegram bot and API
- run
py build_layers.py
(see below for a more detailed description)
- run
cd infra && terraform apply
- Acquire bot token and store it in SSM (created by Terraform)
- Set up a webhook to the bot's function url
- check the API's URL and set it as an environment variable
API_URL
and runpy set_webhook.py
- you can do
terraform show aws_lambda_function_url.graph_api_lambda_url
to get the value - you could probably automate this with lambda somehow, too.
- you can do
- after this the bot should be functional!
- check the API's URL and set it as an environment variable
Terraform doesn't handle lambda layer building particularly well, so there's a utility script build_layers.py
which:
- Exports dependencies from poetry
pip install
s the dependencies to gitignored folders- zips the folders
This script is handy when doing version upgrades or adding new dependencies. Packaging everything with Docker might be a nicer option, though.
Run uvicorn graph.lib.schema:app
to start a local API instance (against production DB).