Go
Learn how to deploy a Go web application to Valyent
Introduction
Go is a statically typed, compiled programming language designed at Google. It provides excellent support for building high-performance web applications with its robust standard library and built-in concurrency features.
Prerequisites
- a UNIX-like system (see WSL if you are using Windows), in order to use the Valyent CLI
- a Valyent account, with a registered payment method (you can sign up here)
- Go installed on your machine (version 1.21 or later)
Installing the CLI
You can inspect the installation script here and the GitHub repository.
Authenticating
Initializing the project
First, let’s create a new directory for our project and initialize it as a Go module:
Create the main application file:
In the main.go
file, add the following code:
Now, initialize the valyent.toml
configuration file:
This command will guide you through selecting or creating a project and an associated application.
Adding the Dockerfile
Create a Dockerfile for the application:
Add the following content to the Dockerfile:
Deploy the project
To expose the application’s port, we need to set up a gateway (in this case, the port 8080):
Deploy your application to Valyent:
Then, you can type the following: