Skip to content

About

A Go app example

Topics

Resources

Stars

0 stars

Watchers

5 watching

Forks

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Example on Clever Cloud

Clever Cloud - PaaS

This is a simple Go application that demonstrates how to deploy a web server to Clever Cloud.

About the Application

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.

Routes

Route Description
GET / Returns a "Hello, World" HTML page

Technology Stack

  • Go 1.26 - Standard library only, no external dependencies

Prerequisites

  • Go 1.22+

Running the Application Locally

go run .

The application will be accessible at http://localhost:8080.

Deploying on Clever Cloud

You have two options to deploy your application on Clever Cloud: using the Web Console or using the Clever Tools CLI.

Option 1: Deploy using the Web Console

1. Create an account on Clever Cloud

If you don't already have an account, go to the Clever Cloud console and follow the registration instructions.

2. Set up your application on Clever Cloud

  1. Log in to the Clever Cloud console
  2. Click on "Create" and select "An application"
  3. Choose "Go" as the runtime environment
  4. Configure your application settings (name, region, etc.)

3. Configure Environment Variables

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)

4. Deploy Your Application

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 master

Option 2: Deploy using Clever Tools CLI

1. Install Clever Tools

Install the Clever Tools CLI following the official documentation:

# Using npm
npm install -g clever-tools

# Or using Homebrew (macOS)
brew install clever-tools

2. Log in to your Clever Cloud account

clever login

3. Create a new application

# 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 gomod

4. Deploy your application

clever deploy

5. Open your application in a browser

Once deployed, you can access your application at the provided domain.

Monitoring Your Application

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 logs to view application logs and clever status to check the status of your application.

Go Deployment Configuration Reference

Build Tools

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.

Environment Variables

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

Additional Resources

About

A Go app example

Topics

Resources

Stars

0 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages