My name is Ken and I’m a geek. Like most geeks I like to stay up to date with the latest technologies, and normally try to find some excuse to play with them. As a dotCloud engineer I take advantage of our once a month hackdays to do just this.

One of the technologies I have been hearing a lot about lately is a new programming language called Go.

On the Go website it says “Go is an open source programming environment that makes it easy to build simple, reliable, and efficient software.” At first pass that sounds like a lot of programming languages, so what makes it better than the rest, and why is this so special?

To answer those questions, I’m going to steal some sections from the Go FAQ.

Go is a concurrent, garbage-collected language with fast compilation. It was started at Google and was released to the public on November 10, 2009.

Features of Go

  • It is possible to compile a large Go program in a few seconds on a single computer.
  • Go provides a model for software construction that makes dependency analysis easy and avoids much of the overhead of C-style include files and libraries.
  • Go’s type system has no hierarchy, so no time is spent defining the relationships between types. Also, although Go has static types the language attempts to make types feel lighter weight than in typical OO languages.
  • Go is fully garbage-collected and provides fundamental support for concurrent execution and communication.
  • By its design, Go proposes an approach for the construction of system software on multicore machines.

Typical Go App

If you have never seen a Go program before, here is the typical Hello World application written in Go.

https://gist.github.com/4658856

Looking at the code it is pretty straightforward. If it wasn’t for the curly brackets it almost looks like Python.

If you want to learn more about Go, I recommend their excellent tutorial http://tour.golang.org. I also did a quick search on amazon and it looks like there are already a number of Go books. So pick one up today, and start learning.

Learning Go on dotCloud

We are starting to use Go on a few internal projects at dotCloud. I like what I see so far, but before I get too ahead of myself, I still have a lot to learn. I personally find the best way to learn is to have a small, real world, non-critical project that you can use as your guinea pig.

Reading books and going through tutorials is a good place to start, but it’s a lot like high school physics, when you ignore friction, wind resistance and gravity. Once you start doing real world problems which include those variables, things never go smooth the first time.

That is why it is always best to get your hands dirty on a real project as soon as possible. dotCloud’s free sandbox apps are perfect for this.

I’m not sure about you, but a lot of the projects that I work on lately are web-based. I was sad to find out that there were not many options for hosting Go applications. It seems you could run your own server (VPS, etc) or you could deploy to Google App Engine.

One of the many advantages of working for dotCloud is having access to this awesome deployment platform, where I’m like a kid in a candy shop. I can take these different services, write some code and easily deploy them to dotCloud, all without breaking a sweat.

Last Friday we had a hackday at dotCloud, where everyone takes the day off from their normal projects and we can work on anything we want. I took this time, to work on a Go on dotCloud custom service. It is still very early, but it allows you deploy your Go applications to dotCloud as easily as all of our other services.

Try it out on dotCloud

I have put the code up on github so that everyone can use it, and submit pull requests. It is still very early beta, but I welcome everyone to try it out, and please let me know what you think, good or bad. If you have a suggestion on how to make it better, feel free to submit pull requests and issues.

Using it is pretty straightforward. Assuming you already have a FREE dotCloud account, you just need to follow these steps.

  • Create a new application

$ dotcloud create -f sandbox mygoapp

  • Fork my github repo, and then clone it.

$  git clone git://github.com/kencochrane/golang-on-dotcloud.git

  • Add your code in the src directory.
  • Edit the dotcloud.yml
    • Change the build_package config variable, to the name of your GO package
    • Change the processes so that you can run the correct processes
    • Add or remove ports depending on your application needs.
  • Push the application

$ dotcloud push mygoapp .

Enjoy!

That should be about it. Best of all you can do all of this for FREE since dotCloud doesn’t charge for services in the Sandbox. So deploy as many times as you like, and let me know if you have any questions or problems.

Coming from a Python background, I am most interested in the fact that Go is a fast compiled language with concurrency built-in. I don’t think it will replace Python as my go-to language, but when I need something small and fast with concurrency, it is nice to know there is another option at my disposal.

I’m looking for new ideas for my next hackday, if you have any suggestions, please let me know.

Share localhost web servers to the web with dotCloud

Sometimes you want to easily share what you’re running on your laptop without messing with your internet router. Often, this requires a third party solution. With this hack, you can deploy a popular 3rd party solution in a simpler more reliable way.

I like using LocalTunel.com to share what I’m running on my laptop with coworkers who are working remotely or my friends back home in Paris. It is especially usefull when you are working with an API like Twilio which requires access to your app.

But there are drawbacks.

For example, I’ve noticed LocalTunnel.com is often unavailable – likely because it is so popular. More problematically, LocalTunnel doesn’t give you a static url to share. Instead, it generates a new url everytime you restart the tunnel. I found this to be especially frustrating.

I created a simple hack to overcome these obstacles on dotCloud’s platform. You can share your work for free in Sandbox mode.

Just Follow These 5 Steps:

1. Clone the tunnel-on-dotcloud repo to get the config files

git clone

cd tunnel-on-dotcloud

2. Create a dotCloud app 

dotcloud create webtunnel

3. Push on dotCloud

dotcloud push webtunnel

  • You will get a 502 error if you try to access the url at this point because you haven’t created the web tunnel yet.

4. Grab the info needed

dotcloud info webtunnel.proxy

