This is a simple Go application that demonstrates how to deploy a web server to Clever Cloud.
This application serves a basic HTML page using Go's standard library net/http. It listens on 0.0.0.0:8080 and responds to GET / requests with a "Hello, World" message.
For a complete guide on deploying Go applications, see the Clever Cloud Go documentation.
| Route | Description |
|---|---|
GET / |
Returns a "Hello, World" HTML page |
- Go 1.26 - Standard library only, no external dependencies
- Go 1.22+
go run .The application will be accessible at http://localhost:8080.
You have two options to deploy your application on Clever Cloud: using the Web Console or using the Clever Tools CLI.
If you don't already have an account, go to the Clever Cloud console and follow the registration instructions.
- Log in to the Clever Cloud console
- Click on "Create" and select "An application"
- Choose "Go" as the runtime environment
- Configure your application settings (name, region, etc.)
Add the following environment variables in the Clever Cloud console:
| Variable | Value | Description |
|---|---|---|
CC_GO_BUILD_TOOL |
gomod |
Use Go Modules for building (reads go.mod) |
You can deploy your application using Git:
# Add Clever Cloud as a remote repository
git remote add clever git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/app_<your-app-id>.git
# Push your code to deploy
git push clever masterInstall the Clever Tools CLI following the official documentation:
# Using npm
npm install -g clever-tools
# Or using Homebrew (macOS)
brew install clever-toolsclever login# Initialize the current directory as a Clever Cloud application
clever create --type go <YOUR_APP_NAME>
# Set the required environment variables
clever env set CC_GO_BUILD_TOOL gomodclever deployOnce deployed, you can access your application at the provided domain.
Once deployed, you can monitor your application through:
- Web Console: The Clever Cloud console provides logs, metrics, and other tools to help you manage your application.
- CLI: Use
clever logsto view application logs andclever statusto check the status of your application.
Clever Cloud supports three build methods, configured via the CC_GO_BUILD_TOOL environment variable:
| Build tool | Description |
|---|---|
gomod |
For projects using Go Modules (recommended). Reads the module name from go.mod and runs go install. |
gobuild |
For projects without Go Modules. Uses go install in a classic GOPATH hierarchy. |
makefile |
For custom build steps. Requires CC_GO_BINARY to point to the compiled binary. |
| Variable | Description |
|---|---|
CC_GO_BUILD_TOOL |
Build method: gomod, gobuild, or makefile |
CC_GO_PKG |
Override the package path passed to go install |
CC_GO_BINARY |
Path to the compiled binary (required for makefile builds) |
CC_RUN_COMMAND |
Override the default binary execution with a custom command |
CC_TROUBLESHOOT |
Set to true to enable verbose output and the race detector |