Skip to content

Instantly share code, notes, and snippets.

View schmichael's full-sized avatar

Michael Schurter schmichael

View GitHub Profile
@schmichael
schmichael / devagent.hcl
Created January 30, 2024 21:58
Run with `nomad agent -config devagent.hcl`
enable_debug = true
log_level = "DEBUG"
data_dir = "/tmp/nomad-devagent"
client {
enabled = true
}
server {
@schmichael
schmichael / nginx-proxy.nomad.hcl
Created November 1, 2023 20:27
Exposes Nomad's HTTP API on port 8080 with /.well-known/ endpoints available without auth.
job "nginx-proxy" {
group "nginx" {
network {
port "http" {
static = 8080
to = 8080
}
}
job "example" {
type = "batch"
task t {
driver = "exec"
config {
command = "/bin/sh"
args = ["-c", "echo '>> /proc'; grep ^Cap /proc/self/status; echo '>> getpcaps'; getpcaps 0; echo '>> prlimit'; prlimit"]
}
}
}
variable "vault_version" {
type = string
default = "1.14.0"
}
job "vault" {
datacenters = ["*"]
type = "service"
group "vault" {
count = 1
@schmichael
schmichael / mixed1.hcl
Created April 11, 2023 00:03
Nomad Client/Server Agent configs
enable_debug = true
log_level = "debug"
name = "mixed1"
data_dir = "/tmp/nomad-mixed1"
client {
enabled = true
servers = ["127.0.0.1:4647"]
}
package main
import (
"fmt"
"sync"
"time"
)
func timeTasks(count int) time.Duration {
nopTask := func(done func()) {
job "example" {
group "cache" {
network {
port "db" {
to = 6379
}
}
task "redis" {
@schmichael
schmichael / nomad-consul-tls.md
Last active September 4, 2022 12:56
Nomad+Consul TLS Story

Nomad+Consul TLS Story

See https://github.com/schmichael/nomad-tls for sample configs.

Nomad issues

  • Consul uses ssl instead of tls config parameters
  • Consul uses verify_ssl instead of verify_tls
  • consul.cert_file should specify that it's the client certificate used for mutual authentication.
  • consul.{ca,cert,key}_file should default to tls.{ca,cert,key}_file
@schmichael
schmichael / gist:7379338
Created November 8, 2013 23:32
Transparently compress and upload a file in golang
package main
import (
"bufio"
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"