I’ve been moving my services to Docker lately because it suits my needs an ease my life a lot, but I was kind of stuck when wanting to move my Diaspora pod into containers.
Indeed, the Diaspora project doesn’t have any official Docker image, including a Dockerfile, docker-compose.yml or any kind of instructions or guide, because none of the core developers actually use Docker so they’re still searching for someone to maintain one.
What about third-party images then?
Brad Koehn did a great job at maintaining a great Docker image for the past few months, however it seems really overly complicated for me (lots of stuff outside the Dockerfile).
And that’s the only maintained image as of today, so that doesn’t really leave us with much choice.
The best way to have an image that suits my needs and vision is… to create one myself. And that’s what I did: https://hub.docker.com/r/angristan/diaspora/
It required me a few hours of work to get it done, but it’s actually pretty simple!
Basically, I just start from the official Ruby Debian-slim image and follow the regular instructions, e.g. Installing dependencies, downloading the source code, and installing gems.
I would like to use Alpine as base but I encountered a bug when installing the gems, which is not likely to be fixed soon.
I use my image with Docker Compose, as described in the README, so I can start it with PostgreSQL, Redis and Nginx. I use the same image for Sidekiq and Unicorn (the web server), but specify different commands in the docker-compose.yml
.
Moving my pod, dspr.io, to containers was really easy actually: I copied my public/uploads
folder, my dump.rdb
for Redis and imported my dump for PostgreSQL. Then I configured my reverse proxy and I was ready to go!
Updating the pod is also super simple now, I just have to update the version numbers on my repo, pull the image on my server and run two rake tasks.
I’m glad I don’t have to mess with Ruby versions on my server anymore! That’s what Docker is for.
It was an interesting experience to create an image from scratch. It’s clean and minimalist, so easily maintainable, maybe a good candidate for an official image?
Anyway, if you’re interested in launching your pod with Docker or migrating it, the repo should explain all you need. 😀