Linux application runtime

Overview

Clever Cloud platform provides a multi-runtime environment, including many tools to deploy and run your applications. The Linux runtime is a versatile solution to build and deploy any kind of application. The Mise package manager helps you to install and manage any supported dependencies Clever Cloud doesn’t provide by default such as Dart, Gleam, Zig for example.

Linux is a new runtime

Help us to improve it by reporting any issue or suggestion on the Clever Cloud Community

Create your Linux application

To create a new Linux application, use the Clever Cloud Console or Clever Tools:

clever create --type linux

Configure your Linux application

Mandatory needs

Linux runtime requires a run command (through CC_RUN_COMMAND, a Mise run task, or a Makefile run: target) and a working web application listening on 0.0.0.0:8080.

Build and run commands

Build and run commands are resolved in this priority order:

  1. CC_BUILD_COMMAND and CC_RUN_COMMAND environment variables
  2. Mise build and run tasks (from mise.toml or File Tasks)
  3. Makefile build: and run: targets (searches GNUmakefile, Makefile, makefile or the file defined in CC_MAKEFILE)

Each level fills in only the commands not already defined by a higher priority source. For example, you can define CC_BUILD_COMMAND and let Mise or a Makefile provide the run command.

Clever Task and Multi-runtime approach

Linux runtime is perfect fit to run on-demand workloads on Clever Cloud: configure an application as Tasks from the Information panel in the Console or with Clever Tools:

clever create --type linux --task "your-task-command --and arguments"
clever deploy # or clever restart if there is no code change

Expand your toolbox with Mise package manager

Install tools with Mise package manager

Mise is available on all Clever Cloud runtimes to install and manage tools and dependencies. Add a mise.toml file at the root of your project and all defined tools are installed at the specified version before the build phase. To place this file in a subdirectory, set the CC_MISE_FILE_PATH environment variable to its relative path (e.g. config/mise.toml). You can also use Mise to define environment variables and tasks in a declarative way.

To disable Mise tool installation, set CC_DISABLE_MISE environment variable to true.

Mise configuration examples

Enable health check during deployment

The healthcheck allows you to limit downtimes. Indeed, you can provide Clever Cloud with paths to check. If these paths return something other than 200, the deployment will fail.

Add one (or several) environment variable as such:

CC_HEALTH_CHECK_PATH=/my/awesome/path

Or

CC_HEALTH_CHECK_PATH_0=/my/awesome/path
CC_HEALTH_CHECK_PATH_1=/my/other/path

The deployment process checks all paths. All of them must reply with a 200 OK response code.

By default, when no environment variable (for ex: APP_HOME) is defined, the monitoring checks your repository root path /.

Example

Using the path listed above, below are the expected logs:

Response from GET /my/awesome/path is 200
Response from GET /my/other/path is 500
Health check failed:
- GET /my/other/path returned 500.
If the deployment fails after this message, please update your configuration and redeploy.

In this example, the first path is OK, but the second one failed. This gives you a hint on what failed in your application.

Best practice for healthcheck endpoints

To make the most of a healthcheck endpoint, have it check your critical dependencies. For example:

  • execute SELECT 1 + 1; on your database
  • retrieve a specific Cellar file
  • ping a specific IP through a VPN

Request Flow: Varnish, Redirection.io, custom proxy

Request Flow automatically chains reverse proxies between port 8080 (public) and your application, managing port allocation with no manual configuration. Supported services are activated by their presence in your project:

  • Varnish: add a clevercloud/varnish.vcl file or set CC_VARNISH_FILE
  • Redirection.io: set CC_REDIRECTIONIO_PROJECT_KEY

Both can be active simultaneously. To control the order, set CC_REQUEST_FLOW (e.g. redirectionio,varnish). To add a custom middleware, include custom in the chain and define CC_REQUEST_FLOW_CUSTOM with @@LISTEN_PORT@@ and @@FORWARD_PORT@@ placeholders. To block public access, set CC_REQUEST_FLOW=block.

When at least one middleware is active, your application must listen on port 9000 instead of 8080.

Last updated on

Did this documentation help you ?