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:
- Dokkur account.
- SSH keys added to your account.
- Go 1.6+ installed locally.
- $GOPATH/bin has been added to your $PATH.
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
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:
- Open website, go to Personal apps (left menu bar)
- Click ⨁ button to open New App interface
- 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
- Go to Settings page, in Environmental variables section click on Edit button.
- Choose ADD NEW VARIABLE
- In the Name field write BUILDPACK_URL
- In the VALUE field put
- Save settings
Deploy your app
- Go to Settings page, copy the app git url from the Git URL section.
- Switch to Dokkur Toolbelt and execute this command:
git remote add dokkur git_urlInstead of git_url paste your app's git url.
- Push your app:
git push dokkur masterIf 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.