How To Boot Up A Granola Cluster 101

J
Software Of The Absurd
3 min readMar 21, 2018

Hi, and welcome to my tutorial for Granola, a distributed application framework for high availability planet-scale big data cloud applications as a service. Granola is the hottest, dankest new framework of 2018 and I hope that this easy tutorial will give devs new to this groundbreaking technology a quick and enjoyable introduction.

This introduction requires granola v1.1.10.

Step 1: Install Granola

This is easy enough, just run this command:

sudo apt-get install granola-oats granola-honey granola-craisins granola-walnuts granola-almonds granola-memepack-extra-devel granola-malloc

Step 2: Start Some Oats

Individual nodes in a granola cluster are called oats. To boot up some oats for your application, grab the .egg-info file of your Django app and place it in the /granola/oats/eggs directory. You’ll need to do this as the granola user, because granola requires that no other users are present in the sudoers file. This includes your root user.

Now just run sudo granola oat. You may see a stack trace:

Traceback (most recent call last):
File "/home/ubuntu/hypnos-venv/local/lib/python2.7/site-packages/celery/app/trace.py", line 238, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/ubuntu/hypnos-venv/local/lib/python2.7/site-packages/celery/app/trace.py", line 416, in __protected_call__
return self.run(*args, **kwargs)
File "/home/ubuntu/Hypnos/hypnos/recs_jobber/tasks.py", line 5, in send_sms_action
msg = twilio_client.sms.messages.create(body = sms_action.body, to=sms_action.to_number, from_=TW_NUMBER)
File "/home/ubuntu/hypnos-venv/local/lib/python2.7/site-packages/twilio/rest/resources/sms_messages.py", line 167, in create
return self.create_instance(kwargs)
File "/home/ubuntu/hypnos-venv/local/lib/python2.7/site-packages/twilio/rest/resources/base.py", line 352, in create_instance
data=transform_params(body))
File "/home/ubuntu/hypnos-venv/local/lib/python2.7/site-packages/twilio/rest/resources/base.py", line 204, in request
resp = make_twilio_request(method, uri, auth=self.auth, **kwargs)
File "/home/ubuntu/hypnos-venv/local/lib/python2.7/site-packages/twilio/rest/resources/base.py", line 129, in make_twilio_request
resp = make_request(method, uri, **kwargs)
File "/home/ubuntu/hypnos-venv/local/lib/python2.7/site-packages/twilio/rest/resources/base.py", line 101, in make_request
resp, content = http.request(url, method, headers=headers, body=data)
File "/home/ubuntu/hypnos-venv/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1570, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/home/ubuntu/hypnos-venv/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1317, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/home/ubuntu/hypnos-venv/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1252, in _conn_request
conn.connect()
File "/home/ubuntu/hypnos-venv/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1017, in connect
sock.settimeout(self.timeout)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
TypeError: a float is required

This is normal. If this happens, you’ll need to add the following to your Django app configuration:

SHOULD_CRASH = False

For backwards compatibility reasons, this setting is True by default.

Update v1.1.9: as of this version, use the variable REALLY_SHOULD_CRASH instead of SHOULD_CRASH.

Update v1.1.10: as of this version, use the variable REALLY_SHOULD_CRASH_FINAL instead of REALLY_SHOULD_CRASH.

Start oats on as many machines or VMs as you like. You’ll be given a name for each oat, like oat-3205321036463d8e2b8169cb7cc675eb. Make sure you record what these oat names are. When you start each oat, the granolad daemon will start. Update v1.1.9: granolad is now part of systemd.

Step 3: Honey Your Oats

On any one of the machines with an oat running, run this command:

granola honey <oat-id-1> ... <oat-id-n>

This will use hyper-advanced AI and machine learning to dynamically route all requests to your application and ultra-optimize them. Update v1.1.9: due to metaphysical concerns as well as performance issues with Postgres, all requests are now routed to one oat and ultra-optimization steps are automatically skipped.

And that’s it! Congrats on starting your very own granola cluster! In the next installment of this series, we’ll be using craisins to implement algorithms. This is far and away the dankest, most fucking sick feature of granola and the one that will get you the most rep on StackOverflow too.

--

--