“Caches can make good things better, but they can’t make something wrong good”
— Allard Buijze
All posts by loomchild
“Frameworks are an inversion of control.”
— Paul Lewis
Puffin 0.7
I am very happy to announce next release 0.7 of Puffin. It’s been a while since the last one, but there are many exciting features.
First of all Puffin now supports backup & restore using volume-backup. Before the operation, application needs to be stopped, in order to prevent any data inconsistency. Due to its simplicity, all applications support it out of the box.
Second notable feature is HTTPS support. It can be activated in app settings. Under the hood it uses Let’s Encrypt to generate individual free certificates.
Finally there are two new important apps that I am using daily on Puffin:
- Nextcloud – a free and open-source Dropbox on steroids,
- Mastodon – a decentralized, open source social network.
In the future i hope to keep more regular and frequent release cycle.
Happy hosting!
Sojourner
I am happy to announce new version of Sojourner FOSDEM conference companion. Last time it was a mobile app for Nokia N900 phone, now it’s a progressive web app, available on mobile and desktop environment. The goal is to make it fully usable offline (not yet fully working).
You can access it here: https://sojourner.loomchild.net and the code can be found here: https://github.com/loomchild/sojourner-web. The original mobile app can be found here: https://github.com/loomchild/sojourner.
All feedback welcome!
This blog is finally available via HTTPS thanks to wonderful Let’s Encrypt.
Backup & Restore Docker Named Volumes
Note: I published refreshed version on Medium
I finally started implementing backup & restore feature for Puffin. The first issue I encountered was to make a backup of named volumes.
The official Docker documentation mentions only data volume containers and –volumes-from option. There’s also docker cp command, but it requires knowing the path where the volumes are mounted in the container that uses them.
It turns out it’s pretty easy to do using volume mounts and tar
.
To backup some_volume
to /tmp/some_archive.tar.bz2
simply run:
1 2 3 |
docker run -it --rm -v some_volume:/volume -v /tmp:/backup alpine \ tar -cjf /backup/some_archive.tar.bz2 -C /volume ./ |
And to restore run:
1 2 3 |
docker run -it --rm -v some_volume:/volume -v /tmp:/backup alpine \ sh -c "rm -rf /volume/* /volume/..?* /volume/.[!.]* ; tar -C /volume/ -xjf /backup/some_archive.tar.bz2" |
I have chosen alpine
image since it’s lightweight and contains everything what’s needed. One potential issue might be preserving file ownership since different users and groups exist on different containers. Classical solution to this problem is to run the tar command using the same image as the one normally using the volume instead of alpine
, but what if there’s no tar
there? Using numeric owner generally preserves permissions correctly, unless you also use user namespaces. Also you need to remember to stop all the containers using the volume being backed-up or restored, otherwise an inconsistent / intermediate state the data might be archived.
Ultimately I wrote my own little volume-backup utility for backup and restore of volumes that simplifies the process even further and offers some improvements. Example usage (see README for more details):
1 2 3 4 5 6 |
docker run --rm -v some_volume:/volume -v /tmp:/backup loomchild/volume-backup \ backup some_archive docker run --rm -v some_volume:/volume -v /tmp:/backup loomchild/volume-backup \ restore some_archive |
Feel free to check it out and let me know what do you think.
Edit: Changed the cleanup code to delete hidden files – thanks for a comment Olivier.
Edit: It’s also possible to backup to standard output and restore from standard input. I added this capability to volume-backup – thanks for a comment, suggestion and example Holger
Edit: Added –rm flag to remove the container when finished, thanks awade.
Puffin talk at FOSDEM
I presented a short talk about Puffin in Decentralised Internet developer room at FOSDEM 2017.
Here’s the full video (there’s some technical glitch, audio is shifted a bit, sorry for that):
Please let me know what do you think in the comments.
Practical Introduction to Docker
Few months ago I presented a talk at my internal company Conference. In it I present basic Docker commands, persistent storage, networking and building images.
Here’s the full video:
Docker Can Create Only 31 Networks per Machine
Note: I published refreshed version on Medium
I have just learned that in Docker there is a limit of 31 networks for default network driver on a single machine:
1 2 3 4 5 6 7 |
$ docker network create test1 1a9b51e0e63a8f23789a339b864de68356ed7728c82b005c8eb861426a6c9621 ... $ docker network create test31 9af63a9e0228506ac6777f9ff974c2f8d1837ade2b4ebe270bd329a278d837da $ docker network create test32 Error response from daemon: failed to parse pool request for address space "LocalDefault" pool "" subpool "": could not find an available predefined network |
This is due to the fact that it uses hardcoded list of broad network ranges – 172.17-31.x.x/16 and 192.168.x.x/20 – for bridge network driver. Look into ipamutils and allocator for more details. For overlay network driver 64K networks can be created.
There seems to be no solution to circumvent this limitation apart from manually specifying subnet ranges for each created network – see Docker network create subnet option and Docker Compose network configuration reference. In Puffin, which needs to create a separate network for each application, I implemented a simple address allocator.
Task Warrior like a boss:
task add due:yesterday Post a new article on my blog