Go Hosting Options // Gopher Golang

Go Gopher Programming LanguageMuch of the following is from Ukiah Smith. I reviewed and updated the information and links.

Hosting Go web applications and APIs are a bit different than hosting PHP applications. Where a PHP file can be uploaded to a server, anywhere in the web root, and it will be interpreted and executed by the web server. Go is different. A Go application normally is a long-running process, waiting for connections when it’s not processing requests. The apps need to listen on port 80 or alternatively use a proxy to a front-end server.

Because Go applications need permission to listen on port 80, they don’t work well on a shared host. There are hosting solutions though, they range in scope and size from VPS providers, platform providers, and specialized platforms. Each offering a variety of features and options to fit any need.

VPS Hosting

The VPS (Virtual Private Server) is a fully self-managed server virtualized on the host provider’s server. These are classified as IaaS (Infrastructure as a Service), the lowest level in the cloud services hierarchy. IaaS offers full control over the whole software stack. In effect, it is a full Linux server, root and all. With this freedom and control comes the responsibility of managing it. Linode does offer a managed service as an add-on.

I have several websites on my VPS running on Apache. Because I wanted to keep my existing sites I set up my Go web applications to proxy back to Apache, the apps then listen on localhost for incoming connections. This allows my existing sites and Go apps to live together in harmony.

The power of having a VPS is your ability to customize your install any way you like. Using Docker, lightweight Linux containers, you can containerize your Go app. The Docker container can be used locally for development and deployed to live. Because the container is self-contained deployment is simplified. Docker is flexible enough that you can continue to use Apache/Nginx as a front-end proxy to the application.


Heroku is a PaaS (Platform-as-a-Service) provider that supports Go through a third-party build pack. These build packs are a shim layer that adds language support to the core PaaS server. Heroku supports a few of their own build packs but allows for third-parties to create their own to extend the usefulness of their service.

Heroku is a PaaS, which means you don’t have as much control over the lower layers of the server as you would with a VPS. Instead, you use the Heroku command-line program to interact with the server and git to deploy. This offers control of your application without the hassle of having to fully manage a server.

Google App Engine

App Engine is Google’s cloud PaaS. It sits somewhere between Heroku’s service and fully managed SaaS apps. It allows you to create customized applications and run them on App Engine without being concerned with the database, operating system and software upgrades, security, and uptime. Like Heroku it allows you to focus on your app and Google takes care of the rest, but it also takes care of the datastore.

The good news is that App Engine supports Go as a first-class language. The drawback is that Go apps written for App Engine use their API, which makes them difficult to move to another hosting solution should the need arise.

All the choices

There are several options for hosting Go. Each type has benefits and drawbacks; which really depends on your personal needs. Those of you who want more control will go with a VPS provider like Linode. Where those of you who only care about the application you are creating will choose Heroku or App Engine. With so many options the price will be reasonable and features competitive enough that you should find a good solution.

Thanks to Brian Ketelsen (@bketelsen) for looking over this post.

Edit: Other options I didn’t know about

Source: Ukiah Smith


Visit sunny St. George, Utah, USA