• 2019-05-12

    Haskell Showroom: Switching between different AWS accounts

    In my previous post I talked about denv and how I switch between different Kubernetes clusters.

    I also talked about the importance of being explicit about which environment you're currently working on, easily switching between and deactivating an environment so that we don't run accidental commands in the wrong context.

    Continuing this series, in this post I will talk about how to effectively switch between different AWS accounts.

    Read more…

    aws denv devops functional programming haskell haskell showroom open source

  • 2019-01-14

    Haskell Showroom: How to switch between multiple kubernetes clusters and namespaces

    A while ago I decided that I was done writing anything in bash. I just won't do it anymore! Instead I've started writing everything, even the smallest of tools, in Haskell.

    I just don't think it's possible to write good and maintainable software with bash, no matter how simple the tool might be. In my opinion the main benefit with bash is that it's so easy to distribute to end users. There's no special installation or configuration, you just download a script and run it. With haskell I'm aiming towards distributing statically linked binaries (although in simple cases dynamically linked binaries work just fine as well).1

    This series of posts titled "Haskell Showroom" are my attempt at showcasing what Haskell can be used for. It's an attempt to answer the question I get asked a lot:

    "What is Haskell a good fit for?"

    Haskell has a very good reputation when it comes to writing compilers but it's a general purpose programming language and it really can be used for all sorts of things. I mainly use it for writing web apps and CLI tools.

    In the first post in this series I will talk about my tool called denv, which is a tool to help me "manage environments". While it helps me manage (and switch between) various environments, in this post I will focus on how it helps with switching between multiple kubernetes clusters in a sane and simple way.

    Read more…

    clusters denv devops functional programming haskell haskell showroom kubectl kubernetes open source

  • 2016-09-08

    Haskell and Docker: Down the rabbit hole and back

    For the past couple of years I've been learning Haskell, and while I enjoy reading new materials in forms of books, papers, blogs posts and even tweets, thankfully I quickly came to realize that the best way to learn is to build things.

    That's not to say I just jumped right in. I spent a long time just playing around with the language, exploring various language features, libraries and getting to know the ecosystem in general. Not doing anything serious 1.

    At the time that was a bit more painful than now because now-a-days there's a lot more resources and organized materials around. The community has really stepped up! 2

    Anyhow... Building things. I've been using docker since it was released and have grown from resident docker fan-boy to resident expert over time. Also I've been involved with the Python API wrapper since the early days so it made sense to try and write a Haskell API wrapper. At the time that was the closest I came to web development (the docker daemon listens on a HTTP API) as I felt comfortable.

    The first attempt was awful. But it worked! I was able to launch containers and everything. Of course, the API of the library was horrendous. There were very little type guarantees for anything and the whole thing was just one big giant IO blob.

    Having realized this, I went on a crusade to learn all the fancy type machinery and make use of every trick and extension under the sun. That attempt went on and off for a couple of months until I realized that I created a monster and that I didn't need half the stuff I was using. So, having went from one extreme to the other I decided to delete everything and start fresh. I had some guidance from a couple of friends (thank you!) and I was getting pretty close to an API I was (more) happy with and that should be usable by most people. The library being usable was one criteria, but the other one was that it's more or less straightforward to contribute to. The reason being that the Docker Engine API is kind of huge at this point and I'm certainly either going to miss something, or implement it wrong, and it should be more or less easy for anyone to go in, and contribute a bugfix or a feature. Naturally, this dragged on since obviously I was doing this for fun and in my spare time. Thankfully, I got help somewhere along the way when James Parker jumped in. He was instrumental in getting the library in better shape so that we can finally release that major refactored version.

    Read more…

    docker haskell

  • 2016-02-17

    Handling Permissions with Docker Volumes

    In this post I'll try to explain the method I use to avoid having permission issues when using Docker Volumes. This is pre Docker 1.10 (which added user namespaces) and I will talk about those in my next post.

    Before we begin let me explain what are Docker Volumes and what they're used for. The official Docker docs explain this feature as follows:

    A data volume is a specially-designated directory within one or more containers
    that bypasses the Union File System.
    

    The main use-case for volumes is for persisting data between container runs (seeing as container are ephemeral). This is useful for data directories when running databases (such as PostgreSQL) within containers. Other than persisting databases it's useful for sharing code folders from your host system to the container when running in your development environment.

    Read more…

    docker root sudo volumes