from Hacker News

Hk, The new Heroku Client written in Go

by fyskij on 10/23/13, 8:45 AM with 30 comments

  • by bgentry on 10/23/13, 3:51 PM

    Hi everyone, I'm the new maintainer of hk. It's actually not very new :) You can see that Keith Rarick did most of the work on it over a year ago, along with some other major contributors: https://github.com/heroku/hk/graphs/contributors

    What is new is that I moved it to the Heroku org this week and will be spending a lot of my time turning it into a proper replacement for the Heroku Toolbelt & gem.

    It's still very early stage software, though. There isn't currently a supported installation method, and it's very far from having all of the necessary features to fully replace the old client. Also, the UX will probably change frequently and things may break, eat your data, etc. So don't rely on it just yet :)

    That being said, I'm really excited to see where we can take this in the next few months. Hk is already a great starting point. Go is very fast and lightweight, and offers some nice advantages over Ruby on the distribution & installation fronts.

    Hopefully we'll have something exciting to show in a couple months!

  • by pearkes on 10/23/13, 11:48 AM

    I use the two Heroku tools `foreman` and `heroku` regularly. I've recently switched to their Go alternatives, and for one thing, the speed has improved[1].

    However, the Heroku client is mostly network bound (communicating with their API), and on an average connection this speedup hardly matters.

    I wonder what the other benefits will be?

    [1]

      $ time heroku help
      real	0m0.409s
      user	0m0.146s
      sys	0m0.036s
    
      $ time hk help
      real	0m0.008s
      user	0m0.003s
      sys	0m0.004s
    
      $ time foreman run echo hello
      real	0m2.062s
      user	0m0.199s
      sys	0m0.100s
    
      $ time forego run echo hello
      real	0m0.886s
      user	0m0.205s
      sys	0m0.097s
  • by fderp on 10/23/13, 3:27 PM

    Using the heroku client every day, I noticed this new client does not namespace any of the commands. Subcommands of hk are:

        hk create # create app
        hk destroy # destroy app
        hk apps  # list apps
        hk set    # set config var
        hk unset  #unset config var
    
    Compare to heroku's (preferable, imho) commands:

        heroku apps:create    # create app
        heroku apps:destroy   # destroy app
        heroku apps           # list apps
        heroku config:set     # set config var
        heroku config:unset   # unset config var
    
    The command 'hk set' doesn't tell you any semantic information at all about what it's doing - I prefer the original syntax for its convention of being explicit.

    Other than that minor complaint, seems like a really cool project, going to look through the source later.

  • by zimbatm on 10/23/13, 10:59 AM

    Heroku is going to loose Solaris and a couple of other secondary target OSes if they go down that route. Golang can cross-compile to Linux, Darwin, Windows and a couple of BSDs.

    EDIT: It really seems that they are going down that route. They are also working on a Go implementation of Foreman here: https://github.com/ddollar/forego

  • by miloshadzic on 10/23/13, 10:37 AM

    This is the kind of thing that Go shines at.
  • by neya on 10/23/13, 9:46 AM

    On a side note, I would like someone with experience here to tell me how you can actually create command line commands? In this case, they seem to use:

        hk <insert command here>
    
    I would like to do something like:

       abc <some command>
    
    Basically something like a Rails scaffold generator. How difficult/easy is this? Googling didn't help much..

    Note: It doesn't have to be built with Golang..

    Thanks

    Edit: Thanks for the replies :)

    Note: It doesn't have to be just Go, I'm just asking in general..

    I would basically like to create a scaffold generator. So, when I do

        abc generate test
    
    I would like a file named test.html (or something) generated..

    Thanks again..

  • by FLUX-YOU on 10/23/13, 4:22 PM

      $ hk 47
      Statement: Greetings, meatbag
  • by knocte on 10/23/13, 9:58 AM

    Last time I looked at heroku, I had to install some non-open-source command-line tools to interact with it.

    So I'm wondering, is this alternative opensource now?