Created
December 13, 2017 08:26
-
-
Save varshavaradarajan/bcc57b437061251969311f26b9e0e3b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
setup_autoregister_properties_file_for_elastic_agent() { | |
echo "agent.auto.register.key=${GO_EA_AUTO_REGISTER_KEY}" >> $1 | |
echo "agent.auto.register.environments=${GO_EA_AUTO_REGISTER_ENVIRONMENT}" >> $1 | |
echo "agent.auto.register.elasticAgent.agentId=${GO_EA_AUTO_REGISTER_ELASTIC_AGENT_ID}" >> $1 | |
echo "agent.auto.register.elasticAgent.pluginId=${GO_EA_AUTO_REGISTER_ELASTIC_PLUGIN_ID}" >> $1 | |
echo "agent.auto.register.hostname=${AGENT_AUTO_REGISTER_HOSTNAME}" >> $1 | |
export GO_SERVER_URL="${GO_EA_SERVER_URL}" | |
# unset variables, so we don't pollute and leak sensitive stuff to the agent process... | |
unset GO_EA_AUTO_REGISTER_KEY GO_EA_AUTO_REGISTER_ENVIRONMENT GO_EA_AUTO_REGISTER_ELASTIC_AGENT_ID GO_EA_AUTO_REGISTER_ELASTIC_PLUGIN_ID GO_EA_SERVER_URL AGENT_AUTO_REGISTER_HOSTNAME | |
} | |
setup_autoregister_properties_file() { | |
if [ -n "$GO_EA_SERVER_URL" ]; then | |
setup_autoregister_properties_file_for_elastic_agent "$1" | |
try chown go:go $1 | |
fi | |
} | |
( | |
mkdir -p /usr/local/sbin | |
wget https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64 -O /usr/local/sbin/gosu | |
chmod 0755 /usr/local/sbin/gosu | |
chown root:root /usr/local/sbin/gosu | |
apk --no-cache upgrade | |
apk add --no-cache openjdk8-jre-base git mercurial subversion openssh-client bash curl | |
curl --fail --location --silent --show-error "https://download.gocd.org/binaries/17.12.0-5626/generic/go-agent-17.12.0-5626.zip" > /tmp/go-agent.zip | |
unzip /tmp/go-agent.zip -d / | |
mv go-agent-17.12.0 /go-agent | |
rm /tmp/go-agent.zip | |
mkdir -p /docker-entrypoint.d | |
mkdir -p /go-agent/config | |
setup_autoregister_properties_file "/go-agent/config/autoregister.properties" | |
/go-agent/agent.sh | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment