Skip to content

Commit

Permalink
Fixing the startup scripts for chaos
Browse files Browse the repository at this point in the history
  • Loading branch information
florianleibert committed Oct 23, 2013
1 parent 0e8eb4a commit 2985faf
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
25 changes: 20 additions & 5 deletions bin/chronos-marathon
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,35 @@
set -o errexit -o nounset -o pipefail
set -x

chronos_home="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd -P )"
echo "Chronos home set to $chronos_home"
export JAVA_LIBRARY_PATH="/usr/local/lib:/lib:/usr/lib"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-/lib}"
export LD_LIBRARY_PATH="$JAVA_LIBRARY_PATH:$LD_LIBRARY_PATH"
export PORT0="${PORT0:-4400}"

# Find the largest chronos-jar file in the directory (i.e. the all-encompassing jar file)
jar_file=$(find . -name "chronos*.jar" -exec ls -l -S {} \; | sort -k 5 -n | tail -n1 | awk '{ print $9 }')
flags=()

#If we're on Amazon, let's use the public hostname so redirect works as expected.
if public_hostname="$( curl -f --timeout 1 http://169.254.169.254/latest/meta-data/public-hostname )"
then
flags+=( --hostname $public_hostname )
fi

jar_files=( "$chronos_home"/chronos*.jar )
echo "Using jar file: $jar_files[0]"

# This assumes there is a file, /etc/mesos/zk that contains the ZK string.
mesos_master="$( < /etc/mesos/zk)"
tmp="${mesos_master//zk:\/\/}"
zk_host="${tmp/\/*}"

flags+=( --master $mesos_master
--zk_hosts $zk_hosts )

heap=384m

java -Xmx"$heap" -Xms"$heap" -cp "$jar_file" \
com.airbnb.scheduler.Main \
--http_port 8080 --http_credentials user:pass
java -Xmx"$heap" -Xms"$heap" -cp "${jar_files[0]}" \
com.airbnb.scheduler.Main \
"${flags[@]}" \
--http_port $PORT0 #to enable http_simple_auth, use this option: --http_credentials user:pass
6 changes: 2 additions & 4 deletions bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ echo "$ip" > "$environment_directory"/LIBPROCESS_IP

jvm_options=( -cp "$app_jar" -server -Xmx"$heap" -Xms"$heap"
-XX:+PrintClassHistogram
-Dfile.encoding=UTF-8
-Djava.io.tmpdir=/tmp
-Ddw.hostname=$public_hostname)
)

app_options=( server /etc/chronos.yml )
app_options=( --hostname $public_hostname )


function start {
Expand Down
2 changes: 1 addition & 1 deletion bin/start-chronos.bash
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ source $build_env
popd

# Start chronos.
java -cp "$CHRONOS_HOME"/target/chronos*.jar com.airbnb.scheduler.Main server "$CHRONOS_HOME"/config/local_scheduler_nozk.yml
java -cp "$CHRONOS_HOME"/target/chronos*.jar com.airbnb.scheduler.Main
4 changes: 1 addition & 3 deletions bin/ubuntu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,14 @@ function chronos_build {
function chronos_runner {
cat > "$prefix"/bin/chronos <<EOF
export MESOS_NATIVE_LIBRARY='$prefix'/lib/libmesos.so
default='$prefix'/chronos/config/local_scheduler_nozk.yml
if [ "\$1" = "-h" ]
then
cat <<USAGE
USAGE: chronos
chronos /path/to/config
USAGE
else
java -cp '$prefix'/chronos/target/chronos*.jar com.airbnb.scheduler.Main \
server "\${1:-\$default}"
java -cp '$prefix'/chronos/target/chronos*.jar com.airbnb.scheduler.Main
fi
EOF
chmod a+rx "$prefix"/bin/chronos
Expand Down

0 comments on commit 2985faf

Please sign in to comment.