From c3857795cb0d87f8dfc0cfe9cedfbc3e5a0b2bb6 Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Wed, 2 Dec 2015 11:33:44 -0800 Subject: [PATCH] Basic configs and init scripts --- dist/README.md | 37 +++++++++++++++++++++++++++++++++++++ dist/_common.conf | 2 ++ dist/client.conf | 4 ++++ dist/server.conf | 4 ++++ dist/systemd/nomad.service | 6 ++++++ dist/upstart/nomad.conf | 4 ++++ 6 files changed, 57 insertions(+) create mode 100644 dist/README.md create mode 100644 dist/_common.conf create mode 100644 dist/client.conf create mode 100644 dist/server.conf create mode 100644 dist/systemd/nomad.service create mode 100644 dist/upstart/nomad.conf diff --git a/dist/README.md b/dist/README.md new file mode 100644 index 000000000..949117a88 --- /dev/null +++ b/dist/README.md @@ -0,0 +1,37 @@ +# Dist + +The `dist` folder contains sample configs for various platforms. + +## Overview + +"server" refers to a Nomad agent configured in server mode. Typically you will have 3 or 5 server nodes in your cluster. These are responsible for scheduling and tracking cluster state so these nodes are generally 100% dedicated to this purpose, or may be shared with a similar service like consul leader nodes. + +"client" refers to the Nomad agent that is installed on every machine in your cluster, and is responsible for running jobs. + +On unixes we will place agent configs under `/etc/nomad/`. Data is stored under `/var/lib/nomad/`. + +## Agent Configs + +Nomad accepts either a file or directory for configuration. When using a configuration directory, files are read in deterministic order and each subsequent config appends (or overrides) options. + +The following files are provided: + +- `_common.conf` +- `server.conf` +- `client.conf` + +These should be placed in `/etc/nomad/` depending on the node's role. You should use `server.conf` to configure a node as a server (which is responsible for scheduling) or `client.conf` to configure a node as a client (which is responsible for running workloads). Both type of agents should include `_common.conf`. + +See for details about how to configure Nomad. + +## Upstart + +On systems using upstart the basic upstart file under `upstart/nomad.conf` starts and stops the nomad agent. Place it under `/etc/init/nomad.conf`. + +You can control Nomad with `start|stop|restart nomad`. + +## Systemd + +On systems using systemd the basic systemd file under `systemd/nomad.service` starts and stops the nomad agent. Place it under `/etc/systemd/system/nomad.service`. + +You can control Nomad with `systemctl start|stop|restart nomad`. \ No newline at end of file diff --git a/dist/_common.conf b/dist/_common.conf new file mode 100644 index 000000000..d8abdb72a --- /dev/null +++ b/dist/_common.conf @@ -0,0 +1,2 @@ +bind_addr = "0.0.0.0" +data_dir = "/var/lib/nomad/" \ No newline at end of file diff --git a/dist/client.conf b/dist/client.conf new file mode 100644 index 000000000..2f7f95286 --- /dev/null +++ b/dist/client.conf @@ -0,0 +1,4 @@ +client { + enabled = true + servers = ["10.1.0.1", "10.1.0.2", "10.1.0.3"] +} \ No newline at end of file diff --git a/dist/server.conf b/dist/server.conf new file mode 100644 index 000000000..7204259b6 --- /dev/null +++ b/dist/server.conf @@ -0,0 +1,4 @@ +server { + enabled = true + bootstrap_expect = 3 +} \ No newline at end of file diff --git a/dist/systemd/nomad.service b/dist/systemd/nomad.service new file mode 100644 index 000000000..7e424269b --- /dev/null +++ b/dist/systemd/nomad.service @@ -0,0 +1,6 @@ +[Unit] +Description=Nomad +Documentation=https://nomadproject.io/docs/ + +[Service] +ExecStart=/usr/local/bin/nomad agent -c /etc/nomad/ \ No newline at end of file diff --git a/dist/upstart/nomad.conf b/dist/upstart/nomad.conf new file mode 100644 index 000000000..dc11bdb89 --- /dev/null +++ b/dist/upstart/nomad.conf @@ -0,0 +1,4 @@ +start on (filesystem and net-device-up IFACE=lo) +stop on runlevel [!2345] + +exec /usr/local/bin/nomad -c /etc/nomad/ \ No newline at end of file