zk_html/diary/2016-12-13-part-1.html

61 lines
7.8 KiB
HTML

<!doctype html>
<html>
<head>
<title>Zk | 2016-12-13-part-1</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
<meta name="viewport" content="width=device-width" />
<meta charset="utf-8" />
</head>
<body>
<main>
<header>
<h1>Zk | 2016-12-13-part-1</h1>
</header>
<article class="content">
<hr />
<p>type: serial-post
date: 2016-12-13
slug: part-1
title: How Charming - Part 1</p>
<hr />
<p>When I take a step back and look at it, I&rsquo;m pretty happy with <a href="https://github.com/OpenFurry/honeycomb">Honeycomb</a>.</p>
<p>As part of the <a href="http://furrywritersguild.com">Writers&rsquo; Guild</a>, I take part in weekly&hellip;well, meetings isn&rsquo;t quite the right word. We call them Coffeehouse Chats, which is closer to what they are. They&rsquo;re something between a formal meeting, in that we have a loose schedule to adhere to, and a group of friends meeting up for tea. We start with our accomplishments from the previous week and we end with our goals for the next week, but the intervening forty to fifty minutes are spent basically doing whatever. Sometimes we&rsquo;re organized enough to come up with a topic to occupy us for that whole period, but we&rsquo;re not too stressed if we don&rsquo;t.</p>
<p>During our October 11th Coffeehouse Chat, <a href="http://www.chriswilliamsauthor.com">one author</a> raised a question that occupied us quite thoroughly for the whole allotted hour and quite a bit after.</p>
<blockquote>
<p>Our existing solutions aren&rsquo;t doing a good job of promoting authors and writing in the community because they&rsquo;re so focused on visual art, and submitting written works is often very difficult. Everything non-visual falls by the wayside. There are reasons for that, but, if we had the ideal writing site, what would you expect it to be and what would you want out of it?</p>
</blockquote>
<p>That&rsquo;s the start of a spec if I&rsquo;ve ever heard one, so I perked up and started asking questions. Authors, it turns out, have quite a bit to say on what it is that they would like in a writing site, and quite firm ideas about what is lacking in existing sites. Thank goodness for this being online, as it was easy to turn the logs from the chat into a loose spec.</p>
<p>We settled on the name &lsquo;Honeycomb&rsquo;, a reference to the cozy communal space within the rabbits&rsquo; warren in Richard Adams&rsquo; <em>Watership Down</em>.</p>
<p>Over the next few months, I hammered away in my off time on the project. It felt good to get back in the swing of writing a python app, really, and I was happy to see just how far <a href="https://www.djangoproject.com">Django</a> had come since I last touched it (from 1.4 to 1.10). I picked Django primarily because it was popular and well documented, a good low barrier to entry for any other programmers in the community who would like to help out along the way.</p>
<p>Fast forward to today. I&rsquo;m nearing my self-imposed 0.0.1 milestone, and I&rsquo;ve got a functional site that&rsquo;s got nearly all of the goals I set out to accomplish in place. I&rsquo;ve got a <a href="https://alopex.honeycomb.cafe">QA instance</a> up and running on a linode somewhere in Dallas that the other members of the Guild have been poking at now and then when they have the chance.</p>
<p>The QA instance is limited by necessity. It still uses a sqlite database, for instance, and the search and cache functionalities are disabled. I have Postgres running on that machine already, but with the schema being so in flux during development and migrations leading to some undesired results in the process, it felt less than worth it. I didn&rsquo;t even try to get ElasticSearch or memcached up and running. Nevermind the fact that alopex, that linode in Dallas, is a little underpowered to be posting a site like that alongside <a href="https://polycul.es">all of</a> the <a href="https://characters.openfurry.org">stuff</a> it <a href="https://furrypoll.com">already</a> <a href="https://survey.adjectivespecies.com">hosts</a>.</p>
<p>{% include tech/how-charming/part-1-alopex.dot.svg %}</p>
<p>I wanted something much more robust, though, for Honeycomb, and possibly some other projects. I wanted something that would be easy to scale as needed, and would be easy to spin up as a production-quality stack for even a lay-person. I wanted to figure out a way to make my pie-in-the-sky dreams of running a fancy-pants popular website possible, even if they weren&rsquo;t actually a reality, basically. I wanted caching, searching, load balancing, logging&hellip;I wanted it all!</p>
<p>Unconstrained by reality, I sat down in front of a dot pad (and later a <code>.dot</code> file) and plotted out what it was that I really wanted:</p>
<p>{% include tech/how-charming/part-1-cloud.dot.svg %}</p>
<p>&ldquo;Whoa whoa,&rdquo; I hear you say. &ldquo;Tone it down there, Maddy.&rdquo;</p>
<p>Fine. Grumble grumble.</p>
<p>{% include tech/how-charming/part-1-goal.dot.svg %}</p>
<p>This is what I want, when it comes down to it: separation of concerns, scalability, existing solutions, and tooling to implement everything without needing to start from scratch.</p>
<p><em>Luckily,</em> I work for Canonical on Juju, a DevOps solution that lets you encapsulate deployment methods in packages, called &lsquo;charms&rsquo;, which you can then deploy to a cloud provider. These charms can be composed into bundles and deployed easily to create your application stack - a &lsquo;model&rsquo; - which is managed by juju from a central system - a &lsquo;controller&rsquo; - that you or others control.</p>
<p>With that in mind, I started prowling around through the <a href="https://jujucharms.com">charm store</a> for the stuff that I need. Postgres? <a href="https://jujucharms.com/postgresql/">Check</a>. Apache? <a href="https://jujucharms.com/apache2/">Check</a>. ElasticSearch? <a href="https://jujucharms.com/elasticsearch/">Check</a>. Memcached? <a href="https://jujucharms.com/memcached/">Check</a>. Honeycomb? &hellip;er, well, we don&rsquo;t want to charm something so specific; charms are meant to be reusable. Django, maybe? Well&hellip;there&rsquo;s a <a href="https://jujucharms.com/python-django/">django charm</a>, but it&rsquo;s pretty out of date, and there&rsquo;s no relation for ES or memcached. Likewise, there&rsquo;s a <a href="https://jujucharms.com/uwsgi/">uswsgi</a> and a <a href="https://jujucharms.com/gunicorn/">gunicorn</a> charm, which may come in handy, but which require the existing Django charm.</p>
<p>Hmm.</p>
<p>Well, how about we give writing a WSGI app charm a stab? After all, I like writing in other WSGI compatible frameworks, such as <a href="http://flask.pocoo.org">Flask</a>, so something more generic like that would be useful! Then my stack, proposed above, would apply to any WSGI project I&rsquo;d like to write:</p>
<p><img alt="Our bundle" src="/assets/tech/how-charming/part-1-general.svg" /></p>
<p>There&rsquo;s our bundle, as Juju will see it. The only thing that&rsquo;s missing is the <code>wsgi-app</code> charm that we want to write in the middle there. That&rsquo;s our goal for the next little bit, here: writing a stable and reusable charm and pushing it to the charm store so that we, and anyone else, can use it to deploy our stack.</p>
<p>Next up, we&rsquo;ll be taking a look at charms from two different points of view: hooks and layers.</p>
</article>
<footer>
<p>Page generated on 2020-06-24</p>
</footer>
</main>
<script type="text/javascript">
document.querySelectorAll('.tag').forEach(tag => {
let text = tag.innerText;
tag.innerText = '';
tag.innerHTML = `<a href="/tags.html#${text}">${text}</a>`;
});
</script>
</body>
</html>