Templates everything + Systemd improvements+fixes + Notifications for restart + Idempotent checks for multiple runs

This commit is contained in:
Dale McDiarmid 2015-11-27 18:12:59 +00:00
parent 3d7d6deef0
commit 37447d1618
9 changed files with 663 additions and 132 deletions

View file

@ -0,0 +1,50 @@
[Unit]
Description=Elasticsearch
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
Environment=ES_HOME={{es_home}}
Environment=CONF_DIR={{instance_config_directory}}
Environment=CONF_FILE={{instance_config_directory}}/elasticsearch.yml
Environment=DATA_DIR={{data_dir}}
Environment=LOG_DIR={{log_dir}}
Environment=PID_DIR={{pid_dir}}
EnvironmentFile=-{{instance_default_file}}
User={{es_user}}
Group={{es_group}}
ExecStart={{es_home}}/bin/elasticsearch \
-Des.pidfile=$PID_DIR/elasticsearch.pid \
-Des.default.path.home=$ES_HOME \
-Des.default.path.logs=$LOG_DIR \
-Des.default.path.data=$DATA_DIR \
-Des.default.config=$CONF_FILE \
-Des.default.path.conf=$CONF_DIR
# Connects standard output to /dev/null
StandardOutput=null
# Connects standard error to journal
StandardError=journal
# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65535
# Specifies the maximum number of bytes of memory that may be locked into RAM
# Set to "infinity" if you use the 'bootstrap.mlockall: true' option
# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in {{instance_default_file}}
{% if m_lock_enabled %}
LimitMEMLOCK=infinity
{% endif %}
# Shutdown delay in seconds, before process is tried to be killed with KILL (if configured)
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target