<?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 Joachim Hill-Grannec on Medium]]></title>
        <description><![CDATA[Stories by Joachim Hill-Grannec on Medium]]></description>
        <link>https://medium.com/@jozmo?source=rss-b661da49799b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*d8SJBX6E759bX7_3.jpg</url>
            <title>Stories by Joachim Hill-Grannec on Medium</title>
            <link>https://medium.com/@jozmo?source=rss-b661da49799b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 13:09:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jozmo/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[Streamline Your Success: Unveiling the Power of Business Operations Tools]]></title>
            <link>https://blog.pelo.tech/streamline-your-success-unveiling-the-power-of-business-operations-tools-fc10e5bd270e?source=rss-b661da49799b------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc10e5bd270e</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[operations]]></category>
            <category><![CDATA[buisness]]></category>
            <category><![CDATA[hr]]></category>
            <dc:creator><![CDATA[Joachim Hill-Grannec]]></dc:creator>
            <pubDate>Wed, 20 Sep 2023 16:07:29 GMT</pubDate>
            <atom:updated>2023-10-16T00:05:52.046Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Intergrate" src="https://cdn-images-1.medium.com/max/1024/1*9t9_zrP9WCjn8e54R8DaSw.jpeg" /></figure><p>Lately I’ve had a few folks hit me up with questions about operations in general. This has ranged from accounting software, to benefits questions, and just other random things. This is by no means my full time passion/job, however I do love automating/simplifying anything I can, so I’ll summarize what tools/services we’ve landed on with some summary of why in the hopes to help others.</p><p>Over the course of the last decade, our journey in search of the “perfect” business operations tools has been an exciting and enlightening one. We’ve explored a multitude of options, testing and experimenting with various tools. We’ve tried to find the ideal combination that seamlessly integrates with one another, offers robust features, and prioritizes flexibility for growth while managing costs. After much trial and error, we’re thrilled to share the fruits of our labor and reveal the winning tools that have revolutionized our business operations. Join us as we delve into the world of integrated solutions, cost-effective management, and scalable growth.</p><h3>Payroll and Benefits — Justworks</h3><p>Over the years we’ve used various providers and landed with <a href="https://justworks.com/">Justworks</a> (if you decide to go with them hit me up so we can get a referral 😉). They’re a PEO and act as the employer of record. There’s tons of information on why you might or might not choose this path but here’s why we landed with them.</p><ol><li>Easier to hire in any state — dealing and filling for unemployment, taxes, etc for each state is a pain.</li><li>Full integration into our accounting, expense, and other onboarding tools</li><li>Better benefits pricing — lots of various options from commuter to health. Get the benefits of a larger organization pricing.</li><li>401k options and integration</li></ol><p><a href="https://www.indeed.com/career-advice/career-development/benefits-of-a-peo">This article</a> describes general benefits of a PEO — TLDR: They take care of most of your HR issues — We use Justworks integration with slack and let anyone on the team chat with them directly and means we hardly ever have to worry about any of the details. Additionally it integrates with our accounting software (Xero but it supports others), which means no manual entries or typos.</p><h3>Banking — Mercury</h3><p>In the past decade we’ve used SVB (rest in peace), Bluevine, Chase, a couple other randos, and finally landed with <a href="https://mercury.com/r/pelotech">Mercury</a> (Link gets you $250). After dealing with banks in general it’s really hard to find one you can trust with your money, while not feeling like you’re back in the 80’s and not get hit up with random fees everywhere. Here’s why we’re finally happy after lots of “grrrr” moments.</p><ol><li>$5 Million FDIC insured — yep that a bit more than 250K and they do this via multiple partner banks, lets just say it’s a good piece of mind as you scale up</li><li>Their online app is the best I’ve used — Great for multiple users, it just works, doesn’t feel like I’m in some 1980’s version of what software experience thinks it should be</li><li>Integrates with our accounting software (Xero) and has better application integration options than anything else I’ve seen</li><li>Who doesn’t like free— National/International Wire transfers = free, no minimums, and more</li><li>Access to high interest, low risk options for the extra cash</li></ol><p>Although Mercury has been a recent change for us, in the amount of time we’ve used it, it’s gone from a “grrr what’s going to be annoying about interacting with the bank” to not even thinking about it, which is what I want.</p><h3>Banking International-ish — Wise</h3><p>When dealing with international transfers of money it gets really complicated really quickly. Open banks overseas is just hard, dealing with wire transfers, conversion rates when you may or may not want to, etc. <a href="https://wise.com/invite/dic/joachimh162">Wise.com</a> has been fantastic to use in general. We can create bank accounts in most places that act like “native” banks and then transfer the funds when we want to with relatively low fees.</p><ol><li>Integrates with Mercury, Xero, etc</li><li>Low fees and easy to transfer money between countries</li><li>Gives however we’re dealing with a simpler experience and the sense that we have a presence in that region</li></ol><h3>Accounting — Xero</h3><p>Honestly this was an early choice (well, post using excel, and having a quick terrible experience with QuickBooks). We really haven’t had any complaints around <a href="https://xero.com/">Xero</a>, I’m not sure I’d rave about it either which is probably perfect for accounting software unless that’s what excites you. We’ve never had issues, it integrates with all the tools we need it to. Handles international/multi-currency and has the ability to scale for the forseable future. I’d note that we really only use it for accounting and invoicing. A lot of the other features might do well for you, but we’ve leaned towards using tools that integrate and do that thing really well. Things I do appreciate about it.</p><ol><li>Integration with all our other tools — wise.com, Ramp, Mercury, etc</li><li>Easy access for anyone, including our accountants</li><li>Side effect is that accountants that know more than just QuickBooks seem to be a better fit for us. I could be wrong but they’ve tended to be a bit more up to date with the latest options available to use around taxes, finance, etc.</li></ol><h3>Expenses — Ramp</h3><p>Over the years we’ve tried various was to deal with expenses and honestly I’ve hated them all. Granted lots of it was less on the approval and expense administration vs how to reconcile everything in the accounting software after. I really couldn’t find anything that would deal with everything, not force people to use personal credit cards or where company cards would be a pain on liability, reconciliation, etc. Here comes <a href="https://ramp.com/?rc=B2NJEQ&amp;referral_location=referral_page">Ramp</a> to the rescue! Even though I could complain about a few UI issues and minor process issues, the totally net positive is sooo much YES use this for expenses/corporate card. General why?</p><ol><li>Easy to give physical cards to everyone and limit the risk on spend by pre-approving</li><li>Easy to create virtual cards by vendor — means the ability to cancel a card and not kill every possible payment</li><li>Cash back</li><li>Lots of the nice “credit card” benefits for insurance and the likes</li><li>Integration with Justworks: to add/remove people from the team. Xero: for all the payments/charges. Slack: on approvals, charge notifications, etc</li><li>Suggestions for where to save money on common charges</li></ol><h3>Team IM — Slack</h3><p>So over the years because of the type of work we do (Tech consulting for various organizations — check us out @ <a href="https://www.pelo.tech/">https://www.pelo.tech</a>) we’ve used everything from MS Teams, Google Chat, Keybase, Slack, Matrix, Rocket, Meta Workplace, Oh and the list goes on. In summary I do have my issues with <a href="https://slack.com/">slack</a> (ie. So many accounts, not super easy “guest” management, etc), however it does stand out above the rest in a couple critical areas. <a href="https://www.linkedin.com/pulse/so-your-team-now-remote-how-maximize-productivity-vlada-bortnik/">Here’s a great remote teams post</a> with nice slack tid-bits at the end.</p><ol><li>It just works 😃 — Don’t even get me started on MS Teams — One of the buggiest apps I’ve used and doesn’t ever get better. Please don’t force this on your poor team!</li><li>Search is just great! If used correctly can almost replace most documentation</li><li>Threaded messages — Omg this is just a must once you used it. It’s really hard to use others when it’s not there</li><li>Integrations — Ramp: for approvals and notifications. Justworks: help for help on benefits, payroll, etc. CI/CD from GitHub or the likes. Lots of other teams/companies can now link chats for easier cross group communications.</li></ol><h3>Email/Workplace — Google Workspace</h3><p>This may be a controversial one however we have used our fair share of options here and <a href="https://referworkspace.app.goo.gl/uAxr">Google Workspace</a> keeps coming up on top. In general it’s just simpler admin wise and just less clunky than alternatives like office, has most if not all the features you need and integrates with all the things. That being said — do pay for the option to have the “team drive” and only use that for anything shared. The normal drive share is just plain confusing especially around ownership and organization of files and it’s easy to lose track of things.</p><ol><li>Gmail is great</li><li>Sharing of all the things is simple</li><li>Web first by default</li><li>Integrations for all the other tools</li><li>Sooo much more</li></ol><h3>Secrets — 1Password</h3><p>This is really a must. Having <a href="https://1password.com/">1password</a> for the team to keep they passwords safe and allow for integrated 2FA and more as well as a way to safely share items (when theres no other option) is just fantasic.</p><ol><li>Ability to share 2FA items</li><li>Works great for teams</li><li>Secure</li></ol><h3>Summary</h3><p>With the set of tools/services we use, we’ve gotten to a place where most of our operations ranging from HR, Receivables, Payables, Onboarding, etc doesn’t require dedicated staff. We’ve been able to double/triple in size and reduce during lean times with no real increase in process time required. It’s basically a fixed couple of hours a month and done. That being said here are the items/values we prioritzed in our choices</p><ol><li>Self Serve — People should be able to get access to the things they need when they need it without gatekeepers/admins “doing it”.</li><li>Integrations — Any place a computer can do it, it should. No manual entries/copying/smoke signals</li><li>Scalable — Should get able to grow with the group or shrink without breaking the bank.</li></ol><p>Joachim Hill-Grannec is a Partner at <a href="http://www.pelo.tech/">http://www.pelo.tech</a>, a group that helps organizations improve their dev practices and culture. These days you’ll also find him traveling around the world where ever there are waves to surf.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc10e5bd270e" width="1" height="1" alt=""><hr><p><a href="https://blog.pelo.tech/streamline-your-success-unveiling-the-power-of-business-operations-tools-fc10e5bd270e">Streamline Your Success: Unveiling the Power of Business Operations Tools</a> was originally published in <a href="https://blog.pelo.tech/">Pelotech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[(K)SOPS-K8S-ArgoCD]]></title>
            <link>https://blog.pelo.tech/k-sops-k8s-argocd-54becd3a1a34?source=rss-b661da49799b------2</link>
            <guid isPermaLink="false">https://medium.com/p/54becd3a1a34</guid>
            <category><![CDATA[mozilla-sops]]></category>
            <category><![CDATA[gitops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[argo-cd]]></category>
            <dc:creator><![CDATA[Joachim Hill-Grannec]]></dc:creator>
            <pubDate>Tue, 21 Mar 2023 19:10:06 GMT</pubDate>
            <atom:updated>2023-04-03T15:26:10.521Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*RTJ1myfJYUHUcMOBuX_UkA.jpeg" /></figure><h4>Hello there, fellow tech enthusiasts! Today, we’re going to talk about the benefits of using SOPS with Kubernetes and ArgoCD.</h4><p>However much we love technology, it’s not always rainbows and unicorns. Security is a major concern, and any breaches can lead to serious problems. That’s where SOPS comes in.</p><p>UPDATE: There’s a new way to handle Kustomize generator plugins — you can find the new blog here — <a href="https://blog.pelo.tech/upgrading-to-ksops-krm-function-plugin-cf1923c6617d">https://blog.pelo.tech/upgrading-to-ksops-krm-function-plugin-cf1923c6617d</a></p><p>So, what is SOPS? SOPS stands for “Secrets OPerationS,” and it’s a tool that helps you manage and encrypt secrets in a vendor agnostic way. Now, I know what you’re thinking: “Why do I need another tool to manage secrets? Can’t I just use Kubernetes secrets?” Well, you could, but SOPS has some advantages.</p><p>Firstly, SOPS allows you to store your secrets safely in your git repository using encryption. This means you can include secrets in your existing workflows (i.e. GitOps) rather than managing them separately. You’ll also get an audit trail for free since every secrets change is tracked in git history.</p><p>Secondly, SOPS encrypts your secrets, which adds an extra layer of security. Kubernetes secrets by default are only base64-encoded, which is not encryption. With SOPS, you can use a variety of encryption methods, including PGP, AWS KMS, and Google Cloud KMS.</p><p>Now, let’s talk about ArgoCD. ArgoCD is a tool that helps you manage your Kubernetes clusters using GitOps workflows. It allows you to deploy your applications and infrastructure declaratively, which means you specify what you want, and ArgoCD takes care of the how.</p><p>So, how do SOPS and ArgoCD work together? Well, SOPS allows you to encrypt your secrets and store them in a Git repository. ArgoCD can then pull those secrets and use them to deploy your applications and infrastructure. This means that your secrets are never exposed in plain text, even during deployment.</p><p>Plus, because you’re using GitOps workflows, you have a clear audit trail of who made changes to your secrets and when. And because ArgoCD takes care of the deployment, you don’t have to worry about manually updating your Kubernetes secrets.</p><p>Now assuming you know how SOPS/KSOPS works, ArgoCD needs a few modifications.</p><ul><li>The argocd-cm (configmap) needs the following patch</li></ul><pre>apiVersion: v1<br>kind: ConfigMap<br>metadata:<br>  name: argocd-cm<br>data:<br>  # For KSOPs versions &lt; v2.5.0, use the old kustomize flag style<br>  # kustomize.buildOptions: &quot;--enable_alpha_plugins&quot;<br>  kustomize.buildOptions: &quot;--enable-alpha-plugins&quot;</pre><ul><li>The argocd-repo-server deployment will need the following kustomization patch</li></ul><pre>kind: Deployment<br>metadata:<br>  name: argocd-repo-server<br>spec:<br>  template:<br>    spec:<br>      # 1. Define an emptyDir volume which will hold the custom binaries<br>      volumes:<br>        - name: custom-tools<br>          emptyDir: {}<br>        - name: gnupg-home<br>          emptyDir: { }<br>        - name: sops-gpg<br>          secret:<br>            secretName: sops-gpg<br>      # 2. Use an init container to download/copy custom binaries into the emptyDir<br>      initContainers:<br>        - name: install-ksops<br>          image: viaductoss/ksops:v3.0.2<br>          command: [&quot;/bin/sh&quot;, &quot;-c&quot;]<br>          args:<br>            - echo &quot;Installing KSOPS...&quot;;<br>              mv ksops /custom-tools/;<br>              mv $GOPATH/bin/kustomize /custom-tools/;<br>              echo &quot;Done.&quot;;<br>          volumeMounts:<br>            - mountPath: /custom-tools<br>              name: custom-tools<br>         # Import the private gpg key from the secret into argocd<br>        - name: import-gpg-key<br>          image: argoproj/argocd:v2.5.0<br>          command: [ &quot;gpg&quot;, &quot;--import&quot;,&quot;/sops-gpg/sops.asc&quot; ]<br>          env:<br>            - name: GNUPGHOME<br>              value: /gnupg-home/.gnupg<br>          volumeMounts:<br>            - mountPath: /sops-gpg<br>              name: sops-gpg<br>            - mountPath: /gnupg-home<br>              name: gnupg-home<br>      # 3. Volume mount the custom binary to the bin directory (overriding the existing version)<br>      containers:<br>        - name: argocd-repo-server<br>          volumeMounts:<br>            - mountPath: /usr/local/bin/kustomize<br>              name: custom-tools<br>              subPath: kustomize<br>            - mountPath: /home/argocd/.gnupg<br>              name: gnupg-home<br>              subPath: .gnupg<br>              # Verify this matches a XDG_CONFIG_HOME=/.config env variable<br>            - mountPath: /.config/kustomize/plugin/viaduct.ai/v1/ksops/ksops<br>              name: custom-tools<br>              subPath: ksops<br>          # 4. Set the XDG_CONFIG_HOME env variable to allow kustomize to detect the plugin<br>          env:<br>            - name: XDG_CONFIG_HOME<br>              value: /.config<br>        ## If you use AWS or GCP KMS, don&#39;t forget to include the necessary credentials to decrypt the secrets!<br>        #  - name: AWS_ACCESS_KEY_ID<br>        #    valueFrom:<br>        #      secretKeyRef:<br>        #        name: argocd-aws-credentials<br>        #        key: accesskey<br>        #  - name: AWS_SECRET_ACCESS_KEY<br>        #    valueFrom:<br>        #      secretKeyRef:<br>        #        name: argocd-aws-credentials<br>        #        key: secretkey</pre><p>In this specific setup — the argo sops private key is encrypted in the repo itself. The reason is that we have a “one time” rebuild where the private PGP key is a build env var- which then sets up the private key in the cluster for future decryption.</p><ul><li>Here’s a sample github action for the first initializing of the cluster — after it’s been run Argo will have the private key internally and manage itself.</li></ul><pre>name: apply-eks-kustomize-init<br>on: [workflow_dispatch]<br>jobs:<br>  kubectl-kustomize:<br>    runs-on: ubuntu-latest<br>    permissions:<br>      id-token: write<br>      contents: read<br>    steps:<br>      - name: Checkout<br>        uses: actions/checkout@v3<br>      - name: Configure AWS credentials<br>        uses: aws-actions/configure-aws-credentials@v1<br>        with:<br>          role-to-assume: arn:aws:iam::xxxxxxxxx:role/ci/GithubCI-OIDC-TF<br>          aws-region: eu-west-2<br>      - name: install ksops<br>        id: install-ksops<br>        run: curl -s https://raw.githubusercontent.com/viaduct-ai/kustomize-sops/master/scripts/install-ksops-archive.sh | bash<br>      - name: Import GPG key<br>        id: import_gpg<br>        uses: crazy-max/ghaction-import-gpg@v5<br>        with:<br>          gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}<br>      - name: List keys<br>        run: gpg -K<br>      - name: install aws cli<br>        id: install-aws-cli<br>        uses: unfor19/install-aws-cli-action@v1.0.4<br>      - name: install kubectl<br>        id: install-kubectl<br>        uses: azure/setup-kubectl@v3<br>      - run:  aws eks --region eu-west-2 update-kubeconfig --name core-cluster<br>        shell: bash<br>      - run: cd gitops/argocd &amp;&amp; kubectl kustomize --enable-alpha-plugins . -o environment.yaml &amp;&amp; kubectl apply -f environment.yaml<br>        shell: bash</pre><p>In summary, (K)SOPS and ArgoCD are a match made in heaven. They allow you to manage and encrypt your secrets using GitOps workflows, which adds an extra layer of security and provides a clear audit trail. So, if you’re not using SOPS and ArgoCD yet, what are you waiting for? Get on board the GitOps train and start securing your secrets today!</p><p>Eventually we’ll provide a open projects with start to finish examples — In the mean time hit us up if you need any help. Until next time, keep your clusters secure and your code funky!</p><p>With the Pelotech crew, we’re on the next versions of dev concepts which allow for complete self-hosted apps, deployments which are based on high-availability, high-scalability, and simple blue/green style deployments. Hit me up if you’re interested in more info about it!</p><p>Joachim Hill-Grannec @lindyblues is a Partner at <a href="http://www.pelo.tech/">http://www.pelo.tech</a>, a group that helps organizations improve their dev practices and culture. These days you’ll also find him traveling around the world where ever there are waves to surf.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54becd3a1a34" width="1" height="1" alt=""><hr><p><a href="https://blog.pelo.tech/k-sops-k8s-argocd-54becd3a1a34">(K)SOPS-K8S-ArgoCD</a> was originally published in <a href="https://blog.pelo.tech/">Pelotech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fixing CI/CD security issues you didn’t know you had]]></title>
            <link>https://blog.pelo.tech/fixing-ci-cd-security-issues-you-didnt-know-you-had-74cf76d9dd9e?source=rss-b661da49799b------2</link>
            <guid isPermaLink="false">https://medium.com/p/74cf76d9dd9e</guid>
            <dc:creator><![CDATA[Joachim Hill-Grannec]]></dc:creator>
            <pubDate>Tue, 17 Jan 2023 20:32:51 GMT</pubDate>
            <atom:updated>2023-03-21T19:14:15.476Z</atom:updated>
            <content:encoded><![CDATA[<h4>CI/CD systems like Jenkins/Github Actions/Gitlab CI need permissions to access other systems they need to act on such as cloud providers, k8s, and others. A popular and straightforward solution for this problem is using long lived credentials. While this approach is convenient, it also presents a security risk. Most teams set and forget these credentials without ever rotating them. If a secret is leaked, an attacker can gain access to your production infrastructure.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*SqkhcdqQigEcARZDEsmswQ.jpeg" /></figure><p>At first glance you could say “Let’s just run our own runners in our cloud provider”. This does allow you to switch to using instance roles on the runners and getting away from the long lived credentials. “Woohoo, problem solved”! However that’s just scenario 1, now let’s look at larger organizations where we might have various groups with various cloud accounts. In this case we’ll just say each team has one non-prod account and one prod account. How do you prevent teams from accessing other accounts which that host might have access to via an assume-role or the likes without adding a huge amount of complexity within the build system?</p><p>One option would be to use runner groups which would be limited to specific teams/repos. However it’s a pretty poor optimization of resources. It means you need to create specific runners for every team making maintenance a pain as well as increase the operational costs which will push organizations to limit runner availability which will drive developer productivity down.</p><p>So how do you get shared hosted or self-hosted runners in a way that still satisfies the security needs, a simpler maintenance/scaling model,, and no long lasting keys?</p><h4>OIDC FOR THE WIN</h4><p>Whether you use hosted or self-hosted runners, OIDC setup with your cloud provider is the clear option here. It allows you to essentially “auth” your repo as a machine account without long lasting keys. Here’s the general steps to set it up with AWS and Github as an example. We’ll provide other examples with Gitlab, Vault, etc in the future.</p><ol><li><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html">Set up an identity provider </a>— each AWS account will need it setup for each source.</li><li>Set up a role which trusts the above identity providers with the repo/org constraints</li><li>Configure AWS credentials actions to assume the above role</li><li>Remaining steps in the pipeline act as that role</li></ol><p>So what’s actually going on behind the scenes here is basically the external service — in this case Github, however it could easily be Gitlab, Vault, Jenkins, etc. is providing a way for the pipeline to authenticate itself against the service. For Github that’s “<a href="https://token.actions.githubusercontent.com/">https://token.actions.githubusercontent.com</a>”, for gitlab “<a href="https://gitlab.com/">https://gitlab.com</a>”, and some equivalent for other providers. The pipelines will ask their appropriate hosting to sign a token using their TLS certificate on the branch, actions, or the likes which can be passed to the cloud provider. At this point the cloud provider will verify the token (which allows you to match on the repo) and assume a role and if all things check out, you get a temporary session to act as that role.</p><p>Now for some code snippets:</p><p>To setup the Github IAM OIDC provider for AWS for usage by repo actions:</p><pre>data &quot;tls_certificate&quot; &quot;github&quot; {<br> url = “https://token.actions.githubusercontent.com”<br>}<br> <br>resource &quot;aws_iam_openid_connect_provider&quot; &quot;github&quot; {<br> url             = “https://token.actions.githubusercontent.com”<br> client_id_list  = [&quot;sts.amazonaws.com&quot;]<br> thumbprint_list = [data.tls_certificate.github.certificates.0.sha1_fingerprint]<br>}<br> <br>data &quot;aws_iam_policy_document&quot; &quot;assume-role-policy&quot; {<br> statement {<br>   actions = [&quot;sts:AssumeRoleWithWebIdentity&quot;]<br>   principals {<br>     type        = &quot;Federated&quot;<br>     identifiers = [aws_iam_openid_connect_provider.github.arn]<br>   }<br>   condition {<br>     test     = &quot;StringLike&quot;<br>     variable = &quot;token.actions.githubusercontent.com:sub&quot;<br>     values   = [&quot;repo:pelotech/infrastructure:ref:refs/heads/main&quot;]<br>   }<br> }<br>}<br>resource &quot;aws_iam_role&quot; &quot;github_ci&quot; {<br> name               = &quot;GithubCI-OIDC-TF&quot;<br> description        = &quot;GithubCI with OIDC&quot;<br> path               = &quot;/ci/&quot;<br> assume_role_policy = data.aws_iam_policy_document.assume-role-policy.json<br> managed_policy_arns = formatlist(<br>   &quot;arn:%s:iam::aws:policy/%s&quot;,<br>   data.aws_partition.current.partition,<br>   [&quot;AdministratorAccess&quot;]<br> )<br>}<br>output &quot;ROLE_ARN&quot; {<br> description = &quot;INFRA Role that needs to be assumed by github actions&quot;<br> value       = aws_iam_role.github_ci.arn<br>}</pre><p>The only real changes that would need to take place here are the condition values. Replacing “pelotech” with your org name and “infrastructure” with your repo will allow actions on the main branch to assume the “GithubCI-OIDC-TF” role.</p><p>And here’s a sample .github/workflows/main.yaml for using this</p><pre>name: apply-main<br>on:<br> push:<br>   branches:<br>     - main<br>permissions:<br> id-token: write<br> contents: read<br>jobs:<br> apply-terraform:<br>   runs-on: ubuntu-latest<br>   steps:<br>     - uses: actions/checkout@v2<br>     - name: Configure AWS credentials for sor account<br>       uses: aws-actions/configure-aws-credentials@v1<br>       with:<br>         role-to-assume: arn:aws:iam::{ACCOUNTID}:role/ci/GithubCI-OIDC-TF<br>         aws-region: us-west-2<br>     - name: Setup Terraform<br>       uses: hashicorp/setup-terraform@v1<br>       with:<br>         terraform_version: 1.3.2<br>     - name: Terraform Init<br>       run: terraform init<br>       env:<br>         TF_WORKSPACE: default<br>     - name: Terraform Plan<br>       run: terraform plan<br>       env:<br>         TF_WORKSPACE: default<br>     - name: Terraform Apply<br>       run: terraform apply -auto-approve<br>       env:<br>         TF_WORKSPACE: default</pre><h4>HOW TO BOOTSTRAP</h4><p>So how do we solve the chicken and egg problem here for initial setup? In this case we need the IAM OIDC provider to exist before we can have a repo with actions configuring the account. What we currently use ourselves are a few trusted folks that can get temporary access to the AWS account(s) and manually runs locally the bootstrap of the IAM OIDC provider and base role for the root terraform. From there the root terraform takes over for all new limited role creation other repos and pipelines. This limits the “manual” tasks to a minimum and limits any permissions exposure.</p><h4>MODULES TO USE</h4><p>We’ve started the following project <a href="https://github.com/pelotech/terraform-aws-oidc-github">https://github.com/pelotech/terraform-aws-oidc-github</a> to help with the bootstrap. Currently it’s just for github actions, however we’ll be creating the equivilant for gitlab, jenkins, and others.</p><p>With the Pelotech crew, we’re on the next versions of dev concepts which allow for complete self-hosted apps, deployments which are based on high-availability, high-scalability, and simple blue/green style deployments. Hit me up if you’re interested in more info about it!</p><p>Joachim Hill-Grannec @lindyblues is a Partner at <a href="http://www.pelo.tech/">http://www.pelo.tech</a>, a group that helps organizations improve their dev practices and culture. These days you’ll also find him traveling around the world where ever there are waves to surf.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74cf76d9dd9e" width="1" height="1" alt=""><hr><p><a href="https://blog.pelo.tech/fixing-ci-cd-security-issues-you-didnt-know-you-had-74cf76d9dd9e">Fixing CI/CD security issues you didn’t know you had</a> was originally published in <a href="https://blog.pelo.tech/">Pelotech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating custom terraform providers]]></title>
            <link>https://blog.pelo.tech/creating-custom-terraform-providers-341311823fa2?source=rss-b661da49799b------2</link>
            <guid isPermaLink="false">https://medium.com/p/341311823fa2</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[drone-ci]]></category>
            <dc:creator><![CDATA[Joachim Hill-Grannec]]></dc:creator>
            <pubDate>Tue, 16 Jan 2018 20:22:29 GMT</pubDate>
            <atom:updated>2018-01-17T07:57:52.305Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Making everywhere a livable place/not just survivable</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*29djU2SrqjetzlWn7YJGmA.jpeg" /></figure><p>While prepping for a hashicorp meet-up talk in NYC about creating custom providers I decided to also throw a blog together on the subject. So here we go!</p><h3><strong>What is Terraform?</strong></h3><ul><li>Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as <strong>custom</strong> in-house solutions. — Yep from <a href="https://www.terraform.io/intro/index.html">Terraform.io</a>’s intro</li></ul><h3><strong>Why might you need a custom provider?</strong></h3><p>Honestly if you’ve found your way here, you probably already have a need for it. However some examples of why you may need a provider include</p><ol><li>You have an internal or customer facing product that has configuration needs. This could include hardware delivered to customers, Bitbucket Server, Github, etc</li><li>You have a central teams that wants to provide services to other groups and terraform could be a great way to give them an immutable interface to those services.</li><li>You decided to build a competitor to AWS, Azure, or the likes. (Not likely but you know…)</li><li>You’re bored and want to write some code ;)</li></ol><h3><strong>Is it Golang only?</strong></h3><p>So no it’s not Golang only, but all the cool kids are doing it, so why not join them ;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*sN-m9Htm-3Z7y7pAFKF4vQ.png" /></figure><p>Plus honestly all the examples are in Golang so why not have more options to copy and paste.</p><h3><strong>Sample Service API</strong></h3><p>For this example we’re going to be creating a provider that works with an internal product we’ve created for clients and our own services. It allows us to create a managed spot group in aws that will use cheap spot instances to host all our services at the lowest cost possible while maintaining high availability.</p><p>We want to make a terraform provider so folks can easily onboard to our service, or replace their ec2 autoscaling groups with our spot instances.</p><p>This will have the following endpoints</p><pre><strong><em>### Auth<br></em></strong>method: POST  <br>url: /users/login    <br><br><em>    body: {  <br>      &quot;password&quot;: &lt;classis password&gt;,  <br>      &quot;email&quot;: &lt;classis email&gt;  <br>    }<br><br></em>This will return you an auth token.  <br>Include it as an http header like this: Authorization: Bearer &lt;your-token&gt;<br><br><strong><em>### Get Spot Group Data<br></em></strong>method: GET <br>url: /spot-groups/:spotGroupId<br><br><strong><em>### Get Spot Status <br></em></strong>method: GET   <br>url: /spot-groups/:spotGroupId/status<br><br><strong><em>### Create and Update<br></em></strong>method: POST  <br>url: /spot-groups/:spotGroupId *<br><br><em>    body: {<br>      &quot;name&quot; : &quot;&quot;,  <br>      &quot;region&quot; : &quot;&quot;,  <br>      &quot;launchSpecification&quot; : {  <br>        &quot;securityGroups&quot; : [],  <br>        &quot;imageId&quot; : &quot;&quot;,  <br>        &quot;keyName&quot; : &quot;&quot;,  <br>        &quot;subnetId&quot; : &quot;&quot;  <br>      },<br>      &quot;virtualizationType&quot; : &quot;&quot;,  <br>      &quot;quantity&quot; : &quot;&quot;,  <br>      &quot;typesSelected&quot; : [],  <br>      &quot;vpc&quot; : &quot;&quot;,  <br>      &quot;iamFleetRole&quot; : &quot;&quot;  <br>    }<br><br> </em>*The spotGroupId param is optional. If not passed, the API will create a new id. <br> <br><strong><em>### Start  <br></em></strong>method: POST  <br>url: /spot-groups/:spotGroupId/start<br><br><strong><em>### Stop<br></em></strong>method: POST  <br>url: /spot-groups/:spotGroupId/stop<br><br><strong><em>### Delete<br></em></strong>method: DELETE  <br>url: /spot-groups/:spotGroupId</pre><h3><strong>Sample starting point for a project in </strong><a href="https://github.com/josmo/terraform-provider-sampleclassis"><strong>GitHub</strong></a></h3><h4><strong>1. Starting point template</strong></h4><p>If you look at this <a href="https://github.com/josmo/terraform-provider-sampleclassis/tree/basic-template-checkpoint">checkpoint</a>, the structure of the code is as follows</p><ul><li>.drone.yml -&gt; this is for our build server, however I also use it for local builds which makes things drastically simpler. Check out <a href="https://github.com/drone/drone">drone</a> for more info.</li><li>main.go -&gt; starting point for go</li><li>classis/provider.go -&gt; contains the start of the provider implementation</li><li>vendor/ =&gt; normal golang vendor stuff using govend</li></ul><p><strong>Building the provider</strong></p><p>Assuming you have the <a href="http://docs.drone.io/cli-installation/">drone cli</a> installed, you should only need to run:</p><pre>drone exec --repo-name {name-of-the-repo}</pre><p>This should create a linux, darwin, and windows exec of the provider in a release folder.</p><p>Things to pay attention to. You need to include in main and use</p><pre><strong>&quot;github.com/hashicorp/terraform/plugin&quot;</strong></pre><p>This will give you all the starting points to get your implementation going.</p><blockquote>Note — To the plugin you need to place them in the root of the directory or in terraform.d/plugins/({os_arch} ie darwin_amd64. This is why in the drone file there’s a copy step for darwin to help for my development. change the path depending on your platform</blockquote><h4><strong>2. Sample adding of auth and a test terraform tf file to test out the provider as we go</strong></h4><p>Checking out this <a href="https://github.com/josmo/terraform-provider-sampleclassis/tree/provider-configuration-checkpoint">checkpoint</a> you’ll find that we now have some ability to setup a base URL for the service, a username, and a password.</p><ul><li>classis/provider.go</li><li>main.tf -&gt; has a sample setup config for the provider</li><li>classis/client/client.go -&gt; this is going to have most of the “logic” for using the apis, right now it’s only creating a new client with the authentication information in the provider configuration section</li><li>classis/client/types.go -&gt; this is going to contain most of the data structures we’re going to need to interact with the apis. Currently it’s only the Login and LoginResponse data types.</li></ul><blockquote>Note that everything in the classis/client folder should be in its own lib. Typically, api clients are separated into their own go libraries. That way, they can be used for more than just terraform providers. In our example, they’re put into the same repository for easier demonstration, but I wouldn’t recommend this pattern.</blockquote><p>You’ll also notice there are schema.EnvDefaultFunc pieces in the provider.go code. This is a great way to not store the password in the tf file ;) and use environment variable instead.</p><h4><strong>3. Implementation for creating and deleting a resource</strong></h4><p>Taking a look a this <a href="https://github.com/josmo/terraform-provider-sampleclassis/tree/createdelete-checkpoint">checkpoint</a> you’ll see that there are updates to the client folder. Again you can check them out, however normally this would only be included as part of a client vendor lib.</p><p>For the interesting part you can see that we have the following</p><ul><li>classis/provider.go -&gt; now has a new resource map (This is how you can add more resources as well)</li><li>classis/sampleclassis_aws_spot_group_object.go -&gt; this is going to be one of our custom resources (you can sort of think of these as a table of required data for the configuration of that item)</li></ul><p>The new sampleclassis_aws_spot_group_object.go is really where the meat of the code lies. One thing to keep in mind is that you must implement the Create/Read/Delete operations, I’ve gotten away to a degree with just a nil implementation of the Read operations, however I wouldn’t go with that in a prod scenario. Update/Exists are optional. Now with the follow tf file you can do normal terraform stuff!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b279d48221a660b5b89f2814204113fb/href">https://medium.com/media/b279d48221a660b5b89f2814204113fb/href</a></iframe><pre>⇒  terraform apply</pre><pre>...</pre><pre>Apply complete! Resources: 1 added, 0 changed, 0 destroyed.</pre><p>At this point, our provider creates and updates new classis spot groups! Now that we’ve got this great functionality, let’s get it published so other folks can use it!</p><h4>4. Poor mans update</h4><p>In our classis service, all changes require creating new fleets, and then deleting the old ones. Typically, terraform can compare the current state and issue updates, but we don’t need this for our service. This means we don’t need an update implementation and can just ensure all resources get destroyed and recreated but ensuring that all items definteFoceNew: <strong>true </strong>in the resource definition.</p><h3><strong>Publishing the provider — Better but long way to go</strong></h3><p>Hashicorp has recently added a modules registry for sharing modules along with nice versioning features. You can submit providers to the registries and provide some value. However it’s not seamless. Even if you publish them in the registry, I like creating a container that gives a quick and simple way for users to use your custom providers. Some thoughts on using the registry for providers.</p><p>Good —</p><ul><li>Easier to be found</li><li>Can provide instructions to build/download the binaries</li><li>Possibly will be supported more fully in the future?</li></ul><p>Unfortunate —</p><ul><li>Not seamless</li><li>People will need to understand where to put the different arch pieces</li></ul><h4><strong>Alternative Publishing— (Inspired from HP oneview provider)</strong></h4><p>Looking at this <a href="https://github.com/josmo/terraform-provider-sampleclassis/tree/docker-checkpoint">checkpoint</a> you’ll see a new Dockerfile. This will create a container that has the terraform binaries along with the custom plugin binaries. This means folks need only have docker to use your new custom plugin!</p><p>Building and running once the binaries are generated is as simple as</p><pre><em>docker build -t josmo/terraform-sampleclassis .</em></pre><pre><em>docker run -i -t -v $(pwd):/app/ -w /app/ josmo/terraform-sampleclassis init -plugin-dir=/usr/local/terraform-plugins<br> <br>docker run -i -t -v $(pwd):/app/ -w /app/ josmo/terraform-sampleclassis test plan</em></pre><blockquote>Note — Since this runs inside a docker container, make sure you’re not testing anything as localhost! localhost in the container refers to itself.</blockquote><h3>About me</h3><p>With the LIFFFT/Pelo.tech @pelotechnology crew, we’re on the next versions of dev concepts which allow for complete self-hosted apps, deployments which are based on high-availability, high-scalability, and simple blue/green style deployments. Hit me up if you’re interested in more info about it!</p><p>Joachim Hill-Grannec @lindyblues is a Partner at <a href="http://www.pelo.tech/">http://www.pelo.tech</a>, a group that helps organizations improve their dev practices and culture. These days you’ll also find him traveling around the world dancing at West Coast Swing events.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=341311823fa2" width="1" height="1" alt=""><hr><p><a href="https://blog.pelo.tech/creating-custom-terraform-providers-341311823fa2">Creating custom terraform providers</a> was originally published in <a href="https://blog.pelo.tech/">Pelotech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Modern Cross-Platform approach to µServices in .NET]]></title>
            <link>https://blog.pelo.tech/a-modern-cross-platform-approach-to-%C2%B5services-in-net-a4c591740c31?source=rss-b661da49799b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4c591740c31</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[apollo]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Joachim Hill-Grannec]]></dc:creator>
            <pubDate>Wed, 29 Nov 2017 18:58:19 GMT</pubDate>
            <atom:updated>2017-11-29T18:58:19.421Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*grgavsYRQoqHhEWEbQLP5Q.png" /></figure><h4>Part 3: Apollo GraphQL example digesting REST and gRPC endpoints</h4><p><a href="https://medium.com/@jozmo/a-modern-cross-platform-approach-to-%C2%B5services-in-net-c73339418e9d">Part 1: Dockerized REST API in C# .NET</a></p><p><a href="https://medium.com/@jozmo/a-modern-cross-platform-approach-to-%C2%B5services-in-net-b762e11e2073">Part 2: Dockerized gRPC API in C# .NET</a></p><p>Part 3: Apollo GraphQL example digesting REST and gRPC endpoints (This Part)</p><p>Part 4: Apollo React.js client</p><p>Part 5: Overview of the pieces together and deployment</p><p>Now we’re going to take GraphQL on! You can find all the code at <a href="https://github.com/josmo/sample-applications-graphql">https://github.com/josmo/sample-applications-graphql</a></p><p>To get a good idea of the mechanics behind GraphQL, the <a href="https://dev-blog.apollodata.com/">Apollo crew </a>has lots of blog posts on the subject but here’s a few starting points:</p><ul><li><a href="http://graphql.org/graphql-js/">Hello World</a></li><li><a href="https://dev-blog.apollodata.com/graphql-explained-5844742f195e">GraphQL explained</a></li></ul><p><strong>— Checkpoint 1 (The hello world equiv of our graphql service)</strong></p><p>If we look at this <a href="https://github.com/josmo/sample-applications-graphql/tree/hello-world-checkpoint">checkpoint</a>, well see that it has the following structure (Note that a few of these folders are currently place holders that we’ll use later)</p><ul><li>config -&gt; contains configuration information for different environment-specific configuration, like which URLs/endpoints to hit to fetch data.</li><li>src/connectors -&gt; Contains all the actual client service implementations</li><li>src/mutations -&gt; Contains any of the mutation definitions</li><li>src/queries -&gt; Contains all the queries</li><li>src/types -&gt; Contains all the types and relationships</li><li>src/mocks.js -&gt; gives us the ability to mock all our data without the need of the downstream services</li><li>src/resolvers.js -&gt; The definition of how we fulfill our queries and mutations. Its the link to the connectors</li><li>src/rootSchema.js -&gt; Entry point to all things</li><li>server.js -&gt; our setup of the server</li></ul><p>Right now there’s not much interesting. You can start it with</p><pre>npm install<br>npm start</pre><p>From this point you can go to localhost:3000/graphiql and start running a simple query like</p><pre>{hello}</pre><p>and get back</p><pre>{<br>  &quot;data&quot;: {<br>    &quot;hello&quot;: &quot;It works!&quot;<br>  }<br>}</pre><p><strong>— Checkpoint 2 (Mocking out the structure of data we’ll provide the client)</strong></p><p>In this <a href="https://github.com/josmo/sample-applications-graphql/tree/applications-mocks-checkpoint">checkpoint</a> we’re going to make the following updates:</p><ol><li>src/types/types.js -&gt; we’re going to add an Applications schema</li><li>src/queries/queries.js -&gt; we’re going to add an applications entry point for queries</li><li>src/mocks.js -&gt; we’ll define some better data for the mocks</li></ol><p>Now using a query like the following</p><pre>{<br>  applications {<br>    applicationID<br>    applicationName<br>    description<br>    applicationURL<br>  }<br>}</pre><p>Will return an easier to test set of</p><pre>{<br>  &quot;data&quot;: {<br>    &quot;applications&quot;: [<br>      {<br>        &quot;applicationID&quot;: 499,<br>        &quot;applicationName&quot;: &quot;Mrs. Alivia Purdy&quot;,<br>        &quot;description&quot;: &quot;vel accusamus dolorem mollitia maiores et velit velit dolores dolorum&quot;,<br>        &quot;applicationURL&quot;: &quot;<a href="http://www.dubuque.name/">http://www.DuBuque.name/</a>&quot;<br>      },<br>      {<br>        &quot;applicationID&quot;: 344,<br>        &quot;applicationName&quot;: &quot;Ms. Alba Goldner&quot;,<br>        &quot;description&quot;: &quot;maiores dolores sit ex rerum repellendus pariatur sed commodi et&quot;,<br>        &quot;applicationURL&quot;: &quot;<a href="http://susan.org/">http://Susan.org/</a>&quot;<br>      },<br>      {<br>        &quot;applicationID&quot;: 796,<br>        &quot;applicationName&quot;: &quot;Mr. Mariela Bruen&quot;,<br>        &quot;description&quot;: &quot;magni dignissimos qui repudiandae provident quibusdam quia delectus dolorem sunt&quot;,<br>        &quot;applicationURL&quot;: &quot;<a href="http://dietrich.biz/">http://Dietrich.biz/</a>&quot;<br>      },<br>............</pre><pre>    ]<br>  }<br>}</pre><p><strong>— Checkpoint 3 (Let’s try adding the resolver and connector info to live data)</strong></p><p>Looking at this <a href="https://github.com/josmo/sample-applications-graphql/tree/real-data-checkpoint">checkpoint</a> we’re going to see how simple it is to tie to live data. We’re going to create src/connectors/applications_connector.js (check that out!) and add the connection in the src/resolver.js</p><p>At this point we’re hitting live local (or remote data if in production) Wohoo!!!</p><p><strong>— Checkpoint 4 (Looking at creating a relationship and using dynamic gRPC instead of Rest )</strong></p><p>Using this <a href="https://github.com/josmo/sample-applications-graphql/tree/grpc-data-checkpoint">checkpoint</a>, you’ll see that a new connector showed up. src/connectors/status_connector.js. This guy is now using a gRPC client to hit the service we created in the earlier post to get status information on the service. We also modified src/types/types.js and src/resolver.js to connect the pieces together. We also copied the proto file in /src/proto and link to it dynamically to request data (we’re also using a promisify lib for simplicity but honestly we’ll remove it later in an other post since it doesn’t currently support meta-data)</p><p><strong>— Informative (If you want static types for the service in javascript)</strong></p><p>If you want to go the static js generated route you can using the js message and request files that were generated in Part 2. However it currently doesn’t support es6 imports so you’ll have to go the old school require route ;) The rest is pretty much the same as dynamic gRPC</p><p><strong>— Checkpoint 5 (Looking at tracing for performance information)</strong></p><p>If you checkout this <a href="https://github.com/josmo/sample-applications-graphql/tree/trace-data-checkpoint">checkpoint</a> you’ll see that by adding tracing: true to the service startup like the following:</p><pre>graphQLServer.use(<strong>&#39;/graphql&#39;</strong>, bodyParser.<strong>json</strong>(),<br>  <em>graphqlExpress</em>({ schema, <strong>context</strong>: {}, <strong>tracing</strong>: <strong>true </strong>}));</pre><p>You’ll get tracing information on all you’re requests which will help you find what might be slow in your architecture. The Apollo folks have <a href="https://dev-blog.apollodata.com/exposing-trace-data-for-your-graphql-server-with-apollo-tracing-97c5dd391385">this blog</a> about it :)</p><p><strong>— Checkpoint 6 (Building and throwing it in Docker)</strong></p><p>Now it’s as easy as building the app. There are a couple things to keep in mind. I’m using drone to run yarn to install the node modules for linux before creating this container. You may need to add an other step in the Dockerfile to install node modules if you’re not doing that in some other way.</p><pre>docker build -t sample-applications-graphql .<br>docker run sample-applications-graphql</pre><p>With the LIFFFT/Pelo.tech @pelotechnology crew, we’re on the next versions of dev concepts which allow for complete self-hosted apps, deployments which are based on high-availability, high-scalability, and simple blue/green style deployments. Hit me up if you’re interested in more info about it!</p><p>Joachim Hill-Grannec @lindyblues is a Partner at <a href="http://www.pelo.tech/">http://www.pelo.tech</a>, a group that helps organizations improve their dev practices and culture. These days you’ll also find him traveling around the world dancing at West Coast Swing events.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4c591740c31" width="1" height="1" alt=""><hr><p><a href="https://blog.pelo.tech/a-modern-cross-platform-approach-to-%C2%B5services-in-net-a4c591740c31">A Modern Cross-Platform approach to µServices in .NET</a> was originally published in <a href="https://blog.pelo.tech/">Pelotech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Modern Cross-Platform approach to µServices in .NET]]></title>
            <link>https://blog.pelo.tech/a-modern-cross-platform-approach-to-%C2%B5services-in-net-b762e11e2073?source=rss-b661da49799b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b762e11e2073</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Joachim Hill-Grannec]]></dc:creator>
            <pubDate>Tue, 24 Oct 2017 19:07:48 GMT</pubDate>
            <atom:updated>2019-08-14T20:48:37.844Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part 2: Dockerized gRPC API in C# on .NET</h4><p>A quick note: If you haven’t yet, it’s probably a good thing to start at Part 1 ;)</p><p><a href="https://medium.com/@jozmo/full-stack-c-services-rest-grpc-apollo-graphql-and-react-js-c73339418e9d">Part 1: Dockerized REST API in C# .NET</a></p><p>Part 2: Dockerized gRPC API in C# .NET (This part)</p><p>Part 3: <a href="https://medium.com/@jozmo/a-modern-cross-platform-approach-to-%C2%B5services-in-net-a4c591740c31">GraphQL example digesting REST and gRPC endpoints</a></p><p>Part 4: Apollo React.js client</p><p>Part 5: Overview of the pieces together and deployment</p><p><strong>What’s this part about (gRPC in C#)?</strong></p><p>For those new to gRPC, there’s a decent amount of talk online about the trade offs with other service apis. You can check out <a href="https://stackoverflow.com/questions/43682366/how-is-grpc-different-from-rest">SO</a> or tons of blogs, but generally speaking gRPC has binary exchange and supports streaming. It generally makes it faster than the likes of REST, but like all technology choices there are trade-offs you need to think about. My personal advice falls into</p><p>Use gRPC</p><ol><li>You’re a mature(ish) tech org</li><li>Have good build and deployment practices</li><li>Need fast, streaming information</li><li>Want a very clear contract from clients to services</li></ol><p>Think twice using gRPC if</p><ol><li>Have a hard time understanding how to create services</li><li>Have an environment where setting up tooling, builds, services, etc is difficult</li><li>Don’t have clear experience on designing simple APIs</li></ol><p>4. Have lots of other places you can clean up performance issues</p><p>Here we’re going to create something that should look very similar to Part 1 except instead of creating restful endpoints, we’re going to create a gRPC service. The repo is located at (<a href="https://github.com/josmo/sample-dotnet-grpc">https://github.com/josmo/sample-dotnet-grpc</a>). Now go ahead and Create a .NET core 2.0 project ;)</p><p>In the diagram it’s the stub status each services</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8L4anCHFtSiNoTgwx3oh0w.png" /><figcaption>A basic look at what the final structure could look like</figcaption></figure><p><strong>— Checkpoint 1 (Creating the service definition)</strong></p><p>Looking at this <a href="https://github.com/josmo/sample-dotnet-grpc/tree/proto-generate-checkpoint">checkpoint</a>, you can see the proto/internal_application.proto file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/71d9dc7ab7a0edc2e0270970b1e4c122/href">https://medium.com/media/71d9dc7ab7a0edc2e0270970b1e4c122/href</a></iframe><p>If you’re not super familiar with protobuf head over to <a href="https://grpc.io/docs/">https://grpc.io/docs/</a> there’s tons of information on how to get started. In this case we’re going to generate C# and JavaScript files from it.</p><p>It’s relatively simple and just do the following: (note that the protoc-gen-grpc needs to be the location of where the grpc.tools nuget package gets installed. This will generate the server part of the code)</p><pre>&gt; dotnet add package Grpc.Core<br>&gt; dotnet add package Grpc.Tools<br>&gt; dotnet add package Google.Protobuf<br>&gt; protoc --csharp_out=code_gen_csharp proto/internal_application.proto --grpc_out=code_gen_csharp --plugin=protoc-gen-grpc=/Users/{youruser}/.nuget/packages/grpc.tools/1.6.0/tools/macosx_x64/grpc_csharp_plugin<br>&gt; protoc -I=./proto --js_out=code_gen_js proto/internal_application.proto</pre><p>This will output C# and Javascript files representing the schema above. We don’t need Javascript yet, but I’m generating the scripts for the client site in the next post. I’m going to commit these files into the repo but normally you would publish this to an internal nuget/npm registry, or equivalent location.</p><p><strong>— Checkpoint 2 (Creating the server and dummy implementation)</strong></p><p>This <a href="https://github.com/josmo/sample-dotnet-grpc/tree/implementation-checkpoint">checkpoint</a> is probably the meat of the project. We’re going to look at:</p><p>services/StatusImpl.cs -&gt; this has the implementation for the service (we’re just going to have dummy static data) If you look at it. It’s really just an implementation of the interface created from the proto file by the code-gen. In this case you get a request object and create and return the response object.</p><p>Program.cs -&gt; will create and startup the server. The main thing here is that the generated code includes the server piece and you just need to configure a few things with the service implementation and add it to the server :)</p><p>Now you can start the service up and it should work :) One thing note worthy is that unlike REST services, it’s a bit harder to test and validate to see if everything seems kosher. My poor mans version of testing is to add a “client request” after server startup. You can check out the master branch for an example in Program.cs.</p><p><strong>— Checkpoint 3 (Grabbing meta data if we need it)</strong></p><p>So what happens when you need to start thinking about authentication type stuff a la “Authorization” headers in REST services? This is where meta-data stuff comes in handy.</p><p>Meta data is pretty simple to grab check out this <a href="https://github.com/josmo/sample-dotnet-grpc/tree/metadata-checkpoint">checkpoint</a>. Unfortunately at the time of this post there isn’t an implementation for interceptors (if you need that go and checkout the grpc github project and start contributing ;)).</p><p>Look at services/StatusImpl.cs to see about grabbing metadata from the service.</p><pre>var headers = context.RequestHeaders;<br>var token = headers.Where(item =&gt; item.Key == <strong>&quot;token&quot;</strong>).Select(item =&gt; item.Value).FirstOrDefault();<br><strong>if </strong>(token != <strong>null</strong>)<br>{<br>    <em>//Congrats you have a token on the metadata headers ;) This is a great way to pass jwt tokens<br></em>}</pre><p><strong>— Checkpoint 4 (Building and throwing it in Docker)</strong></p><p>Looking at this checkpoint you’ll see that running the following commands will build your service</p><pre>dotnet publish -c Release -r linux-x64 -o out<br>docker build -t sample-dotnet-grpc .<br>docker run sample-dotnet-grpc</pre><p>Congrats you now have a simple C# cross platform gRPC running in docker!</p><p>With the LIFFFT/Pelo.tech @pelotechnology crew, we’re on the next versions of dev concepts which allow for complete self-hosted apps, deployments which are based on high-availability, high-scalability, and simple blue/green style deployments. Hit me up if you’re interested in more info about it!</p><p>Joachim Hill-Grannec @lindyblues is a Partner at <a href="http://www.pelo.tech/">http://www.pelo.tech</a>, a group that helps organizations improve their dev practices and culture. These days you’ll also find him traveling around the world dancing at West Coast Swing events.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b762e11e2073" width="1" height="1" alt=""><hr><p><a href="https://blog.pelo.tech/a-modern-cross-platform-approach-to-%C2%B5services-in-net-b762e11e2073">A Modern Cross-Platform approach to µServices in .NET</a> was originally published in <a href="https://blog.pelo.tech/">Pelotech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Modern Cross-Platform approach to µServices in .NET]]></title>
            <link>https://blog.pelo.tech/a-modern-cross-platform-approach-to-%C2%B5services-in-net-c73339418e9d?source=rss-b661da49799b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c73339418e9d</guid>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[entity-framework-core]]></category>
            <dc:creator><![CDATA[Joachim Hill-Grannec]]></dc:creator>
            <pubDate>Fri, 20 Oct 2017 23:58:16 GMT</pubDate>
            <atom:updated>2019-08-14T20:47:16.400Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part 1 — C# Rest API: A simple service built to run in Docker (Linux) with EF and Nancy FX</h4><p><strong>How did I come about to try this out? </strong>TLDR: This implementation came out of a conversation about modernizing a .NET shop to make use of modern micro-service paradigms. ;)</p><p>Recently, I moved to NYC from Seattle, and although I love both cities, it’s definitely been a different experience meeting people. While talking to Bryce (Another person I’ve had the privilege to work with in Seattle) about the ins and outs on building a network in NYC, he introduced me to Jonathan who’s working in midtown for a financial company (wait… NYC has finance? :wink:, who knew!). We started chatting about life and pretty soon were geeking about various tech stacks and whatever might be hip these days. At a certain point we got on the topic of .NET shops. Honestly, .NET isn’t exactly known to be cutting edge, but these days Microsoft has been tweeting in my ears again on cool stuff they’ve been promoting. While they are pretty far behind in the open source community and related practices, their efforts are definitely in the right direction. For example, I was surprised to see that for the most part everything in these posts works the same in Windows, Linux, and macOS. After a wonderful chat, I wondered if it would be possible to get a quick micro service architecture running on docker in AWS/Azure/GCP on linux, written in C# (although, it definitely morphed into more, hence the followup posts!). It could be a helpful for people stuck in their ways and demonstrate modern style development and operations. Many .NET folks aren’t used to a stack that really promotes these practices. The following is the story of building this architecture in .NET!</p><p>Part 1: Dockerized REST API in C# on .NET (This Part)</p><p><a href="https://medium.com/@jozmo/a-modern-cross-platform-approach-to-%C2%B5services-in-net-b762e11e2073">Part 2: Dockerized gRPC API in C# on .NET</a></p><p>Part 3:<a href="https://medium.com/@jozmo/a-modern-cross-platform-approach-to-%C2%B5services-in-net-a4c591740c31"> GraphQL example digesting REST and gRPC endpoints</a></p><p>Part 4: Apollo React.js client</p><p>Part 5: Overview of the pieces together and deployment</p><p><strong>What are we Building?</strong></p><p>For this example we’re going to build an internal application registry. The idea is that we’ll have a simple C# REST service where we can store and retrieve information about the organizations available web apps. Things like it’s name, description, url, etc. Then we’ll have a gRPC service that has information about the state of the service (things like online, offline, etc). On top of that we’ll have a graphql service that links the two pieces, and finally a react.js client that consumes that graphql service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lU6nGVpQVGosftKad4dteg.png" /><figcaption>A basic look at what the final structure could look like</figcaption></figure><p><strong>Getting Started — What’s the tech involved (check out </strong><a href="https://github.com/josmo/sample-dotnet-rest">https://github.com/josmo/sample-dotnet-rest</a><strong> for the code)</strong></p><ul><li>C# (mono or dotnet)</li><li>Grab you favorite IDE (I’m using <a href="https://www.jetbrains.com/rider/">Rider</a>)</li><li>Docker</li><li><a href="http://rancher.com/">Rancher </a>(out of scope, and out of scope but part of our CI/CD story)</li><li><a href="https://github.com/drone/drone">Drone</a> (out of scope but part of our CI/CD story)</li><li>AWS/Azure (out of scope ;))</li></ul><blockquote>Mono or dotnet — (checkout <a href="https://stackoverflow.com/questions/37738106/net-core-vs-mono">stackoverflow</a> for help choosing)</blockquote><p>What frameworks are we going to use</p><ul><li>.NET core 2.0</li><li><a href="http://nancyfx.org/">Nancy fx</a></li><li><a href="https://blogs.msdn.microsoft.com/dotnet/2017/08/14/announcing-entity-framework-core-2-0/">Entity Framework</a></li></ul><p>Create a .NET core project — first commit in the project should Give you an idea of what that looks like :)</p><p>Now let’s start by getting Nancy Fx going. Here you should use Nuget (For the non aware, Nuget is .NETs equivalent to maven/npm)</p><pre>&gt; dotnet add package Nancy -v 2.0.0-clienteastwood<br>&gt; dotnet add package Nancy.Authentication.Stateless -v 2.0.0-clienteastwood<br>&gt; dotnet add package Nancy.Hosting.Self -v 2.0.0-clienteastwood</pre><p><strong>— Checkpoint 1 “Basic service running”</strong></p><p>Modify your Program.cs file to look like the one at this <a href="https://github.com/josmo/sample-dotnet-rest/tree/nancy-checkpoint">checkpoint</a>. One thing to point out is that I’m doing a “Thread.Sleep(Timeout.<strong><em>Infinite</em></strong>);” at line 28. This may seem weird at first since most of the examples have a waiting for key press to kill the service. However this is going to make it so that we can start the service in a Docker container later.</p><p>Note: If you’re on windows and don’t have admin rights by default. First poor you… I do feel your pain! Second you’ll need to run something like the following with Administrator privilege:</p><pre>&gt; netsh http add urlacl url=http://+:8888/ user=Everyone</pre><p><strong>— Checkpoint 2 “Creating your endpoint”</strong></p><p>Now looking at this <a href="https://github.com/josmo/sample-dotnet-rest/tree/endpoint-checkpoint">checkpoint</a> we’ll find two new files. models/Applications.cs which is just a POCO (Plain old C# object) and modules/Applications.cs which will contain our routes for Nancy FX. Running this locally we essentially have <a href="http://baseurl:8888/v1/applications">http://baseurl:8888/v1/applications</a> as our first route!</p><p><strong>— Checkpoint 3 “Adding data source via code first in Entity Framework”</strong></p><p>For those of you that didn’t know you can code a la rails style for entity creation. Meaning you can create the model representation of the DB and EF can create the database for you from the coded model.</p><p>Now from this <a href="https://github.com/josmo/sample-dotnet-rest/tree/code-first-ef-crud-checkpoint">checkpoint </a>you see the following needs to happen.</p><ol><li>More Nuget</li></ol><pre>&gt; dotnet add package Microsoft.EntityFrameworkCore -v 2.0.0<br>&gt; dotnet add package Microsoft.EntityFrameworkCore.SqlServer -v 2.0.0<br>&gt; dotnet add package Microsoft.EntityFrameworkCore.Tools -v 2.0.0</pre><p>2. contexts/AppDbContext contains the connection information as well as what DbSets (models bound to the database) are available. You may notice that I’m using environment variables to load the host, user and password. I’m doing that so I can later configure it inside a container.</p><p>3. models/Application.cs now has annotations for the tables name and the data types</p><p>4. modules/Applications.cs now has the database context injected, has well as the full CRUD endpoints.</p><p>5. This is a weird piece but to use the code to table generation you’ll need to add the DotNetCliToolReference like the following code chunk. This will let you run “dotnet ef” commands :)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/adaa61a4277eced0e62c1fcffa3cc390/href">https://medium.com/media/adaa61a4277eced0e62c1fcffa3cc390/href</a></iframe><p>6. At this point you should now be able to create your database using:</p><pre>&gt; dotnet ef migrations add initial (this will create a Migrations folder)</pre><pre>&gt; dotnet ef database update</pre><p><strong>— Checkpoint 4 “Lets add some performance metrics”</strong></p><p>Now looking at this <a href="https://github.com/josmo/sample-dotnet-rest/tree/perf-logging-checkpoint">checkpoint </a>you’ll see helpers/MiddlewareWrapper.cs has an intercept and we’re using it in modules/Applications.cs to get timing information on our requests. This is a good thing to start thinking about early while you’re developing your services. Having an idea of where bottlenecks show up becomes crucial later on.</p><p><strong>— Checkpoint 5 “Let’s build and Docker this thing up”</strong></p><p>Looking at the master branch you’ll see that running the following commands will build you’re service</p><pre>dotnet publish -c Release -r linux-x64 -o out<br>docker build -t sample-dotnet-rest .<br>docker run sample-dotnet-rest (you&#39;ll need the host, username and password as environment variables)</pre><p>Congrats you now have a simple C# cross platform REST service using Entity Framework with code first running in docker!</p><p>With the LIFFFT/Pelo.tech @pelotechnology crew, we’re on the next versions of dev concepts which allow for complete self-hosted apps, deployments which are based on high-availability, high-scalability, and simple blue/green style deployments. Hit me up if you’re interested in more info about it!</p><p>Joachim Hill-Grannec @lindyblues is a Partner at <a href="http://www.pelo.tech/">http://www.pelo.tech</a>, a group that helps organizations improve their dev practices and culture. These days you’ll also find him traveling around the world dancing at West Coast Swing events.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c73339418e9d" width="1" height="1" alt=""><hr><p><a href="https://blog.pelo.tech/a-modern-cross-platform-approach-to-%C2%B5services-in-net-c73339418e9d">A Modern Cross-Platform approach to µServices in .NET</a> was originally published in <a href="https://blog.pelo.tech/">Pelotech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform like Mac setup]]></title>
            <link>https://blog.pelo.tech/terraform-like-mac-setup-e1bd5e08bc01?source=rss-b661da49799b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1bd5e08bc01</guid>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[ansible]]></category>
            <dc:creator><![CDATA[Joachim Hill-Grannec]]></dc:creator>
            <pubDate>Sun, 30 Jul 2017 00:50:13 GMT</pubDate>
            <atom:updated>2017-07-30T04:24:09.826Z</atom:updated>
            <content:encoded><![CDATA[<p>On today’s edition of “Things Joachim finds awesome”, I’m going to go over my recent switch to simple automated macOS re-installs. Essentially how to get your environment back to normal as quickly as possible, and how to test that setup without wiping your current environment out.</p><p><strong>Several reasons you might want this</strong></p><ol><li>You’ve installed a bunch of random crap that might or might not be causing system level issues and you really don’t know what. — Don’t tell me that’s never happened to you</li><li>You get a loaner laptop while yours is getting repaired and you want everything back as quickly as possible. — YUCK</li><li>Think someone has taken over the world and your laptop and you want to start from scratch</li><li>Insert your own and many more reasons here :)</li></ol><p><strong>Possible options</strong></p><ul><li>Don’t do it. — Would kinda make this blog pointless ;)</li><li>Bunch of shell scripts. — Woohoo write once never understand again</li><li>Ansible to the rescue. — Hum I wonder which one I’m choosing?</li></ul><p>After looking at a bunch of projects, I never really wanted to use any of them. They all seemed bug prone and hard to understand what would happen after changes to the scripts. Plus automated installs of app store programs is really a must these days. That’s when I came across <a href="https://github.com/geerlingguy/mac-dev-playbook">geerlingguy/mac-dev-playbook</a>, you can look at my fork <a href="https://github.com/josmo/mac-dev-playbook">josmo/mac-dev-playbook</a> for the changes that I’ve added.</p><p><strong>What does it do?</strong></p><ol><li>Uses yml configuration files to define what happens</li><li>Has a more terraform like definition of what is being done vs shell scripts (Honestly it’s a bit in between Terraform and shell scripts but close enough for me)</li><li>Symlink at the dotfiles, includes the possible use</li><li>Installs app store programs</li><li>Install brew and brew cask apps</li></ol><p><strong>Ok I want to get started, what should I do? (I want Joachim’s setup)</strong></p><p>In your home folder run.</p><pre>curl <a href="https://raw.githubusercontent.com/josmo/mac-dev-playbook/master/syncup.sh">https://raw.githubusercontent.com/josmo/mac-dev-playbook/master/syncup.sh</a> | sh</pre><p>WTF? is that it?…. Yep that’s it lets looks at what it’s going to do and how you can customize</p><ol><li>It’s going to install homebrew (and with it some X-Code stuff you need ;))</li><li>It’s going to clone my mac-dev-playbook</li><li>install ansible</li><li>install you’re ansible requirements</li><li>runs the main playbook. (installs everything in default.config.yml)</li></ol><p><strong>The things I still wish for</strong></p><p>So this setup is great and all, but the thing I personally still don’t like is that there’s no concept of removal state. If you remove something from the playbook it doesn’t uninstall it. This is something I personally love about terraform. It represents the current state of the infrastructure where this is more “what I want at the start”. Additionally, I’d love to have a simple command to add something to my configuration a la (again) terraform. Something like “mac-setup add docker” and it would automatically install docker and save the config. This is still way closer then what we’ve had before :)</p><p><strong>Lastly- Testing this out</strong></p><p>I use parallels for my virtualization needs to replace your preferred virtualization setup where ever I say parallels :)</p><p>Currently creating a sample vm with macOS Sierra is pretty simple. Start out by going to the app store, search for Sierra and hit the download button (When it’s done just exit the install, don’t continue). When it’s done insert a usb drive and run (Make sure to change Untitled to the name of the usb drive)</p><pre>sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia — volume /Volumes/Untitled — applicationpath /Applications/Install\ macOS\ Sierra.app</pre><p>Now in parallels go to the create new Machine wizard, Select the “Install Windows or another OS from a DVD or image file”. From there is should just find your usb disk and start create you’re new VM. Now you can customize mac-dev-playbook and see if everything get’s to the place you want.</p><p>With the LIFFFT/Pelo.tech @pelotechnology crew, we’re on the next versions of dev concepts which allow for complete self-hosted apps, deployments which are based on high-availability, high-scalability, and simple blue/green style deployments. Hit me up if you’re interested in more info about it!</p><p>Joachim Hill-Grannec @lindyblues is a Partner at <a href="http://www.pelo.tech/">http://www.pelo.tech</a>, a group that helps organizations improve their dev practices and culture. These days you’ll also find him traveling around the world dancing at West Coast Swing events.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1bd5e08bc01" width="1" height="1" alt=""><hr><p><a href="https://blog.pelo.tech/terraform-like-mac-setup-e1bd5e08bc01">Terraform like Mac setup</a> was originally published in <a href="https://blog.pelo.tech/">Pelotech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Winning hackathons devops style!]]></title>
            <link>https://blog.pelo.tech/winning-hackathons-devops-style-68db284302cf?source=rss-b661da49799b------2</link>
            <guid isPermaLink="false">https://medium.com/p/68db284302cf</guid>
            <category><![CDATA[rancher]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[netapp]]></category>
            <category><![CDATA[drone-ci]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Joachim Hill-Grannec]]></dc:creator>
            <pubDate>Fri, 21 Jul 2017 20:47:44 GMT</pubDate>
            <atom:updated>2017-07-21T21:33:46.106Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I joined up for a <a href="http://www.developerweek.com/NYC/hackathon/#prizes">hackathon</a> (Spoiler — we won the NetApp challenge) after moving to NYC. We found ourselves in an interesting scenario.</p><p><strong>THE PROBLEM </strong>— Have you ever lived or worked in a building where the buzzer is just a pain to change so you can forward calls to coworkers/roommates? Imagine this; A friend of yours get’s to the apartment and buzzes your #. However it’s set to forward to your roommate who’s in South Africa visiting his girlfriends parents (in other words NO CELL SERVICE). Now you’re running late to get home and your friend is just stuck outside instead of being able to have the building call you instead.</p><p><strong>THE PRODUCT</strong> — What we ended up building is the solution to that problem. What if the buzz could forward to multiple numbers, or event better, your friend could enter a pin to gain entry? Essentially we built a PBX style app that integrates with <a href="http://zang.io/">Zang</a> to enable this.</p><p><strong>THE CONSTRAINT</strong> — For the sake of efficiency we had to use hardware that was pre-setup and couldn’t use anything we wanted. Also, we wanted to have our builds scalable from the start and each deployment would snapshot our entire data environment pre-deployment using <a href="http://www.netapp.com/us/products/data-management-software/ontap.aspx">NetApp ONTAP</a> (A sponsor of the Hackathon and really nice group of folks) so if any deployment had an issue we could quickly &amp; simply roll back.</p><p>Unfortunately, or Fortunately for me, I drank the stateless, docker, rebuildable architecture a la terraform Kool-aid and I hate going back to the crappy world that existed before. You know that world I’m talking about; no real CI/CD, lots of ssh’ing into other systems, scp’ing this to there. Signing up for Heroku and using products like Travis or Circle CI can go a long way to solve the speed issues, however they can’t be self-hosted and there are limits/complications on some integrations the more complex things get. Thankfully we now have tools and strategies that can help us. Many of these tools and strategies resolve the issues when in-between our ideal world and what we’re currently stuck with. Especially in large corporations that have not or cannot take the full plunge due to legacy issues.</p><p>Let’s look at what we used: Rancher — Awesome tool for deploying Orchestration (K8s, Cattle, Swarm, etc) in-cloud, on-prem, and really just about anywhere. Drone-ci — A great simple CI tool with a stateless build mindset built on top of docker.</p><p>Steps to take.</p><ol><li>Turn the NetApp server into a Rancher host</li><li>Create a NetApp snapshot plugin for Drone to allow easy roll-back in case of an error</li><li>Create the CI/CD pipepline with Snapshots baked in</li></ol><p><strong>Turn the NetApp Server into A Rancher host.</strong></p><p>Create a new environment in Rancher by going to the host section and getting the custom host commands and running that command on the NetApp server. Looks something like:</p><pre>sudo docker run — rm — privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.2 <a href="http://rancher.seattleslow.com/v1/scripts/365F54ADF8BD0A14227D:1483142400000:z7A3pFjzRNO7MHchT3eT5PbP48g">http://rancher.somedomain.com/v1/scripts/</a>somekeyvalues</pre><p>After a few minutes you should see the host show up and you can now have the freedom to deploy any containers to it.</p><p><strong>Creating a NetApp snapshot plugin for Drone</strong></p><p>Plugins for Drone are just simple Docker containers that get environment variables injected in. This means you could use it in any build system you have. In this case running a simple command like:</p><pre>docker run --rm                       \<br>  -e PLUGIN_URL=&lt;source&gt;              \<br>  -e PLUGIN_USERNAME=&lt;user_name&gt;      \<br>  -e PLUGIN_USER_NAME=&lt;user_password&gt; \<br>  -e PLUGIN_STORAGE_VM_KEY=&lt;vm_key&gt;   \<br>  -e PLUGIN_VOLUME_KEY=&lt;volume_key&gt;   \<br>  -e PLUGIN_NAME_PREFIX=&lt;name_prefix&gt;<br>  -v $(pwd):$(pwd)                    \<br>  -w $(pwd)                           \<br>  peloton/drone-netapp-snapshot</pre><p>will create a snapshot of the data volume. You can see all the code at <a href="https://github.com/josmo/drone-netapp-snapshot">https://github.com/josmo/drone-netapp-snapshot</a></p><p><strong>Create the CI/CD pipepline with Snapshots baked in</strong></p><p>Drone pipelines are out of the scope of this post but adding the following.</p><pre>pipeline:<br>  build:<br>    ...<br>  docker_publish:<br>    ...</pre><pre>  snapshot:<br>    image: peloton/drone-netapp-snapshot<br>    url: <a href="https://34.212.49.198:8443/api/2.0/ontap/snapshots">https://netappapiserver:8443/api/2.0/ontap/snapshots</a><br>    storage_vm_key: 082eb55c-53b0-11e7-b33e-633e98aa9f79:type=vserver,uuid=6141d5cc-53b0-11e7-b33e-633e98aa9f79<br>    volume_key: 082eb55c-53b0-11e7-b33e-633e98aa9f79:type=volume,uuid=2b8a5865-8def-4dd1-a7b1-c2fbe52921f1<br>    name_prefix: mySnapshot<br>    secrets: [ NETAPP_USER_NAME, NETAPP_USER_PASSWORD ]</pre><pre>  deploy:<br>    image: peloton/drone-rancher<br>    url: <a href="http://rancher.seattleslow.com/">http://rancher.domainname.com</a><br>    access_key: accesskeyvalue<br>    secrets: [ rancher_secret_key ]<br>    service: hack/web<br>    docker_image: classis/dockerimage:${DRONE_BUILD_NUMBER}</pre><p>Watch it fly!</p><p>In this case you get a pretty rad full snapshot prior to any deployments. This then makes restoring quick and easy. Rancher makes it simple to build all these kinds of practices in a mixed environment. I can’t even imagine living in a world where it’s not around. Drone helps create simple build and delivery pipelines, and NetApp helps with simple snapshots. This all translates beautifully to corporate environments where most things need to be hosted internally.</p><p>With the LIFFFT/Pelo.tech @pelotechnology crew, we’re working on the next versions of these concepts which allow for complete self-hosted apps, deployments which are based on high-availability, high-scalability, and simple blue/green style deployments. Hit me up if you’re interested in more info about it!</p><p>Joachim Hill-Grannec @lindyblues is a Partner at <a href="http://www.pelo.tech/">http://www.pelo.tech</a>, a group that helps organizations improve their dev practices and culture. These days you’ll also find him traveling around the world dancing at West Coast Swing events.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68db284302cf" width="1" height="1" alt=""><hr><p><a href="https://blog.pelo.tech/winning-hackathons-devops-style-68db284302cf">Winning hackathons devops style!</a> was originally published in <a href="https://blog.pelo.tech/">Pelotech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>