I installed CoreOS in 9 years old MacBook.
Because I didn’t know too much about servers I used to use a cheap hosting with PHP and MySQL. But some time ago, when I started to build Ruby on Rails and Node.js apps I was searching for a better option and I discovered the world of PaaS. That changed the way I deploy now.
At the beginning, there was a lot to understand because I used to use, like many other web developers, just an FTP to update my site, but after a couple of days working with git I understood how to deploy with a push and that was like music to my ears.
Then I tested a lot with Vagrant: it was so easy to create and destroy machines that I installed every version of Ubuntu, Apache, Nginx, MySQL, Node, MongoDB I could… I learnt a bunch of things making a lot of mistakes.
After some time learning and configuring servers, I thought: “Hey! I got enough knowledge to set up my own machine”. Actually that kind of “server” you know, for fun, at home. And because I like to remember what Doc Brown said:
“The way I see it, if you’re gonna build a time machine into a car, why not do it with some style?”
It couldn’t be as fun as travel in time, but I wanted to build a server with an old MacBook and mix it with a new shiny Linux. My own time machine.
6 horses != 88 mph and 64bit != 32Bit
The first problem I remember in the MacBook2,1 was that you couldn’t install Snow Leopard.
In that model Apple mixed a 32bit EFI boot with a 64bit processor and because of that you can’t install “El Capitan”, actually you can, well you really not, never mind, it will not boot anyway because of the EFI.
After a while googling I found an article talking about hacking the OS X boot process to start it in 64bit mode, but since I didn’t want to get OS X but Linux it was a waste of time. But… I got some good ideas from there!
My original idea was to get Docker running into the Raspberry Pi and use it as a web server. I used the hypriot image, but I found a lot of problems building libs for ARM. So I decide to search for a different distro: a minimal one to run Docker. That’s when I discover CoreOS. The problem is that CoreOS doesn’t work (yet) on ARM, so I return to the Mac.
The Plutonium: CoreOS
CoreOS is an open-source lightweight operating system based on the Linux kernel and designed for providing infrastructure to clustered deployments.
At first I thought about install it into the MB, but CoreOS is a 64bit only operating system. At this point, I got crazy and I wanted to run CoreOS at whatever cost. (Like Marty driving trying to escape from the Libyans)
Who wants to boot a MacBook with Ubuntu 32bit, create a virtual machine with CoreOS 64bit inside and run on it some Docker containers? Me!
Return to the past to fix the future
My first attempt (in fact after the 15th CD-ROM burned) was to boot Ubuntu Server 32bit with a virtual machine running CoreOS 64bit and run some containers, and it worked!
I know, you are thinking: “It’s a waste of resources.”, you are right. I deleted everything and I started from scratch.
The flux capacitor: MacBook2,1 meets CoreOS
A couple of years ago I have installed Linux Mint side by side with OS X. With some help from rEFIt I got the dual boot working. So why don’t try to use the same approach?
Actually the solution was quite simple: I started rEFInd from a USB stick, then CoreOS from the CD, once CoreOS was installed into the hard disk you have to make those changes permanent. You have to make some changes to the boot and then run it as usual to get this beautiful view:
OK, is not beautiful but it does the job!
Back to the future
The server is running fast. In fact, is running faster that many other servers I use. I’m running 6 containers and is using only 120-160MB of 2GB of RAM available. The 2 cores are at ~1%, so everything seems normal.
So, what I learnt from this crazy idea:
- CoreOS is the lightest/fastest OS I ever tried and Docker into it is like mix a cookie with dulce de leche.
- I learnt a lot about Docker, how to build images, run and manage containers. In fact, I have tried many times to understand how Docker works but this is the first time I obtain some interesting result. Now I’m using it for almost every app I make.
- I also discovered RancherOS, another distro similar to CoreOS that “is a 20mb Linux distro that runs the entire OS as Docker containers”.
- My MacBook2,1 is almost a decade old but still working like the first day. It has the left arrow key and the touchpad broken but who cares in a server!