Writing (Another) Avatar Service
This story probably sounds familiar: you are in the middle of implementing a new webapp, writing the code necessary to support user profiles. You realize that you want to support user avatars (because users absolutely want to be able to choose their avatar), but you don't want to create and maintain a service just to host images of users.
You could use Gravatar, but the problem with this is that Gravatar requires that users upload their avatars using the Gravatar website and doesn't allow you to provide your users a convenient upload mechanism directly from within their profile on your app.
After having written 3 or 4 of these myself, I realized they basically take the same form. So, when I was faced with this problem again with FoamFactory, I decided I wanted to write a single, self-contained microservice that could be reusable whenever I (or someone else) needed it. This also gave me a chance to write a web service in Rust and to renew some of my skills with Docker.
Enter Archtype. This is a small service designed to provide avatars that you can use for your web app. It has a very simple API that can be used with both image/jpeg
and image/png
files. To set it up, perform the following on your server that has the docker
daemon running:
git clone git@github.com:FoamFactory/archetype
cd archetype
# Edit docker-compose.yml to assign the ALLOWED_HOSTS variable properly.
# Since this is the only security level available right now, you must
# specify at least one IP address for machines you want to be able to
# access the avatar service.
docker-compose up -d
How to setup archetype
Yup, that's it! If you want, I'll even set it up for you and maintain it, for $36/year (slightly more if you want me to setup a Linode instance that you can own and maintain yourself).
Hopefully, this saves you time in the future from having to re-write avatar services from scratch every time you create a new app that requires them.