Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

cking/caravan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caravan

caravan is a GitOps operator for Hashicorp Nomad.

How to use

Setting up caravan

Environment variables

NOMAD_ADDR - Required to overide the default of http://127.0.0.1:4646.
NOMAD_TOKEN - Required with ACLs enabled.
NOMAD_CACERT - Required with TLS enabled.
NOMAD_CLIENT_CERT - Required with TLS enabled.
NOMAD_CLIENT_KEY - Required with TLS enabled.
GIT_REPO - get repository to checkout
GIT_BRANCH - Branch to use, default is 'main'
GIT_PATH - only index files in this directory and its subdirectories
CARAVAN_INTERVAL - Run caravan in these intervals (defaults to 1 Minute)

Usage

Set the environment variables by a tool of your choice, or place a .env file in the working directory. Then just run caravan:

./caravan

Run as Nomad job

job "caravan" {
  datacenters = ["dc1"]

  group "caravan" {
    count = 1
    task "caravan" {
      driver = "exec"
      config {
        command = "caravan"
      }
  
      env {
        GIT_REPO = "https://github.com/user/some_nomad_job_file_repo"
      }
  
      artifact {
        source      = "https://github.com/cking/caravan/releases/download/v0.0.5/caravan_0.0.5_linux_amd64.tar.gz"
        destination = "local"
        mode        = "any"
      }
    }
  }
}

If you want to use a private git repository, make sure you have a private access token with read permissions on that repository and then enter the GIT_REPO URL as https://user:password@github.com/user/repo

Acknowledgement

nomad-gitops-operator by @jonasvinthjer