Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #23001 to 7.x: [build] add MADVDONTNEED to builds #23175

Merged
merged 1 commit into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions dev-tools/packaging/templates/deb/elastic-agent.init.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ BEAT_USER="{{.BeatUser}}"
WRAPPER_ARGS="-r / -n -p $PIDFILE"
SCRIPTNAME=/etc/init.d/{{.ServiceName}}


# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/{{.ServiceName}} ] && . /etc/default/{{.ServiceName}}

DEFAULT_GODEBUG="madvdontneed=1"
export GODEBUG=${GODEBUG-$DEFAULT_GODEBUG}

[ "$BEAT_USER" != "root" ] && WRAPPER_ARGS="$WRAPPER_ARGS -u $BEAT_USER"
USER_WRAPPER="su"
USER_WRAPPER_ARGS="$BEAT_USER -c"
Expand Down
4 changes: 4 additions & 0 deletions dev-tools/packaging/templates/deb/init.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ BEAT_USER="{{.BeatUser}}"
WRAPPER_ARGS="-r / -n -p $PIDFILE"
SCRIPTNAME=/etc/init.d/{{.ServiceName}}


# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/{{.ServiceName}} ] && . /etc/default/{{.ServiceName}}

DEFAULT_GODEBUG="madvdontneed=1"
export GODEBUG=${GODEBUG-$DEFAULT_GODEBUG}

[ "$BEAT_USER" != "root" ] && WRAPPER_ARGS="$WRAPPER_ARGS -u $BEAT_USER"
USER_WRAPPER="su"
USER_WRAPPER_ARGS="$BEAT_USER -c"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ LABEL \

ENV ELASTIC_CONTAINER "true"
ENV PATH={{ $beatHome }}:$PATH
ENV GODEBUG="madvdontneed=1"

# Add an init process, check the checksum to make sure it's a match
RUN set -e ; \
Expand Down
1 change: 1 addition & 0 deletions dev-tools/packaging/templates/docker/Dockerfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ LABEL \

ENV ELASTIC_CONTAINER "true"
ENV PATH={{ $beatHome }}:$PATH
ENV GODEBUG="madvdontneed=1"

# Add an init process, check the checksum to make sure it's a match
RUN set -e ; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ After=network-online.target
User={{ .BeatUser }}
Group={{ .BeatUser }}
{{- end }}
Environment="GODEBUG='madvdontneed=1'"
Environment="BEAT_CONFIG_OPTS=-c /etc/{{.BeatName}}/{{.BeatName}}.yml"
ExecStart=/usr/bin/{{.BeatName}} run --environment systemd $BEAT_CONFIG_OPTS
Restart=always
Expand Down
1 change: 1 addition & 0 deletions dev-tools/packaging/templates/linux/systemd.unit.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ After=network-online.target
User={{ .BeatUser }}
Group={{ .BeatUser }}
{{- end }}
Environment="GODEBUG='madvdontneed=1'"
Environment="BEAT_LOG_OPTS="
Environment="BEAT_CONFIG_OPTS=-c /etc/{{.BeatName}}/{{.BeatName}}.yml"
Environment="BEAT_PATH_OPTS=--path.home /usr/share/{{.BeatName}} --path.config /etc/{{.BeatName}} --path.data /var/lib/{{.BeatName}} --path.logs /var/log/{{.BeatName}}"
Expand Down
2 changes: 2 additions & 0 deletions dev-tools/packaging/templates/rpm/elastic-agent.init.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ wrapperopts="-r / -n -p $pidfile"
user_wrapper="su"
user_wrapperopts="$beat_user -c"
RETVAL=0
DEFAULT_GODEBUG="madvdontneed=1"
export GODEBUG=${GODEBUG-$DEFAULT_GODEBUG}

# Source function library.
. /etc/rc.d/init.d/functions
Expand Down
2 changes: 2 additions & 0 deletions dev-tools/packaging/templates/rpm/init.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ wrapperopts="-r / -n -p $pidfile"
user_wrapper="su"
user_wrapperopts="$beat_user -c"
RETVAL=0
DEFAULT_GODEBUG="madvdontneed=1"
export GODEBUG=${GODEBUG-$DEFAULT_GODEBUG}

# Source function library.
. /etc/rc.d/init.d/functions
Expand Down