Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Systemd Unit Update #448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions templates/default/init/systemd/tarball.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
<% @full_java_opts = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nicer to move this into a helper library perhaps?

"-Xms#{@min_heap}",
"-Xmx#{@max_heap}",
"-XX:+UseParNewGC",
"-XX:+UseConcMarkSweepGC",
"-Djava.awt.headless=true",
"-XX:CMSInitiatingOccupancyFraction=75",
"-XX:+UseCMSInitiatingOccupancyOnly",
"-Djava.io.tmpdir=#{@home}/tmp/"
]

@full_java_opts << "-Djava.net.preferIPv4Stack=true" if @ipv4_only
@full_java_opts << @java_opts.strip.gsub(" "," ") unless @java_opts.nil? || @java_opts.empty?
%>
[Unit]
Description=logstash
After=network.target
Expand All @@ -6,16 +20,17 @@ After=network.target
User=<%= @user %>
Group=<%= @supervisor_gid %>
WorkingDirectory=<%= @home %>
LimitNOFILE=<%= @nofile_soft %> <%= @nofile_hard %>
LimitNOFILE=<%= @nofile_hard %>
Environment="LOGSTASH_HOME=<%= @home %>"
Environment="HOME=<%= @home %>"
Environment="LS_HEAP_SIZE=<%= @max_heap %>"
Environment="HEAP_DUMP_PATH=-XX:HeapDumpPath=<%= @home %>/heapdump.hprof"
Environment="GC_OPTS=<%= @gc_opts %>"
Environment='JAVA_OPTS=-server -Xms<%= @min_heap %> -Xmx<%= @max_heap %> -Djava.io.tmpdir=<%= @home %>/tmp/ <%= @java_opts %> <%= "-Djava.net.preferIPv4Stack=true" if @ipv4_only %>'
Environment="JAVA_OPTS=<%=@full_java_opts.join(' ')%>"
ExecStart=<%= @home %>/bin/logstash <%= @args.join(' ') %>
Restart=on-failure
RestartSec=30
SyslogIdentifier=logstash_<%= @name %>

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target