Last active
November 28, 2018 15:18
-
-
Save TheCase/b87fe2156125140c12926e4f80d36967 to your computer and use it in GitHub Desktop.
nomad sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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