Deployment Go in Awanio

Before deploying a Go-based application, there are several things that you must prepare, namely:

  • Awanio account
  • ssh public key that has been registered on the Awanio dashboard page
  • git url endpoint to be used for push code. The format is
  • awan.yml file that is placed in the top application folder

Here is an example of the contents of the awan.yml file that you must fill in to run the application runtime using Go:

version: '1.0'

  type: golang
  version: 1.12
  run: go run main.go

In addition to the 1.12 version Awanio also supports Go versions 1.10, 1.11 and 1.13. Please enter the version in the version directive in the awan.yml file.

Awanio by default uses gomod as the package manager. For this you must prepare the go.mod file and the go.sum file in the project directory, both of which must be committed.

If the project has just been created for the first time, then run the command:

go mod init

Make sure the is adjusted to the git repository where the project is stored.

Next, create a main.go file that will become a bootstrap to run the application. Here is an example:

package main

import "os"
import ""

func main() {

 r := gin.Default()

 r.GET("/", func(c *gin.Context) {
  c.String(200, "Hello World")

  port := ":8080"
  if s := os.Getenv("PORT"); s != "" {
    port = ":" + s

The application must be ensured to be able to use ports whose values ​​are taken from the PORT environment variable.

After that, run the following command to download the required packages:

go mod tidy

Please compile and run the application in local development then check the browser.

PORT=8081 go run main.go

Then open a browser with the address http://localhost:8081

As an alternative, you can also use dep as a pacakge manager. For this you must add the package_manager property in the awan.yml file with the value dep. Here is an example of a awan.yml file that can be used:

version: '1.0'

  type: golang
  version: 1.10
  package_manager: dep
  run: go run main.go

Make sure you include the Gopkg.toml and Gopkg.lock files in the commit. Both of these files are needed to see what packages are needed during the deployment process.

After the application is ready, add git remote to the project:

git remote add awan

Finally, please commit and push to the git server to Awanio

git push awan master

After the deployment is complete, please check your application at