Skip to content

Instantly share code, notes, and snippets.

@spuder
Last active January 6, 2021 01:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spuder/54f4b54a86d4690a76bfc4ed8eecc415 to your computer and use it in GitHub Desktop.
Save spuder/54f4b54a86d4690a76bfc4ed8eecc415 to your computer and use it in GitHub Desktop.
ReDash Nomad job #nomad
# Based on this documentation
# https://redash.io/help/open-source/setup#-Docker
# https://github.com/getredash/setup/blob/master/data/docker-compose.yml
job "redash" {
# region = ""
datacenters = ["dc1"]
type = "service"
# Persistent disk for jobs. This is _not_ robust and shouldn't
# be trusted long term. Its good enough for development
# Long term anything persistent should be moved to our large postgres servers
# or atleast use the nomad ceph CSI plugin
# ephemeral_disk {
# migrate = true
# size = "2048"
# sticky = true
# }
# Nomad clusters are spread across datacenters, jobs will automatically be
# split 50/50 between datacenters.
spread {
attribute = "${node.datacenter}"
weight = 100
}
group "redash" {
count = 1
#TODO: use dynamic ports, not hard code to 5000
network {
mode = "bridge"
port "http" {
to = 5000
}
}
service {
name = "redash-"
tags = [
"urlprefix-redash.example.com/ proto=http" ]
port = "5000"
check {
name = "redash---health"
type = "http"
port = "http"
path = "/"
interval = "10s"
timeout = "2s"
expose = true
}
connect {
sidecar_service {}
}
}
task "seed_database" {
driver = "docker"
lifecycle {
sidecar = false
hook = "prestart"
}
config {
image = "redash/redash:8.0.0.b32245"
command = "create_db"
}
env {
"PGHOST" = "localhost"
REDASH_REDIS_URL="redis://localhost:6379/0"
POSTGRES_PASSWORD="correct-horse-battery-staple1"
REDASH_COOKIE_SECRET= "correct-horse-battery-staple2"
REDASH_SECRET_KEY= "correct-horse-battery-staple3"
REDASH_DATABASE_URL="postgresql://postgres:${POSTGRES_PASSWORD}@localhost/postgres"
}
}
task "server" {
driver = "docker"
config {
image = "redash/redash:8.0.0.b32245"
command = "server"
}
env {
REDASH_WEB_WORKERS=4
REDASH_REDIS_URL="redis://localhost:6379/0"
POSTGRES_PASSWORD="correct-horse-battery-staple1"
REDASH_COOKIE_SECRET= "correct-horse-battery-staple2"
REDASH_SECRET_KEY= "correct-horse-battery-staple3"
REDASH_DATABASE_URL="postgresql://postgres:${POSTGRES_PASSWORD}@localhost/postgres"
REDASH_THROTTLE_LOGIN_PATTERN="500/hour"
}
resources {
cpu = 1000
memory = 1000
network {
mbits = 1
}
}
} # server
task "scheduler" {
driver = "docker"
config {
image = "redash/redash:8.0.0.b32245"
command = "scheduler"
}
env {
"QUEUES" = "celery"
"WORKERS_COUNT" = 1
REDASH_REDIS_URL="redis://localhost:6379/0"
POSTGRES_PASSWORD="correct-horse-battery-staple1"
REDASH_COOKIE_SECRET= "correct-horse-battery-staple2"
REDASH_SECRET_KEY= "correct-horse-battery-staple3"
REDASH_DATABASE_URL="postgresql://postgres:${POSTGRES_PASSWORD}@localhost/postgres"
}
resources {
cpu = 512
memory = 512
network {
mbits = 1
}
}
} # scheduler
task "scheduled_worker" {
driver = "docker"
config {
image = "redash/redash:8.0.0.b32245"
command = "worker"
}
env {
"QUEUES" = "scheduled_queries,schemas"
"WORKERS_COUNT" = 1
REDASH_REDIS_URL="redis://localhost:6379/0"
POSTGRES_PASSWORD="correct-horse-battery-staple1"
REDASH_COOKIE_SECRET= "correct-horse-battery-staple2"
REDASH_SECRET_KEY= "correct-horse-battery-staple3"
REDASH_DATABASE_URL="postgresql://postgres:${POSTGRES_PASSWORD}@localhost/postgres"
}
resources {
cpu = 512
memory = 512
network {
mbits = 1
}
}
} # scheduled_worker
task "adhoc_worker" {
driver = "docker"
config {
image = "redash/redash:8.0.0.b32245"
command = "worker"
}
env {
"QUEUES" = "queries"
"WORKERS_COUNT" = 2
REDASH_REDIS_URL="redis://localhost:6379/0"
POSTGRES_PASSWORD="correct-horse-battery-staple1"
REDASH_COOKIE_SECRET= "correct-horse-battery-staple2"
REDASH_SECRET_KEY= "correct-horse-battery-staple3"
REDASH_DATABASE_URL="postgresql://postgres:${POSTGRES_PASSWORD}@localhost/postgres"
}
resources {
cpu = 512
memory = 512
network {
mbits = 1
}
}
} # adhoc_worker
task "redis" {
driver = "docker"
config {
image = "redis:5.0-alpine"
}
lifecycle {
sidecar = true
hook = "prestart"
}
resources {
cpu = 1000
memory = 1000
network {
mbits = 1
}
}
} # redis
task "postgres" {
driver = "docker"
config {
image = "postgres:9.6-alpine"
volumes = [
# "/opt/redash/postgres-data:/var/lib/postgresql/data"
]
}
lifecycle {
sidecar = true
hook = "prestart"
}
env {
#https://github.com/getredash/redash/pull/4740
"POSTGRES_HOST_AUTH_METHOD" = "trust"
POSTGRES_PASSWORD="correct-horse-battery-staple1"
REDASH_COOKIE_SECRET= "correct-horse-battery-staple2"
REDASH_SECRET_KEY= "correct-horse-battery-staple3"
REDASH_DATABASE_URL="postgresql://postgres:${POSTGRES_PASSWORD}@localhost/postgres"
}
resources {
cpu = 1000
memory = 1000
network {
mbits = 1
}
}
} # redis
} # group
meta {
CI_PROJECT_URL = ""
CI_COMMIT_REF_NAME = ""
EPHEMERAL = "false"
CI_PIPELINE_IID = ""
CI_COMMIT_SHA = ""
}
} # job
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment