Introduction

This tutorial will show you how to deploy your Go app in several minutes. These instructions will also give you enough information to make the most out of Dokkur.

Be sure that you already have:

  1. Dokkur account.
  2. SSH keys added to your account.
  3. Go 1.6+ installed locally.
  4. $GOPATH/bin has been added to your $PATH.

Set up

In this step you will install the Dokkur Toolbelt that gives you you access to the Dokkur Command Line Interface (CLI).

After installation you can use dokkur login command to log in with your email and password you set when creating Dokkur account.

Prepare the app

To deploy an app you need to have the app prepared for deployment.

If you don’t have your own Go project, you can use a template that we have already prepared for you.

Execute the following commands to fetch the application locally, compile and install the generated executables in $GOPATH/bin.

$ go get github.com/dokkur/go-getting-started

You now have a functioning git repository that contains a simple application.

The rest of the tutorial assumes all commands are run from the root directory of the application which is located inside of your $$GOPATH, so do the following:

$ cd $GOPATH/src/github.com/dokkur/go-getting-started

If you have a Go app that you want to deploy, you need to do some preparations.

Declare app dependencies

How does Dokkur recognize an app as a Go app? The answer is by the existence of a Godeps.json file in the Godeps directory located in your application’s root directory.

It may look something like this:

$ cat Godeps/Godeps.json
{
"ImportPath": "github.com/heroku/go-getting-started",
"GoVersion": "go1.6",
"GodepVersion": "v74",
"Deps": [
{
"ImportPath": "github.com/gin-gonic/gin",
"Comment": "v1.0rc1-110-g4cc2de6",
"Rev": "4cc2de6207f4128624cbdd16be30f64966c67c08"
},
...
]
}

The Godeps/Godeps.json file is used by Godep and specifies both the dependencies that are vendored with your application and the version of Go that should be used to compile the application. This Go app has a few dependencies, primarily on Gin, a HTTP web framework.

When an app is deployed, Dokkur reads this file, installs the appropriate Go version and compiles your code using go install ..

Create a new app

Follow these steps:

  1. Open website, go to Personal apps (left menu bar)
  2. Click ⨁ button to open New App interface
  3. Enter the app’s name (Caution! Use latin lowercase and numbers, e.g. myapp007), choose available and convenient instances for hosting, pick Custom App template and press Create App button.

Congrats! Your app has easily been created. Now you need to deploy it. Just do it!

Add BUILDPACK_URL config var

  1. Go to Settings page, in Environmental variables section click on Edit button.
  2. Choose ADD NEW VARIABLE
  3. In the Name field write BUILDPACK_URL
  4. In the VALUE field put
    https://github.com/dokkur/buildpack-go
  5. Save settings

Deploy your app

  1. Go to Settings page, copy the app git url from the Git URL section.
  2. Switch to Dokkur Toolbelt and execute this command:

    git remote add dokkur git_url
    Instead of git_url paste your app's git url.

  3. Push your app:
    git push dokkur master
    If you want to deploy another branch, run:
    git push dokkur yourbranch:master

Hell yeah! Your app is deployed! Open yourappname.dokkurapp.com in your browser.