Source Build Guide

How to build the clickhouse-operator from source code

For organizations who prefer to build the software directly from source code, they can compile the clickhouse-operator and install it into a Docker container through the following process.

Binary Build

Binary Build Requirements

  • go-lang compiler: Go.
  • Go mod Package Manager.
  • The source code from the clickhouse-operator repository. This can be downloaded with Go with the command go get github.com/altinity/clickhouse-operator.

Binary Build Instructions

  1. Switch working dir to src/github.com/altinity/clickhouse-operator.
  2. Link all packages with the command: go mod tidy.
  3. Build the sources with go build -o ./clickhouse-operator cmd/operator/main.go.

This creates the clickhouse-operator binary. This binary is only used within a kubernetes environment.

Docker Image Build and Usage

Docker Build Requirements

Docker Build Instructions

  1. Switch working dir to src/github.com/altinity/clickhouse-operator

  2. Build docker image with docker: docker build -t altinity/clickhouse-operator ./

  3. Register freshly build docker image inside kubernetes environment with the following:

    docker save altinity/clickhouse-operator | (eval $(minikube docker-env) && docker load)
    
  4. Install clickhouse-operator as described in either the Basic Build or Custom Build.


Last modified 2021.02.01: Kubernetes guides. (1153e4d)