Before we begin discussing my weekend project, let me ask you a little question. A question that you might have pondered upon at some or the other moment of life. A question that excites some and confuses others. A question whose answer holds more value than what meets the eye at first glance. A question with many answers in theory but only a few in practice. A question, to find the answer to which, I sacrificed my weekend!
Behold The Question
How much would it cost you if your mobile were to get stolen tomorrow? How costly would it be if your mobile were to fall into the water and get all its data erased tomorrow? How much would you end up losing if your mobile slipped into the toilet tomorrow? How much would end up losing?
Point taken, Misty. But, to some, it might cost the business data. To others, it costs the beautiful and valuable memories. The memories of the time spent with friends on the beach, memories of time with their besties at the shopping mall, memories with their bros at the gaming club, memories of their dogs farting or the memories of their kids burping or the memories of their burping kid riding the farting dog! To some it might even mean the loss of their carefully syphoned and meticulously alphabetized collection of po… err… forget I ever mentioned that! It’s a family-friendly website.
Though there are some unsocial birds like myself to whom the answer might be as simple as the loss of a mobile handset! And the collection of our favourite rock bands’ discographies. And the collection of the pics of that kitten by the roadside. And that one kitten we found outside the restaurant. And the one who couldn’t climb the tree nor could get off of it. And the kitten who purrs every time she sees us.
The point is that we all have important data on our mobile that we do not want to lose. So, what do we do? What’s our disaster recovery plan for the mobile data?
At first, it seems like a good idea but there are some challenges to it too. Some of us might not have the bandwidth enough to upload a 900 MB video. Others might not have enough space on a free cloud account to upload the entire song collection on it. Some of us might also be concerned about the increasing number of data breaches on the internet. Where do we go now?
How about a local, personal cloud?
Just imagine how awesome would it be to return from your office and simply turn on your mobile Wifi and all your data gets backed up automatically! Sounds like a great idea and that’s exactly what I created this weekend. A personal cloud to back everything up. But, hold on a second! Doesn’t it take an ugly-looking, overworking, under-exercised hardcore computer nerd to create one? Well, not exactly!
The technology that I have used here is Docker. ‘Why?’, you ask? Because it makes things easier to deploy. We’d need docker for creating our Syncthing container but, I’m not going to dive into the internal working of Docker as it’s a huge topic in itself. Nor am I going to show the installation of Docker on your platform (Windows, Linux, Mac, etc.). You can find that online on hundreds of website and it’s quite a simple process to get it installed. What I am going to do is tell you how to use the Dockerfile I created to back up your mobile data.
You can find the Dockerfile on my Github repository
The content of the Dockerfile is pretty self-explanatory. It uses an Ubuntu image for the ARMv7 processor (Why ARM? Keep reading and you’d know), updates the system, installs Syncthing, replaces the XML file with our own, creates a user to run Syncthing and a directory where Syncthing will keep all the backups. We’ll mount this directory onto our host as we don’t want our backup to reside inside an isolated and containerized environment.
The main reason why I loved this project is that I have an Orange Pi board and I used it to host my container on. That also explains why I used an ARMv7 image instead of the default, AMD image. A lot of people wouldn’t know that Docker containers are platform independent but not architecture independent. So, you can run a Linux image onto a Windows platform but you cannot run an ARM’s image on an AMD machine.
I’ve configured my Router to reserve my Pi board’s IP address. By doing this, I could be sure that my Pi board always gets the same IP address on my WiFi network, which in my case happens to be 192.168.0.101. I used this address to configure my Syncthing mobile client and inform it about the Backup server’s location. This isn’t really necessary as I found out (it was too late, though) that Syncthing nodes can detect each other on the same network using a technique called the “Local Discovery”. The client uses the network’s broadcast IP address to fan out messages to all the other nodes on the network, letting them know of its presence on the network.
I guess it’s getting too long here. So, it’d continue with the setup in the next blog, Setting Up Crypt.