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/plaintoot
plaintoot 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 serve
where 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 . serve
The docker image can be built and pushed with
$ docker buildx build \
--push \
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
--tag suhlig/plaintoot
This 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:
/liveness
will generally return200
, unless the environment variableMAX_UPTIME
was set to a valuetime.ParseDuration
accepts and the given time since server start has elapsed. Other paths will still work, but/liveness
will return500
thereafter.- If
STARTUP_DELAY
is 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. /readiness
will return200
if the authentication with Twitter is successful, otherwise500
will be returned.
- Add /metrics exposing
- the number of requests since startup
- uptime