~travisshears/korallenriff-feed

Lambda that build RSS feed for https://www.korallenriff.de/
40ec5dc5 — Travis Shears 3 years ago
add docker deploy info
b0ebac02 — Travis Shears 3 years ago
only upload on new article
9e42a1f5 — Travis Shears 3 years ago
downgrade to only req python 3

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~travisshears/korallenriff-feed
read/write
git@git.sr.ht:~travisshears/korallenriff-feed

You can also use your local clone with git send-email.

Korallenriff feed

Little lambda fn to scrape https://www.korallenriff.de/archivKompakt/2021.html and generate an RSS feed. Great way to stay up on all things German Reef Aquariums.

#Run on local

$ python feed.py

#Deploy

Deploy is a little more complicated then a normal zappa fn, blame feedgen. It relies on a system level package, lxml, to parse xml. If deployed directly from my mac the lambda fails to find this package on the AWS side and crashes. To fix this I'm emulating the aws lambda runtime via a local docker image. If the code is built and deployed from there everything works. How to set that up:

#1. get a copy of mligus zappa docker image

I perfer to build my own because so it will have the latest zappa version. This can be done by cloning the repo https://github.com/mligus/zapp and building the image ex

$ docker build -t zappa-builder:001 .

#2. run the zappa image in your project folder

$ cd project
$ export AWS_PROFILE=personal
$ docker run -ti -e AWS_PROFILE=${AWS_PROFILE} -v ~/.aws:/root/.aws -v $(pwd):/var/task  --rm zappa-builder:001 bash

#3. once in zappa setup a new virtual env

zappa> pip install --user pipenv
zappa> pipenv install

I had some issues with Pipenv.lock but setting python_version to '3' worked both for the container and my mac

#4. source the env and run zappa commands

zappa> pipenv shell
zappa> (venv) zappa deploy production
Do not follow this link