2015-08-08 00:39:59 +02:00
|
|
|
ES_HOME ?= /var/lib/elasticsearch
|
2018-12-06 02:06:56 +01:00
|
|
|
ES_VER ?= 6.5.1
|
2015-08-08 00:39:59 +02:00
|
|
|
ES_TARBALL = elasticsearch-$(ES_VER).tar.gz
|
2017-03-19 15:32:19 +01:00
|
|
|
ES_URL = https://artifacts.elastic.co/downloads/elasticsearch/$(ES_TARBALL)
|
2015-08-08 00:39:59 +02:00
|
|
|
|
|
|
|
preinstall:
|
|
|
|
|
|
|
|
create_user:
|
2018-10-27 20:04:00 +02:00
|
|
|
-RUN useradd --system \
|
2015-08-08 00:39:59 +02:00
|
|
|
--comment "Elastic Search" \
|
|
|
|
--home-dir=$(ES_HOME) \
|
|
|
|
--create-home \
|
|
|
|
elastic
|
|
|
|
|
|
|
|
install_elasticsearch:
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN test -f /usr/portage/distfiles/$(ES_TARBALL) || \
|
|
|
|
RUN wget -P /usr/portage/distfiles $(ES_URL)
|
|
|
|
RUN tar xf /usr/portage/distfiles/$(ES_TARBALL) -C $(ES_HOME)
|
|
|
|
RUN sh -c 'cd $(ES_HOME) && ln -s elasticsearch-$(ES_VER)/* .'
|
2015-08-08 00:39:59 +02:00
|
|
|
|
2015-12-09 19:14:21 +01:00
|
|
|
install_license:
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN sh -c 'cd $(ES_HOME) && ./bin/plugin install license'
|
2015-12-09 19:14:21 +01:00
|
|
|
|
|
|
|
install_marvel: install_license
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN sh -c 'cd $(ES_HOME) && ./bin/plugin install marvel-agent'
|
2015-09-30 11:45:55 +02:00
|
|
|
echo 'marvel.agent.enabled: false' >> $(CHROOT)/$(ES_HOME)/config/elasticsearch.yml
|
|
|
|
|
2015-08-08 00:39:59 +02:00
|
|
|
postinstall: elasticsearch.service
|
|
|
|
$(MAKE) create_user
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN rm -rf $(ES_HOME)
|
|
|
|
RUN mkdir -p $(ES_HOME)
|
2015-08-08 00:39:59 +02:00
|
|
|
$(MAKE) install_elasticsearch
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN chown -R elastic:elastic $(ES_HOME)
|
|
|
|
COPY elasticsearch.service /etc/systemd/system
|
|
|
|
RUN systemctl enable elasticsearch.service
|
2015-08-08 00:39:59 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
|
2015-10-28 13:26:31 +01:00
|
|
|
|
2015-12-09 19:14:21 +01:00
|
|
|
.PHONY: create_user preinstall postinstall clean install_elasticsearch install_marvel install_license
|