Collects reports of #weeknotes and collates them into a blog post
Not a complete set of instructions, needs fleshing out more...
- Run
bundle install
- Create a YAML file for the config
Then there are three main operations:
bundle exec ruby find_toots.rb
to find relevant posts on Mastodon and ask for consent if neededbundle exec ruby check_consent_requests.rb
to check for responses to consent requests
Those two should be run regularly to gather the data needed by the third script:
bundle exec ruby generate_weeknotes.rb NAME-OF-CONFIG-FILE.yaml
which is run once-a-week to create the weeknotes post.
We run the code under Docker
when deployed.
- Clone the repo
- Generate the
Gemfile.lock
file:docker run --rm -v "$PWD":/usr/src/app -w /usr/src/app ruby:3.1 bundle install
- Build the image
docker build -t weeknotes .
- Set up webserver to serve the static files. The docker setup expects this to be available as a volume mounted at
/var/local/media_root
- Create a folder to hold the work files (list of who has given consent, toots ready to publish, etc.). The docker setup expects this to be available as a volume mounted at
/var/local/workfiles
- Create the config YAML file called
weeknotes-config.yaml
. This should live in the folder used to contain the work files (docker expects to find it at/var/local/workfiles/weeknotes-config.yaml
) - Set up cron to run:
docker run [add volume arguments] weeknotes [operation]
If you need to pull in a Mastodon post that hasn't been picked up automatically (e.g. if it was posted as unlisted
or you forgot the #weeknotes
tag) then you can download them manually.
- Get the status ID from the post in the web interface. It's the long number at the end of the URL for it. NB: I'm not sure what the case would be for posts made on other servers, which are then federated!
- Run
curl -H 'Authorization: Bearer INSERT-BEARER-TOKEN-HERE' https://MASTODON-SERVER/api/v1/statuses/STATUS-ID > mastodon-ready-to-publish/all/STATUS-ID.json
That will store the JSON version of the post in the right place for the generate-weeknotes.rb
script to pick it up next time it generates the weeknotes.