Provides a plaintext representation of a Mastodon post ("toot").
plaintoot print prints a plain-text representation of a single post. Provide a post's URL as an argument.
Grab the latest release, unpack it and run plaintoot for more information.
There is also a Docker image; run it with:
$ docker run --interactive --tty --rm suhlig/plaintootplaintoot serve serves a plain-text representation of a single post via HTTP. It will start an HTTP server listening on $PORT (defaults to 8080) and provide the same functionality as print (see above).
With docker, this would be:
$ docker run --interactive --tty --rm --env PORT=8888 --publish 8090:8888 suhlig/plaintoot plaintoot servewhere we tell plaintoot to bind to port 8888 and then tell Docker to publish on port 8090 what's listening on port 8888 internally.
Install watchexec and start the server like this in order to reload the server process on any file changes:
$ STARTUP_DELAY=10s MAX_UPTIME=20s watchexec --restart go run . serveThe docker image can be built and pushed with
$ docker buildx build \
--push \
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
--tag suhlig/plaintootThis application is intended for use in my course "Web Services" at DHBW. For this purpose, it has some endpoints that showcase Kubernetes' liveness and readiness probes:
/livenesswill generally return200, unless the environment variableMAX_UPTIMEwas set to a valuetime.ParseDurationaccepts and the given time since server start has elapsed. Other paths will still work, but/livenesswill return500thereafter.- If
STARTUP_DELAYis set, the application will sleep for the given duration (see above for the expected format), and only after that the HTTP port will be opened. /readinesswill return200if the authentication with Twitter is successful, otherwise500will be returned.
- Add /metrics exposing
- the number of requests since startup
- uptime