Deploy Golang projects from GitLab, GitHub or BitBucket repository.

In addition to deployment via Git, NodeChef also supports deploying Golang projects by uploading from the dashboard or using the NodeChef CLI. See the menu on your left hand side on how to deploy by uploading your project folder from the dashboard.

NodeChef cloud supports deploying your Golang projects together with a MongoDB, MySQL or PostgreSQL database if required with a few clicks. We automatically build your project and run it in Docker containers on bare metal servers for the best performance.

More details on NodeChef Golang cloud hosting and what features are supported.

We support integrations with GitLab, GitHub or BitBucket making it easy to deploy code living in your repository to your app containers running on NodeChef.

To deploy, follow the below three steps and your Golang app will be up and running in the cloud in no time. After deployment, you can proceed to add your custom domain.

Notes on Golang projects.

NodeChef automatically detects your project as Golang if you do not explicitly specify if one of the below conditions is met.

  • Your project has been packaged with godep using godep save.
  • Your project has a vendor/ directory and has any files ending with .go.
  • You have set the GOPACKAGENAME environment variable and your project has any files ending with .go. Note, if you are not using any vendering tool, you must set the environment variable GOPACKAGENAME for the deployment to work.
  • Your project has a glide.yml file in the root folder.
  • Your project has a Gopkg.toml file in the root folder.
  • Your project has a go.mod file in the root folder and you are using the go mod init vendering tool.

Click here to see supported go versions

Start command.

Because Golang apps compile to a single file native binary, by default your project will be started with the build output as the command. You can override this behaviour by using a Procfile created in the root directory of your project. See example Procfile:

web: unicorn-go-backend

When Your Main Package is Not in the Project Root

A common project pattern is to place main packages in a subdirectory called cmd like in the example below:

app-package-name ├── cmd │ ├── cli │ │ └── main.go │ └── server │ └── main.go ├── go.mod ├── go.sum ├── shared.go ├── shared_test.go └── manifest.yml

In this case, you must set the environment variable GO_INSTALL_PACKAGE_SPEC. For example, if the module name for the project is github.com/superd/app-package-name, the value of the environment variable will be github.com/superd/app-package-name/cmd/server.