-
Notifications
You must be signed in to change notification settings - Fork 20
/
etcd.sysconfig
122 lines (97 loc) · 3.73 KB
/
etcd.sysconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
# Copyright 2014, Nathan Milford
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Will be used to populate IP address values below. Setting some items to
# '0.0.0.0' is not compatable with the discovery API.
_MY_IPADDR=$(/sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | sort | awk '{print $1}')
# Daemon User
ETCD_USER="etcd"
# Communication Protocol Identifier (http://|https://)
ETCD_PROTOCOL="http://"
# Cluster Seeds
# You can specify a list here sepearated by commas, or leave it blank if
# you're playing with a single node.
ETCD_SEEDS=""
# Discovery Endpoint
# Leave it as the public URL unless you are running your own.
ETCD_DISCOVER_ENDPOINT="https://discovery.etcd.io/"
# Discovery Token
# If you are using the discovery protocol you can grab your cluster token
# from https://discovery.etcd.io/new if you are not hosting it yourself.
ETCD_DISCOVERY_TOKEN=""
# Discovery using SRV DNS Records
# Configure the domain that serves the etcd cluster SRV records _etcd-server._tcp
# and/or _etcd-server-https._tcp
ETCD_DISCOVERY_SRV_DOMAIN=""
# This node's name as it represents itself on the cluster.
ETCD_NODE_NAME=$(hostname -s)
# Hostname and port for the etcd server to work on.
ETCD_LISTEN="${ETCD_PROTOCOL}localhost:4001,${ETCD_PROTOCOL}${_MY_IPADDR}:4001"
# Directory to store log and snapshot.
ETCD_DATA_DIR="/var/lib/etcd/"
# File to log stdout/stderr to.
ETCD_OUT_FILE="/var/log/etcd/etcd.out"
# Set logging vebosity for the file above.
# Valid options are "", "v" or "vv"
ETCD_LOGGING=""
# Set security settings for the etcd server.
# Leave blank if you do not plan to use this feature, otherwise add appropriate
# paths.
ETCD_CAFILE=""
ETCD_CERT=""
ETCD_KEY=""
# Toggles snapshotting.
# Keep blank or set to true.
ETCD_SNAPSHOT=""
# Hostname and port for the RAFT server to work on.
RAFT_LISTEN="${ETCD_PROTOCOL}${_MY_IPADDR}:7001"
# Set security settings for the RAFT server.
# Leave blank if you do not plan to use this feature, otherwise add appropriate
# paths.
RAFT_CAFILE=""
RAFT_CERT=""
RAFT_KEY=""
# Below we build the opts to pass to the init script.
ETCD_OPTS="-name=${ETCD_NODE_NAME} \
--listen-client-urls=${ETCD_LISTEN} \
--listen-peer-urls=${RAFT_LISTEN} \
-data-dir=${ETCD_DATA_DIR}"
if [ x$ETCD_SEEDS != "x" ]; then
ETCD_OPTS="$ETCD_OPTS -peers=${ETCD_SEEDS}"
fi
if [ x$ETCD_DISCOVERY_TOKEN != "x" ]; then
ETCD_OPTS="$ETCD_OPTS -discovery=${ETCD_DISCOVER_ENDPOINT}${ETCD_DISCOVERY_TOKEN}"
elif [ x$ETCD_DISCOVERY_SRV_DOMAIN != "x" ]; then
ETCD_OPTS="$ETCD_OPTS --discovery-srv=${ETCD_DISCOVERY_SRV_DOMAIN}"
fi
if [ "$ETCD_LOGGING" == "v" ]; then
ETCD_OPTS="$ETCD_OPTS -v"
elif [ "$ETCD_LOGGING" == "vv" ]; then
ETCD_OPTS="$ETCD_OPTS -vv"
fi
if [ x$ETCD_SNAPSHOT != "x" ]; then
ETCD_OPTS="$ETCD_OPTS -snapshot"
fi
if [ x$ETCD_CAFILE != "x" ] && [ x$ETCD_CERT != "x" ] && [ x$ETCD_KEY != "x" ]; then
ETCD_OPTS="$ETCD_OPTS -ca-file=${ETCD_CAFILE} -cert-file=${ETCD_CERT} -key-file=${ETCD_KEY}"
fi
if [ x$RAFT_CAFILE != "x" ] && [ x$RAFT_CERT != "x" ] && [ x$RAFT_KEY != "x" ]; then
ETCD_OPTS="$ETCD_OPTS -peer-ca-file=${RAFT_CAFILE} -peer-cert-file=${RAFT_CERT} -peer-key-file=${RAFT_KEY}"
fi
# TODO
# Add support for:
# -peers-file
# -config
# -cors
# -cpuprofile