Look for the ssh:// url in the ports section of proxy.0, from which you should grab:

  • The user (should be ‘dotcloud’), let’s call it $USER
  • The hostname (should be something like webtunnel-dotCloudUsername.dotcloud.com, which we’ll call $HOST
  • The port (the 4 digits number after the “:”) which we’ll named $PORT

5. Open the SSH tunnel on your computer

(don’t forget to replace $USER $PORT and $HOST)

If you don’t have any webserver running you can just fire up a simple one using the following: 

  • python -m SimpleHTTPServer

On the other hand if you have one be careful to replace the local port (8080 here) with the one your webserver is listing on.

  • ssh -i ~/.dotcloud/dotcloud.key -l $USER -p $PORT $HOST -R 8042:localhost:8080
If you are lazy like me just alias it in to your .bash_profile or .bashrc 
  • echo “alias webtunnel=’ssh -i ~/.dotcloud/dotcloud.key -l $USER -p $PORT $HOST -R 8042:localhost:8080′” >> ~/.bash_profile

That’s it! You should now be able to get the most out of LocalTunnel’s awesome tool by running it on dotCloud.

Sometimes popularity is a good measure of awesomeness (the internet, Journey, bacon — popular and awesome). Sometimes it is not (Jessica Simpson, Chlamydia, Internet Explorer — also popular; decidedly un-awesome).

With over 400 watchers on GitHub, we already knew ZeroRPC was popular, but at our may hackday many of us worked to ensure it falls squarely in the “unbelievably awesome” camp, too: from demos to middleware to external integrations, ZeroRPC featured in almost every project!

Hackday-may-2012

Here’s a sample of what we worked on:

ZeroRPC StatsD - Andrea Luzzardi

Tracking down which component is slowing down a big distributed system can be a huge headache, but fear not! Andrea has created yet another tool to help you mangle that big tangled mess. StatsD is a project by Etsy that makes it super simple to track statistics, like counters and timers. Andrea’s StatsD middleware for ZeroRPC lets you track requests and response times of ZeroRPC Services.

https://github.com/aluzzardi/zerorpc-statsd

ZeroRPC for Node.js – Yusuf Simonson

Python-in-node

You want some Python in your Node.js? No problem! Yusuf finished up the first version of a Node.js-based implementation of ZeroRPC that lets Python and Node.js play together like the best of friends.

https://github.com/dotcloud/zerorpc-node

Sentry on dotCloud – with support for ZeroRPC – Louis Opter

Email is a great tool for many things, but managing application errors is not one of them. When the good folks at Disqus got tired of a clogged inbox they built Sentry: a realtime event logging and aggregation platform. The client collects logs and exceptions which get passed to the server over the network where they are agreggated them by type and sorted by time, frequency, etc in it’s beautiful web interface.

Louis’ hackday project makes it incredibly easy to run a standalone Sentry server on dotCloud.

https://github.com/dotcloud/sentry-on-dotcloud

As an added bonus, Louis also added support for ZeroRPC into Raven, the official Sentry Python client:

https://github.com/dcramer/raven/blob/master/CHANGES#L14

This lets you log exceptions caught by ZeroRPC to Sentry. See the docs for an example:

http://raven.readthedocs.org/en/latest/config/zerorpc.html

Our next hackday will take place in the second half of June. If you have a cool idea, or would like to join in on the fun, tweet us @dot_cloud with your ideas.

Keeping It Fresh

There’s nothing worse for productivity than a project that drags on forever. Here at dotCloud, we normally break things up by working in two-week sprints, but for one day each month we dial up the pace even further.

Here’s how our Hack Days work: we show up early (yes, 9am is early for some of us!) and each team member pitches a project. For the next eight hours we fend off temptation (there’s music! food! beer! It is glorious.) as we race to finish by our 5pm demo deadline.

Dotcloud-hackday-keeps-it-fresh

Sound like fun? Luckily for you we’re hiring! Also, each month we invite a select few guests to join us. Tweet us at @dot_cloud with your next hack day idea, and we’ll let you know next time we have an opening!

Here are some of the projects we came up with this month:

Prototype of remote context manager for ZeroRPC (FX Bourlet)

One of the problems not solved by RESTful web services is when there needs to be state maintained across multiple request-response cycles for things like user sessions or transactions. FX has tried out a solution to this problem with our super-popular ZeroRPC.

His concept is to allow a client to open a context on a ZeroRPC server which can be used for multiple stateful operations. The system uses ZeroRPC’s native heart-beat system under the covers to make sure both client and server can take action if the logical link between them goes down. Our first real use-case is for a transactional system on top of ZeroRPC, but I’m sure you folks can come up with lots of other creative uses.

New dotCloud Help Page (Ken Cochrane)

Getting help from dotCloud is like picking ice cream at Baskin Robins: so many delicious flavours! But which to choose? I’m usually a sucker for mint chocolate chip, but sometimes even I find the options overwhelming.

Ken created a new help page for dotCloud.com that aggregates all of our support options in one place to help you figure out which is best when. You can use this early version to get direct support, check platform status and access our StackOverflow pages.

There are a few more changes that aren’t quite ready yet, but should be out the door soon, so stay tuned for more updates!

Heap.io (Yusuf Simonson)

Heap.io is a project that allows for real-time, bi-directional communication between server-side processes and web apps using new concepts inspired by generative communication. By providing dynamic message routing between many autonomous processes along with authentication and authorization, heap.io will provide a flexible platform for creating complex real-world webapps.

Watch for it to be open-sourced soon!

Neo4j on dotCloud (Christophe Boudet)

Neo4j is one of the most popular NoSQL graph databases. Thanks to Christophe, Neo4j 1.7 is supported in alpha on dotCloud. Go get ‘yer graph on!

ZDP: Browser Data Sync with ZeroRPC (Solomon Hykes)

ZDP is an extension to ZeroRPC for real-time data synchronization. The server uses ZeroRPC both to push data in real-time, and to expose arbitrary data manipulation methods to the client. This allows complex server-side validation, possibly coupled with authorization and authentication, making it possible to build real applications on ZDP, even when the client is not trusted.

Let us know what you think!