Skip to content

Instantly share code, notes, and snippets.

@TheCase

TheCase/_commands

Last active Nov 28, 2018
Embed
What would you like to do?
nomad sample
yum -y install python-setuptools unzip wget
easy_install pip
pip install supervisor
wget https://releases.hashicorp.com/consul/0.8.0/consul_0.8.0_linux_amd64.zip
unzip consul*.zip
mkdir -p /opt/consul/data
mv consul /opt/consul
wget https://releases.hashicorp.com/nomad/0.5.6/nomad_0.5.6_linux_amd64.zip
unzip nomad*.zip
mv nomad /usr/bin
mkdir -p /var/log/supervisor/
mkdir -p /etc/supervisor/conf.d
mkdir /etc/nomad.d
[program:consul]
command=/opt/consul/consul agent -data-dir=consul-data -bind=0.0.0.0 -join=consul.service.consul
autostart=true
user=root
log_stdout=true
log_stderr=true
logfile=/var/log/supervisor_consul.log
; supervisor config file
[unix_http_server]
file=/var/run//supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run//supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
[program:nomad]
command=/usr/bin/nomad agent -config /etc/nomad.d/server.hcl
autostart=true
user=root
log_stdout=true
log_stderr=true
logfile=/var/log/supervisor_nomad.log
data_dir = "/etc/nomad.d"
server {
enabled = true
bootstrap_expect = 3 # equal to the number of nomad nodes
}
client {
enabled = true
servers = ["nomad.service.consul:4647"]
}
job "redis" {
datacenters = ["dc1"]
group "example" {
count = "2"
task "server" {
driver = "docker"
config {
image = "redis"
port_map {
db = 6379
}
}
resources {
memory = 128
network {
port "db" { }
}
}
service {
tags = ["echo","hello"]
port = "db"
check {
type = "tcp"
port = "db"
interval = "10s"
timeout = "2s"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment