<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by devin hurley on Medium]]></title>
        <description><![CDATA[Stories by devin hurley on Medium]]></description>
        <link>https://medium.com/@snowmiser?source=rss-66f877e57b8b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nxRIKNEGMEIu9jxMh9aTNg.jpeg</url>
            <title>Stories by devin hurley on Medium</title>
            <link>https://medium.com/@snowmiser?source=rss-66f877e57b8b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 00:07:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@snowmiser/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introducing Saturn-GQL: An Opinionated Way to Develop GraphQL API’s]]></title>
            <link>https://itnext.io/introducing-saturn-gql-an-opinionated-way-to-develop-graphql-apis-d99bf4d0790e?source=rss-66f877e57b8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d99bf4d0790e</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[devin hurley]]></dc:creator>
            <pubDate>Wed, 04 Apr 2018 21:59:02 GMT</pubDate>
            <atom:updated>2018-04-09T09:15:31.138Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bAFKrtqovmv99qrJ_rdW4g.jpeg" /><figcaption><a href="https://en.wikipedia.org/wiki/Apollo_17">Apollo 17</a> <a href="https://en.wikipedia.org/wiki/Saturn_V">Saturn V rocket</a> By Unknown NASA employee, scanned by Kipp Teague — <a href="http://www.hq.nasa.gov/alsj/a17/images17.html">http://www.hq.nasa.gov/alsj/a17/images17.html</a> (Image number KSC-72PC-589)Direct link: <a href="http://www.hq.nasa.gov/alsj/a17/ap17-KSC-72PC-589.jpg">http://www.hq.nasa.gov/alsj/a17/ap17-KSC-72PC-589.jpg</a>, Public Domain, <a href="https://commons.wikimedia.org/w/index.php?curid=452085">https://commons.wikimedia.org/w/index.php?curid=452085</a></figcaption></figure><blockquote>TL;DR: Saturn-GQL provides an interface to help you organize your GraphQL endpoints. It is an opinionated library that enforces modularization in your GraphQL API. It utilizes the GraphQL Schema Language which makes it a great fit for projects that utilize the Apollo graphql-tools library.</blockquote><blockquote><a href="https://www.linkedin.com/cws/share?url=https%3A%2F%2Fitnext.io%2Fintroducing-saturn-gql-an-opinionated-way-to-develop-graphql-apis-d99bf4d0790e%3Futm_source%3Dmedium_sharelink%26utm_medium%3Dsocial%26utm_campaign%3Dbuffer">Click here to share this article on LinkedIn »</a></blockquote><p>GraphQL has swiftly risen to the top as <strong>the</strong> number one tool to create API’s with. The ability for the client to dictate what data it wants to receive, as opposed to the old way, has helped usher in a new era of software development. With the ability to understand what the client is requesting, the server can now limit what data it queries for, thus improving performance. But this post is not about GraphQL. It is about the tools that have made GraphQL such a vibrant ecosystem to work within.</p><p>As tends to happen with the best ideas in open source, a vibrant ecosystem of tools have been created around GraphQL and it’s reference implementation. Apollo (founded by Meteor Development Group) is one company that has positioned itself as the go-to destination for open source tools and paid-for products in the GraphQL ecosystem.</p><p>graphql-tools is one such open source library. It came out of Apollo as an opinionated way to build out your GraphQL schemas. It allows for the separation of business logic (how you query your datastores and return that data) from your GraphQL schema definition (i.e. how your mutations, queries, custom scalars etc.. are defined in GraphQL).</p><p>At the open source team I work on, we have developed and open sourced <a href="https://github.com/electric-it/saturn-gql">Saturn-GQL</a>, which builds on top of the ideas presented by Apollo’s graphql-tools. <strong>Saturn-GQL provides an opinionated, yet dead-simple interface to generate a GraphQL schema</strong>. Just pass it the top-level directory containing your GraphQL endpoints (example to follow) and get a fully fleshed out schema written in the GraphQL Schema Language on the other end. This can then, for example, be passed to the makeExecutableSchema tool in graphql-tools to be served through your HTTP server.</p><p>As I mentioned, Saturn-GQL is an opinionated way to create a GraphQL API. If you are working in a large team, or have cross-project teams, utilizing an opinionated library like Saturn-GQL can reduce total development time and can provide a smoother, more efficient on-boarding process for new (internal) teammates to a project. Let’s take a look at a quick example.</p><p>First, install Saturn-GQL with npm install saturn-gql</p><p>The following represents a sample directory structure that would serve as the basis for a GraphQL API server.</p><pre>myapp<br>|___ src/<br>  |___ app.js<br>  |___ api/<br>    |___ users/<br>      |___ index.js<br>      |___ type.js<br>      |___ queries.js<br>      |___ mutations.js<br>      |___ resolvers.js<br>    |___ teams/<br>      |___ index.js<br>      |___ type.js<br>      |___ queries.js<br>      |___ mutations.js<br>      |___ resolvers.js<br></pre><p>Here is the opinionated part. In order to use Saturn-GQL, the files listed in the directory structure above must have an internal structure similar to the following code samples<a href="#c8d2">¹</a>. We will create an example implementation of the users collection above.</p><pre>################<br># type.js<br>################</pre><pre>export const type = `<br>  type User {<br>    id: Int!<br>    firstName: String<br>    lastName: String<br>  }<br>`;<br><br>export const typeQuery = `<br>  users: [User]<br>  getUser(id: Int!): User<br>`;<br><br>export const typeMutation = `<br>  addUser(newUser: User!): User<br>`;</pre><p>With your types now defined, we can create the files that will house the business logic of our application.</p><pre>################<br># queries.js<br>################</pre><pre>export const queries = {<br>  users(_) { return database.getUsers(); },<br>  getUser(_, { id }) { return database.getUserById(id); },<br>};</pre><p>Here is an example mutations.js file:</p><pre>################<br># mutations.js<br>################</pre><pre>export const mutations = {<br>  addUser(_, { user }) =&gt; {<br>    if (!user) {<br>      throw new Error(&#39;Can\&#39;t create user with empty user object&#39;);<br>    }<br>    const newUser = database.createUser(user);<br>    return newUser;<br>  },<br>};</pre><p>There is an option to create a custom resolver in each collection, but for brevity, I will just leave a link to the <a href="https://github.com/electric-it/saturn-gql">official Saturn-GQL docs</a>. And finally just export it all into an index.js file. <strong>The naming of the items that are exported by the index.js file are important</strong>. If they aren’t named exactly like what is below, Saturn will not work as intended. Like I said, <a href="https://github.com/electric-it/saturn-gql/blob/master/src/index.js#L26">it’s very opinionated</a>.</p><pre>################<br># index.js<br>################</pre><pre>import { type, typeMutation, typeQuery } from &#39;./type&#39;;<br>import { queries } from &#39;./queries&#39;;<br>import { mutations } from &#39;./mutations&#39;;</pre><pre>export {<br>  type,<br>  typeMutation,<br>  typeQuery,<br>  queries,<br>  mutations,<br>};</pre><p>So now all you have to do is create a new Saturn object and run makeSchema() . You can then just pass this into the makeExecutableSchema() function from graphql-tools…</p><pre>import Saturn from &#39;saturn&#39;;<br>const saturn = new Saturn(`${__dirname}/api`);</pre><pre>// Graphql Schema<br>const schema = makeExecutableSchema(saturn.makeSchema());</pre><pre>export default schema;</pre><p>… and you’re on your merry way to building out a GraphQL API! You can then import this into your Apollo express-graphql server or however you plan on serving your GraphQL endpoint.</p><p>Hopefully you enjoy our new library! Like I mentioned above, this is a highly opinionated way to implement GraphQL, and certainly not the only way. Saturn-GQL is just one package out of many that summarily add value to the GraphQL ecosystem. It was developed to help us facilitate cooperation and understanding between different development teams, while simultaneously on-boarding new team members quickly. We hope it can do the same for your teams as well!</p><p>Thanks for making it this far into the post. We are open to growing out and expanding features so feel free to <a href="https://github.com/electric-it/saturn-gql">make a pull request</a>!</p><p><a href="#bf16">¹</a> The mutations.js and resolvers.js files are optional as you won’t always need a mutation or a custom resolver within a directory.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d99bf4d0790e" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/introducing-saturn-gql-an-opinionated-way-to-develop-graphql-apis-d99bf4d0790e">Introducing Saturn-GQL: An Opinionated Way to Develop GraphQL API’s</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes: How to Actually Do StatefulSets]]></title>
            <link>https://itnext.io/kubernetes-how-to-actually-do-statefulsets-1a6f5528e901?source=rss-66f877e57b8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a6f5528e901</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[devin hurley]]></dc:creator>
            <pubDate>Wed, 14 Mar 2018 04:49:06 GMT</pubDate>
            <atom:updated>2018-06-04T01:54:07.326Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FWYZ9mEhTs4BkeapJt634A.jpeg" /></figure><p><a href="https://www.linkedin.com/cws/share?url=https%3A%2F%2Fitnext.io%2Fkubernetes-how-to-actually-do-statefulsets-1a6f5528e901">Click here to share this article on LinkedIn »</a></p><p>EDIT: Google has updated their docs and fixed this…</p><blockquote>TL;DR StatefulSets just went GA in k8s 1.9. This is my story as to how I managed to get a StatefulSet deployed to my GKE cluster after battling Google’s tutorial and Kubernetes’ official docs on the matter. Also I finished writing this at 1:00 AM so if you see typos just hmu in the comments.</blockquote><p>Full yaml files are available below. The gist of this story is that I couldn’t figure out how to get a StatefulSet to deploy on GKE. Partly, this was due to Google <a href="https://github.com/kubernetes/kubernetes/issues/59867">not releasing kubectl 1.9 inside their CLI sdk toolkit</a>, another part was Googles tutorials not being fully fleshed out, and the other was probably an issue of me being me and messing stuff up. I managed to get my StatefulSet deployed and this is how I did it. If you know of a better way or know how volumeClaimTemplates work please drop me a line in the comments :)</p><p>As I’ve mentioned in earlier posts here on <a href="https://medium.com/u/504c7870fdb6">Medium</a> and on my personal site, I’m currently building out a slackbot (and looking for beta users so hmu at <a href="https://categorylinksbot.io/">https://categorylinksbot.io</a> ) to help people organize their links. My long term goal is to build a messenger integration for each of the major messaging platforms. Then use that data to build a better advertising product than Google Search. The irony of building an ad platform that beats out Google Search on top of GCP is not lost on me 😜.</p><p>My slackbot requires stateful interactions between requests. I’m using redis to manage these interactions. Redis is great, but if the instance you have redis running on restarts, then all your data is gone. Since I’m running redis as a container on preemptible instances in my GKE cluster (cause i’m cheap), my instances can be restarted at any time with pretty much no warning. I needed to be able to run <a href="https://redis.io/commands/bgsave">BGSAVE</a> on my redis database periodically so as to minimize end-user problems when the preemptible instances would start up again.</p><p>In Kubernetes, the proper way to scale an application that is stateful is to utilize StatefulSets. StatefulSets allow you to create replicas of your application (read: scale it) which can then access the mounted volumes you use to store the file created by BGSAVE.</p><p>First thing’s first, you need to define a PersistentVolume (pv). In the <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/stateful-apps">GCP tutorial</a>, the pv describes the volume about to be mounted. The example in the GCP tutorial has an error. It needs something called a storageClassName to be referenced (next) by the pvc that we create. The example<a href="#440f">¹</a> below is updated to have the storageClassName parameter in the yaml definition. Without it, we wouldn’t be able to bind to this pv.</p><p>Speaking of binding, PersistentVolumeClaims (pvc) will help us do that. Taking a look at that example<a href="#de84">²</a> will again show an <strong>error</strong> -&gt; no storageClassName. <strong>Disclaimer:</strong> if you’re not paying attention and just copy-pasta the files down there, I have added it for you. So you’re welcome :)</p><p>Now when you run kubectl apply -f my-pv.yaml and then do the same for your my-pv-claim.yaml file (aka file<a href="#440f">¹</a> and file<a href="#de84">²</a> respectively), you should see that the claim was able to bind to the pv and running gcloud compute disks list or w/e should also display the disk you created. Please read <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/stateful-apps#submitting_a_persistentvolumeclaim">this section</a> from the tutorial as it explains what to look for when the pvc doesn’t bind to the pv. Something something disclaimer..</p><p>The third piece you need is a service to interface with your StatefulSet. I have an nginx container handling all requests routed to my app, so that service was already created, but I put it below<a href="#a90a">³</a> for clarity and to probably confuse readers who just copy paste what I have in the footer.</p><p>And finally the definition for the StatefulSet which I’m just putting below cause making the footer links is a PITA (also here’s a <a href="https://medium.com/@siranachronist/it-would-be-great-if-we-could-deeplink-footnotes-or-better-yet-show-them-in-the-margins-like-how-f5c8e93464af">link</a> where I learned how to do that). The final problem with the Google tutorial and the official kubernetes docs is the usage of the volumeClaimTemplates section in the StatefulSet definition. For the life of me I could not get this to validate or anything when I ran kubectl apply . I tried to do a bunch of things with no luck. Eventually I did some googling and found <a href="https://blog.couchbase.com/stateful-containers-kubernetes-amazon-ebs/">this blog post</a>. The basic gist is that you should use the persistentVolumeClaim keyword inside of the volumes section of your StatefulSet definition.</p><p>Basically your StatefulSet definition should look like this..</p><pre>apiVersion: apps/v1beta2<br>kind: StatefulSet<br>metadata:<br>  name: [STATEFULSET_NAME]<br>spec:<br>  serviceName: [SERVICE_NAME]<br>  replicas: 3<br>  template:<br>    metadata:<br>      labels:<br>        app: [APP_NAME]<br>    spec:<br>      updateStrategy:<br>        type: RollingUpdate<br>      containers:<br>      - name: [CONTAINER_NAME]<br>        image: ...<br>        ports:<br>        - containerPort: 80<br>          name: [PORT_NAME]<br>        volumeMounts:<br>        - name: my-volume<br>          mountPath: /data-or-something<br>      <strong>volumes</strong>:<br>        - ...<br>        - name: my-volume<br>          <strong>persistentVolumeClaim</strong>:<br>            claimName: <strong>$$YOUR-PVC-NAME</strong></pre><p>That should be it! Post in the comments section any questions you have. I hope this serves as a good troubleshooting reference page for anyone who gets stuck doing StatefulSets. Everyone in the k8s community says k8s is still trying to get stateful apps right. I think StatefulSets are a step in the right direction. They are a huge feature that will provide a ton of value to small-time developers like myself. I’m looking to actually move off of Google’s Cloud SQL instance and just run a StatefulSet postgres container in k8s, and save some money that way. I’m also hopeful that more people will use StatefulSets to build really cool stuff in k8s.</p><p><a href="#9d01">[1]</a>:</p><pre>apiVersion: v1<br>kind: PersistentVolume<br>metadata:<br>  name: $$NAME-ME-SOMETHING<br>spec:<br>  capacity:<br>    storage: 20Gi<br>  storageClassName: manual<br>  accessModes:<br>    - ReadWriteOnce<br>  gcePersistentDisk:<br>    pdName: [PD_NAME]<br>    fsType: ext4</pre><p><a href="#11a9">[2]</a>:</p><pre>apiVersion: v1<br>kind: PersistentVolumeClaim<br>metadata:<br>  name: $$NAME-ME-SOMETHING<br>spec: <br>  storageClassName: manual<br>  accessModes:<br>    - ReadWriteOnce<br>  resources:<br>    requests:<br>      storage: 20Gi</pre><p><a href="#3fd2">[3]</a>:</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: myApp<br>  namespace: default<br>spec:<br>  ports:<br>  - port: 80<br>    targetPort: 80<br>    protocol: TCP<br>  type: NodePort<br>  selector:<br>    run: myApp</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a6f5528e901" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/kubernetes-how-to-actually-do-statefulsets-1a6f5528e901">Kubernetes: How to Actually Do StatefulSets</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GKE 1.9.x StatefulSet incompatibility with kubectl 1.8.x]]></title>
            <link>https://medium.com/@snowmiser/gke-1-9-x-statefulset-incompatibility-with-kubectl-1-8-x-de90310df6b?source=rss-66f877e57b8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/de90310df6b</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[google-container-engine]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[google-cloud]]></category>
            <dc:creator><![CDATA[devin hurley]]></dc:creator>
            <pubDate>Mon, 12 Mar 2018 02:36:43 GMT</pubDate>
            <atom:updated>2018-03-12T02:36:43.097Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>TL;DR Google does not have kubectl 1.9.x readily available, and now I can’t delete my failed StatefulSet on GKE.</blockquote><p>I’ve been trying to get a StatefulSet up and running on GKE. Overall the process has been abysmal at best. Something something documentation.. However, the greatest part of this whole fiasco has been the fact that the google cloud sdk cli tool gcloud will not install kubectl 1.9.x. It’s unavailable apparently in Google’s SDK..</p><p>The reason this is hilarious is because without kubectl 1.9.x, <a href="https://github.com/kubernetes/kubernetes/issues/59867">you cannot delete StatefulSets</a>. Wonderfully, I have a StatefulSet that I need to delete because it failed to deploy properly. The obvious thing would be to upgrade kubectl. Running gcloud components update says that everything is up to date, and that 1.8.x is the most up to date version of kubectl Google has readily available to download.</p><p>Obviously now that I have upgraded my master node on GKE to 1.9.3, I cannot downgrade it. Or at least I haven’t found a way yet.</p><p>Now I’m stuck with this StatefulSet, that failed to launch, and cannot be deleted. Any help <a href="https://medium.com/u/4f3f4ee0f977">Google Cloud</a>? Could you maybe push kubectl 1.9.x to be available via gcloud components update ?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de90310df6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes: Binding PersistentVolumes and PersistentVolumeClaims]]></title>
            <link>https://medium.com/@snowmiser/kubernetes-binding-persistentvolumes-and-persistentvolumeclaims-33323b907722?source=rss-66f877e57b8b------2</link>
            <guid isPermaLink="false">https://medium.com/p/33323b907722</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[devin hurley]]></dc:creator>
            <pubDate>Thu, 08 Mar 2018 04:46:45 GMT</pubDate>
            <atom:updated>2018-03-08T04:46:45.663Z</atom:updated>
            <content:encoded><![CDATA[<p>What Google didn’t tell me :(</p><p>I’m (almost continually at this point) developing a slackbot that requires state to be managed between requests. To do this, I am using redis to manage information about interactions and relevant information about each slack team. Due to the fact that I am utilizing Google’s super cheap preemptible instances on GKE, my slackbot can lose state at any time. To compensate for this fact, I wanted to utilize redis’s neat BGSAVE command to periodically save state of the users interactions with my slackbot. So the ability to recover that state would be super helpful. However, BGSAVE requires a volume be mounted to the redis container in order for the container to actually save the file, and with kubernetes you can’t exactly just say, “oh use whatever drive is attached to the node in the node-pool you are scheduled to.” for some reason…</p><p>To solve this problem, you need to create a StatefulSet. So I decided to go ahead and read this <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/stateful-apps">tutorial</a> on StatefulSets by GCP. The first two things it has you create are the following:</p><ul><li>PersistentVolume (pv) definition</li></ul><pre>apiVersion: v1<br>kind: PersistentVolume<br>metadata:<br>  name: redis-pv<br>spec:<br>  capacity:<br>    storage: 10Gi<br>  <strong>storageClassName: manual</strong><br>  accessModes:<br>    - ReadWriteOnce<br>  gcePersistentDisk:<br>    pdName: redis-disk<br>    fsType: ext4</pre><ul><li>PersistentVolumeClaim (pvc) definition</li></ul><pre>apiVersion: v1<br>kind: PersistentVolumeClaim<br>metadata:<br>  name: redis-pv-claim<br>spec:<br>  <strong>storageClassName: manual</strong><br>  accessModes:<br>    - ReadWriteOnce<br>  resources:<br>    requests:<br>      storage: 10Gi</pre><p>You can define these however you want according to <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/">these specs</a>, but the thing I didn’t know (and is not explicitly mentioned in the GCP article) is that in order for the pvc to actually bind to the pv, you need to give both of them the same <strong>storageClassName</strong> in the yaml definition. Without this, the pvc will not know where to bind and will just create a pv automatically, which is really cool, but not what I’m trying to do right now when I already had provisioned a disk in GCP.</p><p>My intuition lead me to believe if you just use a label selector or something then the pvc would figure out which pv has that label and would just bind to it, but apparently that’s not a thing. Google should update their documentation to reflect this. Maybe I should open an issue… ?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33323b907722" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>