### Install and Start oTree Project
Source: https://www.clever-cloud.com/developers/guides/otree/index.html
Installs the oTree framework using pip, pipx, or uv, and starts a new oTree project named 'oTreeExample'. This is the initial step to begin developing with oTree.
```Bash
pip install otree
otree startproject oTreeExample
# You can also use pipx
pipx otree startproject oTreeExample
# Or uv
uvx otree startproject oTreeExample
```
--------------------------------
### Install Dependencies and Run Application
Source: https://www.clever-cloud.com/developers/guides/ruby-rack-app-tutorial/index.html
Commands to install application dependencies using Bundler and start the Rack application locally using rackup.
```shell
$ bundle install
$ bundle exec rackup
```
--------------------------------
### Create MkDocs Static Site
Source: https://www.clever-cloud.com/developers/guides/mkdocs/index.html
Installs the MkDocs tool and initializes a new static site project. Ensure Python and pip are installed on your system.
```bash
pip install mkdocs
mkdocs new myStaticApp
```
--------------------------------
### Install Clever Tools on Linux (.tar.gz)
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Installs the Clever Cloud CLI on generic GNU/Linux distributions by downloading a `.tar.gz` archive. The binary is extracted and copied to a directory in the user's PATH, typically `~/.local/bin/`. Requires `curl` and `tar`.
```shell
curl -O https://clever-tools.clever-cloud.com/releases/latest/clever-tools-latest_linux.tar.gz
tar xvzf clever-tools-latest_linux.tar.gz
cp clever-tools-latest_linux/clever ~/.local/bin/
```
--------------------------------
### Clever Tools CLI Installation and Login
Source: https://www.clever-cloud.com/developers/doc/best-practices/tips_and_tricks/index.html
Instructions for installing the Clever Cloud Command Line Interface (CLI) globally using npm and logging into your Clever Cloud account to begin using its features.
```bash
npm i -g clever-tools
```
```bash
clever login
```
--------------------------------
### Download and Extract Binary (Windows)
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Installs the clever-tools CLI on Windows by downloading a ZIP archive, extracting it, and adding its directory to the system's PATH environment variable.
```PowerShell
Invoke-WebRequest https://clever-tools.clever-cloud.com/releases/latest/clever-tools-latest_win.zip -OutFile clever-tools-latest_win.zip
Expand-Archive .\clever-tools-latest_win.zip -DestinationPath .
$env:PATH += ";$(Resolve-Path .\clever-tools-latest_win\)"
```
--------------------------------
### .NET Project File with Dependencies
Source: https://www.clever-cloud.com/developers/doc/applications/dotnet/index.html
An example snippet from a .NET project file (.csproj) showing how to list project dependencies using the PackageReference element. Ensure all necessary libraries are listed here.
```xml
…
```
--------------------------------
### Configure package.json with build/run hooks
Source: https://www.clever-cloud.com/developers/doc/applications/nodejs/index.html
Demonstrates using npm scripts for build and run phase customization. Scripts like 'preinstall', 'postinstall', 'prestart', and 'start' can be defined to execute custom commands.
```json
{
"name" : "myApp",
"version" : "0.1.0",
"scripts" : {
"preinstall": "./download.sh", // during build phase, before dependencies installation
"postinstall": "./cleanup.sh", // during build phase, after dependencies installation
"prestart": "./prepare.sh", // during run phase, before the start command
"start" : "node myApp.js"
}
}
```
--------------------------------
### Jenkinsfile Example for CI/CD
Source: https://www.clever-cloud.com/developers/doc/addons/jenkins/index.html
A comprehensive Jenkinsfile example defining a CI/CD pipeline. It includes environment variable setup using credentials, build discarder options, parallel build stages for publishing to different platforms (Cellar, npm), and artifact archiving. This file should be placed at the root of your project.
```groovy
pipeline {
agent { label 'cc-ci-agent' }
environment {
GIT_TAG_NAME = gitTagName()
S3_KEY_ID = credentials('CELLAR_CC_TOOLS_ACCESS_KEY_ID')
S3_SECRET_KEY = credentials('CELLAR_CC_TOOLS_SECRET_ACCESS_KEY')
BINTRAY_API_KEY = credentials('BINTRAY_CC_TOOLS_API_KEY')
NPM_TOKEN = credentials('NPM_TOKEN')
}
options {
buildDiscarder(logRotator(daysToKeepStr: '5', numToKeepStr: '10', artifactDaysToKeepStr: '5', artifactNumToKeepStr: '10'))
}
stages {
stage('build') {
steps {
sh 'npm ci'
sh 'node scripts/job-build.js'
}
}
stage('publish') {
when {
not {
environment name: 'GIT_TAG_NAME', value: ''
}
beforeAgent true
}
parallel {
stage('cellar') {
steps {
sh 'node scripts/job-publish-cellar.js'
}
}
stage('npm') {
steps {
sh 'node ./scripts/job-publish-npm.js'
}
}
}
}
}
post {
always {
archiveArtifacts artifacts: 'releases/**/*', fingerprint: true, onlyIfSuccessful: true
}
}
}
@NonCPS
String gitTagName() {
return sh(script: 'git describe --tags --exact-match $(git rev-parse HEAD) || true', returnStdout: true)?.trim()
}
```
--------------------------------
### Install Clever Tools on Debian/Ubuntu (.deb)
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Installs the Clever Cloud CLI on Debian/Ubuntu-based Linux distributions using `.deb` packages. This involves adding the GPG key for the repository and then configuring the APT sources before installing. Requires `curl`, `gpg`, `tee`, and `apt`.
```shell
curl -fsSL https://clever-tools.clever-cloud.com/gpg/cc-nexus-deb.public.gpg.key | gpg --dearmor -o /usr/share/keyrings/cc-nexus-deb.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/cc-nexus-deb.gpg] https://nexus.clever-cloud.com/repository/deb stable main" | tee -a /etc/apt/sources.list
apt update
apt install clever-tools
```
--------------------------------
### Configure package.json with scripts.start
Source: https://www.clever-cloud.com/developers/doc/applications/nodejs/index.html
A package.json structure defining the application's start command via the 'scripts.start' field. This is an alternative to the 'main' field for specifying the entry point.
```json
{
"name" : "myApp",
"version" : "0.1.0",
"scripts" : {
"start" : "node myApp.js"
}
}
```
--------------------------------
### Initialize mdBook Project
Source: https://www.clever-cloud.com/developers/guides/mdbook/index.html
Creates a new mdBook project with specified title and ignores Git initialization. Requires Git and Rust to be installed.
```bash
cargo install mdbook
mdbook init myStaticApp --title="my mdBook" --ignore=git
```
--------------------------------
### Install Clever Tools on macOS (.tar.gz)
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Installs the Clever Cloud CLI on macOS without Homebrew by downloading a `.tar.gz` archive. The binary is extracted and copied to a directory in the user's PATH, typically `~/.local/bin/`. Requires `curl` and `tar`.
```shell
curl -O https://clever-tools.clever-cloud.com/releases/latest/clever-tools-latest_macos.tar.gz
tar xvzf clever-tools-latest_macos.tar.gz
cp clever-tools-latest_macos/clever ~/.local/bin/
```
--------------------------------
### Clone Zooper Nuxt Static Example
Source: https://www.clever-cloud.com/developers/guides/nuxt/index.html
Demonstrates how to clone the Zooper example project for Nuxt static generation using Git. This requires Git and Node.js to be installed on your system.
```bash
git clone https://github.com/fayazara/zooper myStaticApp
```
--------------------------------
### Clone Hugo Theme Repository
Source: https://www.clever-cloud.com/developers/guides/hugo/index.html
Clones the 'hugo-theme-mini' repository from GitHub to initialize a new static application project. This step requires Git to be installed.
```bash
git clone https://github.com/nodejh/hugo-theme-mini myStaticApp
```
--------------------------------
### Copy Clever-Tools in Dockerfile
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Demonstrates how to copy the clever-tools binary from the official Docker image into your own Docker image's filesystem, making it available for your application.
```Dockerfile
COPY --from=clevercloud/clever-tools /bin/clever /usr/local/bin/clever
```
--------------------------------
### Docker Image Usage
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Provides commands to pull the official clever-tools Docker image and run it to execute CLI commands. This is useful for environments where direct installation is not preferred.
```Docker
docker pull clevercloud/clever-tools
docker run --rm clever-tools
```
--------------------------------
### NuGet Configuration for Private Dependencies
Source: https://www.clever-cloud.com/developers/doc/applications/dotnet/index.html
Example XML configuration for nuget.config to manage private NuGet package sources and credentials. This file should be placed in the root of your project.
```xml
```
--------------------------------
### Slack Deployment Results Webhook Setup
Source: https://www.clever-cloud.com/developers/doc/account/notifications/index.html
Provides a step-by-step guide for integrating Clever Cloud notifications with Slack using Incoming WebHooks. This includes configuring Slack and then setting up the webhook in Clever Cloud.
```APIDOC
Slack Integration for Deployment Results:
1. Slack Configuration:
- Go to the Slack custom integrations page (e.g., https://slack.com/apps/manage/custom-integrations).
- Select 'Incoming WebHooks'.
- Click 'Add Configuration'.
- Choose the target channel for notifications.
- Copy the generated Webhook URL (starts with 'https://hooks.slack.com/services/').
2. Clever Cloud Webhook Configuration:
- In Clever Cloud's 'Notifications' panel, click 'Webhooks'.
- Add a new webhook.
- Paste the copied Slack Webhook URL into the 'Webhook URL' field.
- Under 'Only send notification for these events', select 'Result of deployments (success/fail)'.
Outcome: Deployment results will now appear in the specified Slack channel.
```
--------------------------------
### Rust Iron Hello World Server
Source: https://www.clever-cloud.com/developers/doc/applications/rust/index.html
A minimal Rust web server example using the Iron framework. It sets up a handler for incoming requests and starts listening on the specified host and port (0.0.0.0:8080).
```rust
extern crate iron;
use iron::prelude::*;
use iron::status;
fn main() {
fn hello_world(_: &mut Request) -> IronResult {
Ok(Response::with((status::Ok, "Hello World!")))
}
let _server = Iron::new(hello_world).http("0.0.0.0:8080").unwrap();
println!("On 8080");
}
```
--------------------------------
### SSH Key Generation Example Output
Source: https://www.clever-cloud.com/developers/doc/account/ssh-keys-management/index.html
Illustrates the expected output after successfully generating an SSH key pair, showing the saved file paths for the private and public keys, and the key fingerprint.
```shell
Generating public/private ed25519 key pair.
Enter file in which to save the key (/your_home_path/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
Your identification has been saved in /your_home_path/.ssh/id_ed25519.
Your public key has been saved in /your_home_path/.ssh/id_ed25519.pub.
The key fingerprint is:
01:0e:e5:2d:ab:98:d6:17:a1:6d:f0:68:9f:d0:a2:db your_email@youremail.com
```
--------------------------------
### Elastic APM Agent Integration Examples
Source: https://www.clever-cloud.com/developers/doc/addons/elastic/index.html
To utilize Elastic APM, an APM agent must be installed in your application. This often involves adding a dependency or configuration file. Examples for various languages are available in a public repository, and specific framework integrations (like Rails) have dedicated setup guides.
```APIDOC
APM Agent Integration:
Purpose: Integrate Elastic APM agents into your application to send performance data to the APM server.
Requirements: Install an APM agent specific to your application's language.
Configuration:
- Add agent as a dependency or include a configuration file.
- Refer to language-specific documentation for setup details.
- Examples available at: https://github.com/CleverCloud/Elastic-APM-example-configuration-files
Supported Languages & Agent Versions:
- Go: https://www.elastic.co/guide/en/apm/agent/go/1.x/introduction.html
- Java: https://www.elastic.co/guide/en/apm/agent/java/1.x/intro.html
- Node.js: https://www.elastic.co/guide/en/apm/agent/nodejs/2.x/intro.html
- PHP: https://www.elastic.co/guide/en/apm/agent/php/current/index.html
- Python: https://www.elastic.co/guide/en/apm/agent/python/5.x/getting-started.html
- Ruby: https://www.elastic.co/guide/en/apm/agent/ruby/3.x/introduction.html
Framework-Specific Setup:
- Rails: https://www.elastic.co/guide/en/apm/agent/ruby/3.x/getting-started-rails.html#getting-started-rails
```
--------------------------------
### Git Deployment Commands
Source: https://www.clever-cloud.com/developers/doc/quickstart/index.html
Steps to initialize a local Git repository, add files, commit changes, and push to a Clever Cloud deployment URL. Includes commands for setting up the remote and pushing the application.
```bash
git init
git add .
git commit -m "first commit"
```
```bash
git remote add
```
```bash
git push :master
```
--------------------------------
### Makefile Example for Go Build
Source: https://www.clever-cloud.com/developers/doc/applications/golang/index.html
An example Makefile demonstrating how to build a Go application, specifying the output binary path. It includes comments on using specific Go versions.
```makefile
BINARY=bin/myApp
build:
# To install a specific Go version, you can add:
# go install golang.org/dl/gox.xx.x@latest
# ${HOME}/go_home/bin/gox.xx.x download
# Then use `${HOME}/go_home/bin/gox.xx.x` instead of `go`
echo "Build the application as ./${BINARY}"
go build -o ${BINARY} main.go
```
--------------------------------
### Specify Node.js dependencies in package.json
Source: https://www.clever-cloud.com/developers/doc/applications/nodejs/index.html
An example of how to declare application dependencies, such as 'express' and 'socket.io', within the 'dependencies' field of package.json. This ensures necessary modules are installed during the build process.
```json
{
"name" : { ... },
"engines": { ... },
"dependencies": {
"express": "5.x",
"socket.io": "4.8.x",
"underscore": "1.13.7"
}
}
```
--------------------------------
### Configure manage.py tasks with CC_PYTHON_MANAGE_TASKS (Bash)
Source: https://www.clever-cloud.com/developers/guides/python-django-sample/index.html
This environment variable allows you to specify management tasks for your Django application to run automatically after dependency installation and before the web server starts. Tasks are separated by commas. For example, 'migrate' or 'assets:precompile'.
```bash
CC_PYTHON_MANAGE_TASKS="migrate, assets:precompile"
```
--------------------------------
### Clever Cloud Deployment Process
Source: https://www.clever-cloud.com/developers/doc/quickstart/index.html
Explains the workflow when code is pushed to Clever Cloud via Git or FTP. The platform processes the code, checks requirements, and launches the deployment.
```APIDOC
Deployment Workflow:
1. Push application code via Git or FTP.
2. Platform receives code and checks resource requirements.
3. If requirements are met, deployment is launched.
4. Upon successful completion, the application is live.
5. Application logs are retrieved and displayed in the Clever Cloud console.
```
--------------------------------
### Install Clever Tools on Exherbo
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Installs the Clever Cloud CLI on the Exherbo Linux distribution. This method uses the `cave` command to resolve and install the `clever-tools-bin` package.
```shell
cave resolve repository/CleverCloud -zx1
cave resolve clever-tools-bin -zx
```
--------------------------------
### Materia KV Connection Example
Source: https://www.clever-cloud.com/developers/doc/addons/materia-kv/index.html
An example output showing the successful creation of a Materia KV add-on and how to connect to it using redis-cli after sourcing environment variables.
```bash
$ clever addon create kv testKV
Add-on created successfully!
ID: addon_4997cfe3-f104-4d05-9fe4-xxxxxxxxx
Real ID: kv_01HV6NCSRDxxxxxxxxxxxxxxxx
Name: testKV
/!\ The Materia KV provider is in Alpha testing phase, don't store sensitive or production grade data
You can easily use Materia KV with 'redis-cli', with such commands:
source <(clever addon env addon_4997cfe3-f104-xxxx-xxxx-xxxxxxxxx -F shell)
redis-cli -h $KV_HOST -p $KV_PORT --tls
```
--------------------------------
### Install Clever Tools on macOS via Homebrew
Source: https://www.clever-cloud.com/developers/doc/reference/cli/index.html
Guide for installing Clever Tools on macOS using the Homebrew package manager. This is the recommended method for macOS users with Homebrew installed.
```shell
brew install CleverCloud/homebrew-tap/clever-tools
```
--------------------------------
### Clever Cloud Supported Platforms
Source: https://www.clever-cloud.com/developers/doc/quickstart/index.html
Lists the various programming languages, frameworks, and technologies supported by Clever Cloud for application deployment.
```APIDOC
Supported Platforms:
- .Net
- Docker
- Elixir
- Franken PHP
- Go
- Haskell
- Java (Gradle, Jar, Maven, War/Ear)
- Linux
- Meteor.js
- Node.js & Bun
- PHP with Apache
- Python with uv support
- Ruby
- Rust
- Scala
- Static
- Static with Apache
- V (Vlang)
```
--------------------------------
### Install Clever Tools on macOS (Homebrew)
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Installs the Clever Cloud CLI on macOS using the Homebrew package manager. This is a straightforward command that adds the Clever Cloud tap and installs the `clever-tools` package.
```shell
brew install CleverCloud/homebrew-tap/clever-tools
```
--------------------------------
### Install Clever Tools on CentOS/Fedora (.rpm)
Source: https://www.clever-cloud.com/developers/doc/reference/cli/index.html
Guide for installing Clever Tools on RPM-based Linux distributions like CentOS and Fedora. It involves adding the Clever Cloud repository and then installing the package using yum.
```shell
curl -s https://clever-tools.clever-cloud.com/repos/cc-nexus-rpm.repo > /etc/yum.repos.d/cc-nexus-rpm.repo
yum update
yum install clever-tools
```
--------------------------------
### Clone Astrowind Example Project
Source: https://www.clever-cloud.com/developers/guides/astro/index.html
Demonstrates how to clone the Astrowind example project using Git, a prerequisite for deploying an Astro site on Clever Cloud.
```bash
git clone https://github.com/onwidget/astrowind myStaticApp
```
--------------------------------
### Install Clever Tools on Windows (Winget)
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Installs the Clever Cloud CLI on Windows using the Windows Package Manager (winget). This is a simple command executed in a terminal.
```powershell
winget install CleverTools
```
--------------------------------
### PostgreSQL Command Line Example
Source: https://www.clever-cloud.com/developers/doc/addons/postgresql/index.html
An example of using the `psql` command-line tool to connect to a PostgreSQL database and potentially import data.
```bash
psql -h -p -U -d <
```
--------------------------------
### Install Clever Tools on CentOS/Fedora (.rpm)
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Installs the Clever Cloud CLI on RPM-based Linux distributions like CentOS and Fedora. It adds the Clever Cloud repository configuration and then uses `yum` (or `dnf`) to install the package. Requires `curl`.
```shell
curl -s https://clever-tools.clever-cloud.com/repos/cc-nexus-rpm.repo > /etc/yum.repos.d/cc-nexus-rpm.repo
yum update
yum install clever-tools
```
--------------------------------
### Install Clever Tools on Arch Linux (AUR)
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Installs the Clever Cloud CLI on Arch Linux using the Arch User Repository (AUR). This method requires Git and the `makepkg` utility. It clones the AUR package, builds it, and installs it.
```shell
git clone https://aur.archlinux.org/clever-tools-bin.git clever-tools
cd clever-tools
makepkg -si
```
--------------------------------
### Control Node.js Development Dependencies Installation
Source: https://www.clever-cloud.com/developers/doc/applications/nodejs/index.html
Manages the installation of development dependencies during deployment by setting the CC_NODE_DEV_DEPENDENCIES environment variable to 'install' or 'ignore', overriding default package manager behavior.
```APIDOC
Environment Variable: CC_NODE_DEV_DEPENDENCIES
Description: Controls the installation of development dependencies during the build process.
Possible Values:
- `install`: Development dependencies are installed.
- `ignore`: Development dependencies are not installed.
Behavior:
- If `CC_NODE_DEV_DEPENDENCIES` is set, it overrides `NODE_ENV` for dependency installation.
- If neither is set, the package manager's default behavior applies (development dependencies are typically installed).
- `NODE_ENV=production` without `CC_NODE_DEV_DEPENDENCIES` follows npm/yarn default for production (dev dependencies not installed).
Examples:
- `CC_NODE_DEV_DEPENDENCIES=install`: Installs dev dependencies.
- `CC_NODE_DEV_DEPENDENCIES=ignore`: Ignores dev dependencies.
- `NODE_ENV=production` and `CC_NODE_DEV_DEPENDENCIES=install`: Installs dev dependencies.
- `NODE_ENV=production` and `CC_NODE_DEV_DEPENDENCIES=ignore`: Ignores dev dependencies.
```
--------------------------------
### Configure Clever Cloud Environment
Source: https://www.clever-cloud.com/developers/guides/mkdocs/index.html
Sets the build instance size to 'M' and the host instance to 'nano'. Configures environment variables for the web root, build cache override, and defines pre-build and post-build hooks for installing dependencies and building the static site with MkDocs.
```bash
clever scale --build-flavor M
clever scale --flavor nano
clever env set CC_WEBROOT "/site"
clever env set CC_OVERRIDE_BUILDCACHE "/site"
clever env set CC_PRE_BUILD_HOOK "python3 -m ensurepip --upgrade && pip3 install mkdocs"
clever env set CC_POST_BUILD_HOOK "mkdocs build"
```
--------------------------------
### Configure Clever Cloud Build and Environment
Source: https://www.clever-cloud.com/developers/guides/mdbook/index.html
Sets up the Clever Cloud build instance flavor to 'M' for faster static file generation and the host instance to 'nano'. Configures essential environment variables for the build process, including webroot, build cache override, and pre/post-build hooks for mdBook.
```bash
clever scale --build-flavor M
clever scale --flavor nano
clever env set CC_WEBROOT "/book"
clever env set CC_OVERRIDE_BUILDCACHE "/book"
clever env set CC_PRE_BUILD_HOOK "cargo install mdbook"
clever env set CC_POST_BUILD_HOOK "/home/bas/.cargo/bin/mdbook build"
```
--------------------------------
### Clever Cloud Review App GitHub Action Setup
Source: https://www.clever-cloud.com/developers/doc/ci-cd/github/index.html
Demonstrates the core usage of the Clever Cloud Review App GitHub Action. It includes setting necessary environment variables for authentication and specifying the application type for deployment.
```yaml
name: Create review app
uses: CleverCloud/clever-cloud-review-app@latest
env:
CLEVER_SECRET: ${{ secrets.CLEVER_SECRET }}
CLEVER_TOKEN: ${{ secrets.CLEVER_TOKEN }}
ORGA_ID: ${{ secrets.ORGA_ID }}
with:
type: ''
```
--------------------------------
### Create and Connect to Materia KV Add-on
Source: https://www.clever-cloud.com/developers/doc/addons/materia-kv/index.html
Demonstrates how to create a Materia KV add-on using the Clever Cloud CLI, set environment variables, and connect using redis-cli.
```bash
clever addon create kv DATABASE_NAME
source <(clever addon env addon ADDON_ID -F shell)
redis-cli -h $KV_HOST -p $KV_PORT --tls PING
```
--------------------------------
### Generate requirements.txt
Source: https://www.clever-cloud.com/developers/doc/applications/python/index.html
Command to create a `requirements.txt` file listing all installed Python packages in the current environment. This file is used by Clever Cloud to install dependencies.
```bash
pip freeze > requirements.txt
```
```bash
pip3 freeze > requirements.txt
```
--------------------------------
### Custom Start Parameters for Meteor.js
Source: https://www.clever-cloud.com/developers/doc/applications/meteor/index.html
Configures custom start parameters for the Meteor.js application by modifying the 'scripts.start' field in package.json. The main entry point is '.build/bundle/main.js'.
```json
{
"scripts": {
"start": "node .build/bundle/main.js "
}
}
```
--------------------------------
### Create Rack Application Files
Source: https://www.clever-cloud.com/developers/guides/ruby-rack-app-tutorial/index.html
Commands to create a new directory, navigate into it, and create essential Rack application files (hello.rb, config.ru, Gemfile).
```bash
mkdir helloworld-rack
cd helloworld-rack
touch hello.rb config.ru Gemfile ## or gems.rb
```
--------------------------------
### Install Clever Tools on Windows via Chocolatey
Source: https://www.clever-cloud.com/developers/doc/reference/cli/index.html
Guide for installing Clever Tools on Windows using the Chocolatey package manager. It includes adding the Clever Cloud Nexus repository and disabling a specific Chocolatey feature due to compatibility issues.
```shell
choco sources add -n=clevercloud -s='https://nexus.clever-cloud.com/repository/nupkg/'
choco feature disable --name='usePackageRepositoryOptimizations'
choco install clever-tools
```
--------------------------------
### Rack Application Entry Point
Source: https://www.clever-cloud.com/developers/guides/ruby-rack-app-tutorial/index.html
The Rack configuration file (config.ru) that requires the application class and runs its instance, making it ready for a Rack-compatible server.
```ruby
require './hello'
run HelloWorld.new
```
--------------------------------
### Fluentd Start Script (go.sh)
Source: https://www.clever-cloud.com/developers/guides/fluentd/index.html
A shell script to execute the Fluentd server. It uses Bundler to run the 'fluentd' command with a specified configuration file and prints a confirmation message.
```bash
#!/bin/sh
bundle exec fluentd --use-v1-config -c td-agent.conf
echo "🌍 Fluentd server started"
```
--------------------------------
### Install Clever Tools on Windows (Chocolatey)
Source: https://www.clever-cloud.com/developers/doc/cli/install/index.html
Installs the Clever Cloud CLI on Windows using the Chocolatey package manager. This process involves adding the Clever Cloud NuGet repository and disabling a specific Chocolatey feature due to an incompatibility with Nexus. Requires `choco`.
```powershell
choco sources add -n=clevercloud -s='https://nexus.clever-cloud.com/repository/nupkg/'
choco feature disable --name='usePackageRepositoryOptimizations'
choco install clever-tools
```
--------------------------------
### Vitepress Build Command
Source: https://www.clever-cloud.com/developers/doc/applications/static/index.html
Installs dependencies and builds the Vitepress documentation site, outputting to a specified directory. The `--outDir` flag is passed through to the build script.
```shell
npm i && npm run docs:build -- --outDir
```
--------------------------------
### Hugo Installation Script
Source: https://www.clever-cloud.com/developers/guides/hugo/index.html
A bash script to download and install a specific version of the Hugo Extended binary. It fetches the archive, extracts it to a specified directory in the PATH, and cleans up the archive file.
```bash
HUGO_VERSION="0.121.1"
HUGO_URL="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
DEST_BIN="${HOME}/.local/bin"
FILENAME="hugo.tar.gz"
# Download Hugo Extended and place it in a folder in the $PATH
curl --create-dirs -s -L -o ${DEST_BIN}/${FILENAME} ${HUGO_URL}
cd ${DEST_BIN}
tar xvf ${FILENAME} -C ${DEST_BIN}
rm ${FILENAME}
```
--------------------------------
### Go Project Structure Example
Source: https://www.clever-cloud.com/developers/doc/applications/golang/index.html
Illustrates a common modern Go project organization, including workspace, command entry points, modules, and internal packages. This structure helps manage dependencies and code organization.
```filetree
application-root/
go.work
Makefile
cmd/
main.go
other-file.go
other-package.go
…
module/
go.mod
go.sum
main.go
other-module-file.go
internal/
internal-package/
internal-package-file.go
```
--------------------------------
### Clever Cloud Kibana Setup Hook
Source: https://www.clever-cloud.com/developers/guides/kibana/index.html
This deployment hook is used to automatically set up Kibana with a specific Elastic Stack version during the deployment process on Clever Cloud. It fetches a setup script and executes it.
```shell
CC_PRE_RUN_HOOK="curl https://api.clever-cloud.com/v2/providers/es-addon/kibana-setup/ | sh"
```
--------------------------------
### Define Custom Setup Goal
Source: https://www.clever-cloud.com/developers/doc/reference/reference-environment-variables/index.html
Specifies a custom goal or command to be executed after Python requirements have been installed during the build process.
```APIDOC
PYTHON_SETUP_PY_GOAL
Description: Custom setup goal to be launch after requirements.txt have been installed.
Default value: None
```
--------------------------------
### .NET Project File with Multiple Target Frameworks
Source: https://www.clever-cloud.com/developers/doc/applications/dotnet/index.html
An example snippet from a .NET project file (.csproj) showing how to define multiple target frameworks. This requires specifying CC_DOTNET_TFM during deployment if a specific framework is needed.
```xml
net6.0;net8.0
…
```
--------------------------------
### create: Create an application
Source: https://www.clever-cloud.com/developers/doc/reference/cli/index.html
Facilitates the creation of new applications on Clever Cloud. Requires specifying the application type and optionally an application name. Supports targeting specific organizations, setting aliases, choosing regions, linking GitHub repositories, defining launch tasks, and specifying output formats.
```APIDOC
create
Usage: create --type TYPE [APP-NAME]
Description: Create an application
Options:
--type, -t TYPE Instance type
[--org, -o, --owner] ID_OR_NAME Organisation to target by its ID (or name, if unambiguous)
[--alias, -a] ALIAS Short name for the application
[--region, -r] ZONE Region, can be 'par', 'parhds', 'grahds', 'rbx', 'rbxhds', 'scw', 'ldn', 'mtl', 'sgp', 'syd', 'wsw' (default: par)
[--github] OWNER/REPO GitHub application to use for deployments
[--task, -T] COMMAND The application launch as a task executing the given command, then stopped
[--format, -F] FORMAT Output format (human, json) (default: human)
```