55 lines
1.9 KiB
Markdown
55 lines
1.9 KiB
Markdown
# HackerNews -> Mastodon Bridge
|
||
|
||
This repo contains config to consume the HackerNews RSS feed (https://news.ycombinator.com/rss) and to toot the messages to https://mastodon.pub.solar/@hackernews_bot, a mastodon bot.
|
||
|
||
The dockerfile builds a container that uses [feed2toot](https://feed2toot.readthedocs.io/en/latest/use.html). All stateful data is expected to be mounted under `/data`, namely:
|
||
|
||
* `feed2toot.ini`: config file in this repo
|
||
* `feed2toot_clientcred.txt`: from `register_feed2toot_app` script
|
||
* `feed2toot_usercred.txt`: from `register_feed2toot_app` script
|
||
* `feed2toot_cache.db`: cache file to register previous posts
|
||
|
||
Docker image was built like this and pushed to registry:
|
||
```
|
||
docker build -t registry.greenbaum.cloud/library/mastodon-hackernews-feed2toot:0.0.1 .
|
||
docker push registry.greenbaum.cloud/library/mastodon-hackernews-feed2toot:0.0.1
|
||
```
|
||
|
||
Initial deployment, just for documentation, **don't run this for updates**:
|
||
```
|
||
# Run the steps from Deployment of updates section
|
||
# After initial deployment, copy secrets and cache file to volume mounted on /data
|
||
❯ find . -name 'feed2toot*' -type f
|
||
./feed2toot.ini
|
||
./secrets/feed2toot_clientcred.txt
|
||
./secrets/feed2toot_cache.db
|
||
./secrets/feed2toot_usercred.txt
|
||
|
||
❯ for FILE in $(find . -name 'feed2toot*' -type f -printf "%f\n"); \
|
||
do \
|
||
docker cp ./secrets/$FILE bot_mastodon-hackernews-feed2toot_1:/data/$FILE; \
|
||
done
|
||
❯ docker cp ./feed2toot.ini bot_mastodon-hackernews-feed2toot_1:/data/feed2toot.ini
|
||
|
||
# Uncomment external option of volume
|
||
```
|
||
|
||
Deployment of updates:
|
||
1. Get [tritonshell](https://git.greenbaum.cloud/dev/tritonshell)
|
||
2. Enter `tritonshell` for DC `cgn-1`
|
||
```
|
||
cd tritonshell
|
||
nix develop --command $SHELL
|
||
eval "$(triton env cgn-1-pub_solar)"
|
||
cd ..
|
||
|
||
# Optional
|
||
# Check for running container
|
||
docker ps -a | grep mastodon-hackernews-feed2toot
|
||
```
|
||
|
||
3. Update running container to a new version
|
||
```
|
||
docker-compose --project-name bot up --detach
|
||
```
|