Go

This is an example of how to set up a Go application to deploy on Kinsta’s Application Hosting services from a GitHub repository.

Prerequisites

  • Kinsta’s quick start templates are stored and managed in GitHub; therefore, you need a GitHub account to access them.
  • You need to create a MyKinsta account to deploy the application.

Deploy a Go Application

  1. Log in to GitHub and create a new repository from this template (Use this template > Create a new repository): Kinsta – Hello World – Go.
  2. In MyKinsta, click Applications > Add application > select GitHub, click Connect git provider > Authorize, and log in to your GitHub account.
  3. Choose the Hello World – Go repository and a Data center location. Leave all other settings as default and click Continue on each step.
  4. On the Summary step, click Deploy now.

During deployment, Kinsta automatically detects the Start command for the web process and installs dependencies defined in your go.mod file. The app is available as soon as the deployment finishes, and the Kinsta Welcome page loads at your application’s URL.

Kinsta Welcome page after successful deployment of Go.
Kinsta Welcome page after successful deployment of Go.

Prefer to watch the video version?

Web Server Setup

Port

Kinsta automatically sets the PORT environment variable. You do not need to define it or hard-code it into the application. Use os.Getenv("PORT") in your code when referring to the server port.

Start Command

For this application, the Start command can be left blank. When you add the application, Kinsta automatically detects the required start command for the web process during the first deployment.

Was this article helpful?