From: | "Tony Vroon (chainsaw)" <chainsaw@g.o> |
---|---|
To: | gentoo-commits@l.g.o |
Subject: | [gentoo-commits] gentoo-x86 commit in app-misc/elasticsearch/files: elasticsearch.conf elasticsearch.init elasticsearch.service |
Date: | Thu, 07 Nov 2013 09:19:32 |
Message-Id: | 20131107091922.EA0D120035@flycatcher.gentoo.org |
1 | chainsaw 13/11/07 09:19:22 |
2 | |
3 | Added: elasticsearch.conf elasticsearch.init |
4 | elasticsearch.service |
5 | Log: |
6 | Initial commit, initial ebuild by Tom Wijsman with further tweaks by Travis G. Hansen around systemd compatibility and traditional init scripts. Silenced QA warnings for pre-built components. |
7 | |
8 | (Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0xB5058F9A) |
9 | |
10 | Revision Changes Path |
11 | 1.1 app-misc/elasticsearch/files/elasticsearch.conf |
12 | |
13 | file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/elasticsearch/files/elasticsearch.conf?rev=1.1&view=markup |
14 | plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/elasticsearch/files/elasticsearch.conf?rev=1.1&content-type=text/plain |
15 | |
16 | Index: elasticsearch.conf |
17 | =================================================================== |
18 | # please modify/copy |
19 | # /etc/elasticsearch/elasticsearch.in.sh.sample |
20 | # to |
21 | # /etc/elasticsearch/[instance/]elasticsearch.in.sh |
22 | # |
23 | # many variables/options are available in this file |
24 | |
25 | # ES_USER="elasticsearch:elasticsearch" |
26 | ## set max fds (ulimit -n X) |
27 | # ES_MAX_FD="" |
28 | |
29 | ## override elasticsearch.in.sh |
30 | # |
31 | # ES_CLASSPATH="" |
32 | # JAVA_OPTS="" |
33 | # ES_JAVA_OPTS="" |
34 | # ES_HEAP_SIZE="" |
35 | # ES_HEAP_NEWSIZE="" |
36 | # ES_DIRECT_SIZE="" |
37 | # ES_USE_IPV4="" |
38 | |
39 | |
40 | |
41 | 1.1 app-misc/elasticsearch/files/elasticsearch.init |
42 | |
43 | file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/elasticsearch/files/elasticsearch.init?rev=1.1&view=markup |
44 | plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/elasticsearch/files/elasticsearch.init?rev=1.1&content-type=text/plain |
45 | |
46 | Index: elasticsearch.init |
47 | =================================================================== |
48 | #!/sbin/runscript |
49 | |
50 | name="ElasticSearch" |
51 | description="" |
52 | |
53 | ES_USER=${ES_USER:="elasticsearch"} |
54 | ES_INSTANCE=${SVCNAME#*.} |
55 | export ES_CLASSPATH="@ES_CLASS_PATH@" |
56 | |
57 | if [ -n "${ES_INSTANCE}" ] && [ ${SVCNAME} != "elasticsearch" ]; then |
58 | PIDFILE="/run/elasticsearch/elasticsearch.${ES_INSTANCE}.pid" |
59 | ES_BASE_PATH="/var/lib/elasticsearch/${ES_INSTANCE}" |
60 | ES_CONF_PATH="/etc/elasticsearch/${ES_INSTANCE}" |
61 | ES_LOG_PATH="/var/log/elasticsearch/${ES_INSTANCE}" |
62 | else |
63 | PIDFILE="/run/elasticsearch/elasticsearch.pid" |
64 | ES_BASE_PATH="/var/lib/elasticsearch/_default" |
65 | ES_CONF_PATH="/etc/elasticsearch" |
66 | ES_LOG_PATH="/var/log/elasticsearch/_default" |
67 | fi |
68 | |
69 | ES_DATA_PATH="${ES_BASE_PATH}/data" |
70 | ES_WORK_PATH="${ES_BASE_PATH}/work" |
71 | |
72 | export ES_INCLUDE="${ES_CONF_PATH}/elasticsearch.in.sh" |
73 | export JAVA_OPTS |
74 | export ES_JAVA_OPTS |
75 | export ES_HEAP_SIZE |
76 | export ES_HEAP_NEWSIZE |
77 | export ES_DIRECT_SIZE |
78 | export ES_USE_IPV4 |
79 | |
80 | server_command="/usr/share/elasticsearch/bin/elasticsearch" |
81 | server_args=" -p ${PIDFILE} -Des.path.conf=\"${ES_CONF_PATH}\" -Des.path.data=\"${ES_DATA_PATH}\" -Des.path.work=\"${ES_WORK_PATH}\" -Des.path.logs=\"${ES_LOG_PATH}\"" |
82 | |
83 | depend() { |
84 | use net |
85 | } |
86 | |
87 | start() { |
88 | # elasticsearch -f -Des.config=/path/to/config/file |
89 | # elasticsearch -f -Des.network.host=10.0.0.4 |
90 | |
91 | [ ! -f "${ES_INCLUDE}" ] && { |
92 | eerror "${ES_INCLUDE} must be copied into place" |
93 | return 1 |
94 | } |
95 | |
96 | local conf |
97 | local conf_file |
98 | for conf in elasticsearch.yml logging.yml; do |
99 | conf_file="${ES_CONF_PATH}/${conf}" |
100 | if [ ! -f "${conf_file}" ]; then |
101 | eerror "${conf_file} must be copied into place" |
102 | return 1 |
103 | fi |
104 | done |
105 | |
106 | ebegin "Starting ${SVCNAME}" |
107 | |
108 | if [ -n "${ES_MAX_FD}" ]; then |
109 | ulimit -n ${ES_MAX_FD} |
110 | einfo "Max open filedescriptors : ${ES_MAX_FD}" |
111 | fi |
112 | |
113 | |
114 | checkpath -d -o "${ES_USER}" -m750 "/var/lib/elasticsearch" |
115 | checkpath -d -o "${ES_USER}" -m750 "/var/log/elasticsearch" |
116 | checkpath -d -o "${ES_USER}" -m750 "$(dirname "${PIDFILE}")" |
117 | checkpath -d -o "${ES_USER}" -m750 "${ES_BASE_PATH}" |
118 | checkpath -d -o "${ES_USER}" -m750 "${ES_LOG_PATH}" |
119 | |
120 | start-stop-daemon --start \ |
121 | --chdir "${ES_BASE_PATH}" \ |
122 | --user="${ES_USER}" \ |
123 | --pidfile="${PIDFILE}" \ |
124 | --exec ${server_command} -- ${server_args} |
125 | eend $? |
126 | } |
127 | |
128 | stop() { |
129 | ebegin "Stopping ${SVCNAME}" |
130 | start-stop-daemon --stop \ |
131 | --pidfile=${PIDFILE} |
132 | eend $? |
133 | } |
134 | |
135 | |
136 | |
137 | 1.1 app-misc/elasticsearch/files/elasticsearch.service |
138 | |
139 | file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/elasticsearch/files/elasticsearch.service?rev=1.1&view=markup |
140 | plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/elasticsearch/files/elasticsearch.service?rev=1.1&content-type=text/plain |
141 | |
142 | Index: elasticsearch.service |
143 | =================================================================== |
144 | [Unit] |
145 | Description=ElasticSearch |
146 | After=network.target |
147 | |
148 | [Service] |
149 | User=elasticsearch |
150 | Environment=ES_INCLUDE=/etc/elasticsearch/elasticsearch.in.sh |
151 | ExecStart=/usr/share/elasticsearch/bin/elasticsearch -f -Des.path.conf=/etc/elasticsearch |
152 | |
153 | [Install] |
154 | WantedBy=multi-user.target |