Find a file
2022-11-27 23:25:55 +01:00
tritonshell Add tritonshell for nix package manager 2022-11-27 23:07:25 +01:00
.envrc Add tritonshell for nix package manager 2022-11-27 23:07:25 +01:00
.gitignore Add gitignore 2022-11-27 23:07:52 +01:00
docker-compose.yml Init docker-compose.yml and add documentation 2022-11-27 23:25:55 +01:00
Dockerfile using cron in docker 2022-11-27 19:31:34 +01:00
feed2toot.ini Set toot visibility to unlisted 2022-11-27 23:08:11 +01:00
README.md Init docker-compose.yml and add documentation 2022-11-27 23:25:55 +01:00

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. 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
  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
  1. Update running container to a new version
docker-compose --project-name bot up --detach