<?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 James von Hagel on Medium]]></title>
        <description><![CDATA[Stories by James von Hagel on Medium]]></description>
        <link>https://medium.com/@onefabulousginger?source=rss-b5c8c0516d16------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eK0J5Zms0lHW4Err4e3s5g.jpeg</url>
            <title>Stories by James von Hagel on Medium</title>
            <link>https://medium.com/@onefabulousginger?source=rss-b5c8c0516d16------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 20:10:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@onefabulousginger/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[Using GitHub Actions to deploy to GKE with Helm.]]></title>
            <link>https://medium.com/@onefabulousginger/using-github-actions-to-deploy-to-gke-with-helm-81855414db0b?source=rss-b5c8c0516d16------2</link>
            <guid isPermaLink="false">https://medium.com/p/81855414db0b</guid>
            <category><![CDATA[gke]]></category>
            <category><![CDATA[helm]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[James von Hagel]]></dc:creator>
            <pubDate>Thu, 04 Jun 2020 14:52:25 GMT</pubDate>
            <atom:updated>2020-06-04T14:52:25.922Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*02GCyquvyJgVXNmI" /><figcaption>Photo by <a href="https://unsplash.com/@andrewtneel?utm_source=medium&amp;utm_medium=referral">Andrew Neel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this example, I used <a href="https://cloud.google.com/kubernetes-engine">Google Kubernetes Engine(GKE)</a>. I created a cluster using Terraform and deployed my application using <a href="https://helm.sh/">Helm v3</a>. I also wanted to explore GitHub Actions and run a job on any push to the master branch.</p><p>To start working with GitHub Actions, there will need to be a workflow file, which is very similar to a Jenkinsfile. GitHub already provides many CI starter workflows: <a href="https://github.com/actions/starter-workflows/tree/master/ci">https://github.com/actions/starter-workflows/tree/master/ci</a></p><p>Since I’m using GKE, I based mine very closely to the google.yml file, and added it to my repository like so:</p><pre>.github<br>└── workflows<br>    └── gke.yml</pre><p>I also need to add some <a href="https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets">GitHub secrets </a>to store sensitive data, the GCP account information, and my app requires an API token. Here is how I’m referencing them in the workflow file.</p><pre>${{ secrets.GKE_EMAIL }}<br>${{ secrets.GKE_KEY }}<br>${{ secrets.GIPHY_API }}</pre><p>BTW! the GKE_KEY is not the key value on the service account, it’s the entire value of the key JSON file.</p><p>I already have my Helm chart so now all that is left is to commit the workflow and push it to my repository. Here is a my gke.yml file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb0b896d36f4b377ba7cd3404888331d/href">https://medium.com/media/fb0b896d36f4b377ba7cd3404888331d/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*WJ3g7596qp85eJ1E4wIoHg.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F26FPnsRww5DbqoPuM%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F26FPnsRww5DbqoPuM%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F26FPnsRww5DbqoPuM%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="237" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fa5dab1bf1c2a776f3bd00f1eb20ea2/href">https://medium.com/media/5fa5dab1bf1c2a776f3bd00f1eb20ea2/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81855414db0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fully automated infrastructure and code deployment using Ansible and Terraform.]]></title>
            <link>https://medium.com/@onefabulousginger/fully-automated-infrastructure-and-code-deployment-using-ansible-and-terraform-2e318820fe0c?source=rss-b5c8c0516d16------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e318820fe0c</guid>
            <category><![CDATA[elastic-container-service]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[haproxy]]></category>
            <dc:creator><![CDATA[James von Hagel]]></dc:creator>
            <pubDate>Mon, 09 Mar 2020 15:23:08 GMT</pubDate>
            <atom:updated>2020-03-09T15:23:08.608Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="It’s a bull on a topic for AnsiBLE" src="https://cdn-images-1.medium.com/max/1024/0*94gfasA8-P8D0-Xt" /><figcaption>Photo by <a href="https://unsplash.com/@christianw?utm_source=medium&amp;utm_medium=referral">Christian Wiediger</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Ansible and Terraform can be used together to build/deploy any docker images, and create the AWS ECS services that will host it by using one command. This story will also go over how to utilize HAProxy with AWS service discovery to route and load balance traffic to the correct ECS services.</p><p>The following will be used to accomplish this and all have fantastic documentation.</p><ul><li><a href="https://docs.ansible.com/ansible/latest/index.html">Ansible</a></li><li><a href="https://www.terraform.io/docs/index.html">Terraform</a></li><li><a href="https://docs.docker.com/">Docker</a></li><li><a href="https://www.haproxy.org/">HAProxy</a></li></ul><p>An overview of the solution is below; I will go over each part that will be used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*NZgCD7AmiznmzCEKeUubUg.png" /></figure><ul><li>The ALB will have a listener for the host header for the *.haproxy.domain and any host header matching will be forwarded to the HAProxy target group. The listener will be set up in this example with Terraform, while the ALB, and Route53 record for the wildcard, was previously set up using Terraform.</li><li>The HAProxy target group will have the container that is running HAProxy and this target group will be set up in this example with Terraform.</li><li>The ECS cluster will have a service for HAProxy and any number of services that will serve as the frontend, and Ansible will be setting these up.</li><li>The ECS cluster will be pulling the docker images from ECR to run HAProxy and any frontend services, this will also be set in Ansible.</li><li>The frontend services in the ECS cluster will set a separate service registry in a namespace for each frontend service and will be set with Ansible. The namespace was previously created with Terraform.</li><li>The service registry will then add the records for the container whenever a task is activated on every frontend service per container.</li><li>HAProxy will check and route traffic to the services by resolving the service records in Route53, provided by service discovery.</li></ul><p>I have pushed an example of two apps including HAProxy, one to say “hello world!”, and another to say “hello medium!”. Again this was all done by running one Ansible command and created the same AWS services in the diagram above, with the addition of an extra app service.</p><p><a href="https://github.com/FabulousGinger/ansible-terrafrom-haproxy-example">FabulousGinger/ansible-terrafrom-haproxy-example</a></p><p>In this next section, I’m going to show the main tasks from Ansible and give a brief description of what they do at the bottom of each. If you want more details, I’ve added comments to each step.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93f53253bbe339ad6d8408d123c4636b/href">https://medium.com/media/93f53253bbe339ad6d8408d123c4636b/href</a></iframe><p>The terraform.yml is creating the infrastructure for HAProxy. This includes the target group and the listener that the ALB will direct traffic based on the host header. I have included a check on this task to see if there is a current terraform file that is stored on S3 and upload it on a change. If there is a change in the template it will reapply the terraform file, otherwise, it will skip the steps that would apply the terraform file again, and saving time.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc778c6ca2f8abf284f629200f1a4a66/href">https://medium.com/media/bc778c6ca2f8abf284f629200f1a4a66/href</a></iframe><p>The ecs.yml within the proxy role will build, tag, and push the docker image to ECR. It will also set a new task definition or create one if it doesn’t exist and apply that to the service. Basically, deploying the HAProxy docker image to ECS. I also included similar checks on this task since the HAProxy config shouldn’t change as much as the deployment of the apps in the other role.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93c25e707d0c2a0c5304811931968a4a/href">https://medium.com/media/93c25e707d0c2a0c5304811931968a4a/href</a></iframe><p>The terraform.yml task within the app role will be using Terraform to create the infrastructure needed including the service discovery for each app. This service directory will create the service record in Route53 each time an ECS task is activated. This is also important since that is how HAProxy will be able to route traffic to the correct containers. I have also included similar checks to skip any unneeded re-applying of the terraform file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/789daf887ab7b3ab43cf00240630f8ce/href">https://medium.com/media/789daf887ab7b3ab43cf00240630f8ce/href</a></iframe><p>The ecs.yml task within the app role is building, tagging, and pushing the docker image for the app to ECR. this will also set a new task definition or create one if it doesn’t exist and apply that to the service. Basically deploying the code of the app to ECS. Sound familiar?</p><p>Other than some Ansible magic going on in the task, that’s really about it. I will leave with some screenshots of the outcome of running this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b-UaN_C4kKddn1HTrUiONQ.png" /></figure><p>This is the stats page for the HAProxy that is running, notice that both of the apps for medium and world are online. As well those lovely red lines. In this example, I’m only expecting one container to be running at a time. I added two in the haproxy.cfg file. I did this because when the app is deployed on the ECS service there will be two tasks running: the old, and the newly deployed one. Having two in the config makes sure that there’s no downtime. Meaning when both of the containers are running, they will be online in the HAProxy backend. Once the old container is dropped by the ECS service the new one is already online and can receive traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FNfGob5yVgi1jDOX-VJNoA.png" /></figure><p>These are the running services with tasks on ECS. The group shows the services, and notice that “haproxy-example” has six task definitions to it. This is from redeploying the HAProxy part, missing something in the config and testing it as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E_QPnm2koGg3Wor7SF8tXQ.png" /></figure><p>Here are the service records in Route53. These records are how HAProxy is able to resolve the containers running each app, and forward traffic to the correct one. The value is in this order, the priority, the weight, the container port on the server host, and the server host address. Also, notice the underline? That’s from <a href="https://ietf.org/rfc/rfc2782.txt">RFC2782</a> which HAProxy requires. Again there can be multiples of these records, one for each task that is running.</p><p>Below is an example of the proxy.cfg that was used. I will go over how HAProxy can use the above service records to route traffic to the containers running the application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb35b89ef81096dd6c68a1110a01dd17/href">https://medium.com/media/eb35b89ef81096dd6c68a1110a01dd17/href</a></iframe><p>On the URL ACL, section this is a check HAPRoxy is running on the host header. For example, if the host header is world.example.DOMAIN.com, it will use the “world-acl” ACL.</p><p>The backend server rules are the rules to determine the correct backend. In the example I gave, the “world-acl” rule is triggered and HAPRoxy will use the backend “world-backend”.</p><p>The backend “world-backend” includes the service record of the app and how to resolve the record from AWS and direct traffic to the correct app. Also, note that the DNS for AWS is .2 on the last octet. HAPRoxy will need that IP address to be able to resolve the record.</p><p>I also used an environment variable on the Node app as an example of how there can be different apps using the same steps. This environment variable is set on the task definition from Ansible. The end result gave me two websites, one saying “Hello world!” and the other saying “Hello medium!”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e318820fe0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microk8s and Jira Docker Container using Helm]]></title>
            <link>https://medium.com/@onefabulousginger/microk8s-and-jira-docker-container-using-helm-5a5df2bfa9cc?source=rss-b5c8c0516d16------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a5df2bfa9cc</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[helm]]></category>
            <category><![CDATA[microk8s]]></category>
            <dc:creator><![CDATA[James von Hagel]]></dc:creator>
            <pubDate>Mon, 09 Mar 2020 15:19:46 GMT</pubDate>
            <atom:updated>2020-03-31T15:14:33.596Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BVyup-0QYVZhTF-h" /><figcaption>Photo by <a href="https://unsplash.com/@mbuff?utm_source=medium&amp;utm_medium=referral">Sung Jin Cho</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Recently Atlassian published an official <a href="https://hub.docker.com/r/atlassian/jira-software">Jira Docker image</a>, and I for one am glad to see it. I can count the number of times I had to painfully upgrade Jira, where a lot can go wrong, because the process has so many steps. Having Jira in a Docker container, external file share (I used EFS for this), an external DB (I used RDS MySQL), it’s now just a step of updating the Docker image tag.</p><p>During this story, I will be setting up a few services. I found that they all had decent documentation, so I will only cover what I did differently and issues that I ran into. I have also already set up the infrastructure needed to host this on AWS and I used an Ubuntu 18.04 instance. In this example, I have mounted an EFS storage which I will be using for the Jira application data location.</p><p>I started by installing Microk8s. I followed the <a href="https://microk8s.io/docs/">documentation</a>, and it was straight forward. A few differences were the Microk8s services I enabled and creating aliases for them.</p><pre>sudo microk8s.enable dns registry ingress helm3</pre><pre>alias kubectl=’microk8s.kubectl’</pre><pre>alias helm=’microk8s.helm3’</pre><p>Docker needs to be <a href="https://docs.docker.com/install/linux/docker-ce/ubuntu/">installed</a> to build images and to use the registry service from Microk8s. The registry will act as a local Docker registry were the Jira Docker image will be saved. More on this later.</p><p>At this point, I ran into my first issue. I was testing Mictok8s and I noticed I couldn’t run logs or exec commands on the pods; I just kept getting time out errors. When I checked the errors, I saw the wrong IP was being used on logs and exec commands. I resolved this by updating the following to the kube-apiserver /var/snap/microk8s/current/args/kube-apiserver.</p><pre>--kubelet-preferred-address-types=InternalIP,Hostname,ExternalIP</pre><p>Now the kube-apiserver is using the local IP address first and the logs and exec commands work!</p><p>Since we&#39;re still on the topic of issues, here’s another one — it’s a good time to resolve this before we actually run into it. I had Jira behind an ALB where the ALB was serving the SSL and redirecting HTTP to HTTPS. When visiting the site, I noticed there was weird redirecting going on, almost like the Kubernetes ingress was redirecting traffic. Which: it was. The Microk8s ingress that I enabled creates a daemonset for the ingress pod. I had to edit the daemonset to add the annotation to disable SSL redirecting. I also added this annotation for the ingress of the Jira Helm chart.</p><pre>kubectl edit daemonset nginx-ingress-microk8s-controller --namespace ingress</pre><pre>annotations:<br>  nginx.ingress.kubernetes.io/ssl-redirect: &quot;false&quot;<br>  nginx.ingress.kubernetes.io/proxy-body-size: 200m</pre><p>Once the ingress was updated the redirects stopped. I have also added an annotation to allow the body size to be at least 200m. If not, Jira will error on 413 status code ‘Request entity too large’.</p><p>One more issue that occurred was when recreating the pod for Jira. When Jira is successfully started it creates a lock file on the data directory. If another pod tries to start and a lock file exists, Jira will start with an error. To avoid this, I added a line to the start-jira.sh file to remove the lock file.</p><pre>RUN sed --in-place &#39;1 a rm -f /var/atlassian/application-data/jira/.jira-home.lock&#39; /opt/atlassian/jira/bin/start-jira.sh</pre><p>Continuing work on the Dockerfile, Jira on Docker doesn’t include MySQL or Oracle JDBC drivers. I’m using an external RDS MySQL database; this driver is needed for Jira to connect with MySQL. A docker image will need to be built with the MySQL JDBC driver copied to /opt/atlassian/jira/lib. This is why I enabled the registry on Microk8s and thankfully they provide great <a href="https://microk8s.io/docs/registry-built-in">documentation</a> on how to complete this. I also reference the image from the helm template.</p><pre><strong>deployment.yaml</strong>:<br>image: &quot;{{ .Values.image.repository }}&quot;</pre><pre><strong>values.yaml</strong>:<br>image:<br>  repository: localhost:32000/jira:8.7.0-ubuntu-jdk11<br>  pullPolicy: Always</pre><p>At this point, all I needed to do was run a helm install command and Jira was online and being served behind an AWS ALB. I’m going to provide the helm chart I used, just without the actual values I used. Happy helming!</p><p><a href="https://github.com/FabulousGinger/microk8s-jira-example">FabulousGinger/microk8s-jira-example</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a5df2bfa9cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>