All Downloads are FREE. Search and download functionalities are using the official Maven repository.

flint_2.12.1.2.6.source-code.user_data-common.sh.template Maven / Gradle / Ivy

The newest version!
cat << EOF > /etc/modprobe.d/netfilter.conf
alias ip_tables off
alias iptable off
alias iptable_nat off
alias iptable_filter off
alias x_tables off
alias nf_nat off
alias nf_conntrack_ipv4 off
alias nf_conntrack off
alias xt_conntrack off
EOF

hostname $(hostname).ec2.internal

mkdir /root/.aws

cat << EOF > /root/.aws/config
[default]
region = %AWS_REGION%
EOF

aws ec2 create-tags --resources $(curl -s http://169.254.169.254/latest/meta-data/instance-id) \
  --tags Key=Name,Value="%NAME_TAG_VALUE%" \
         Key=%CLUSTER_ID_TAG_KEY%,Value=%CLUSTER_ID_TAG_VALUE% \
         Key=%CLUSTER_NAME_TAG_KEY%,Value="%CLUSTER_NAME_TAG_VALUE%" \
         Key=%SPARK_ROLE_TAG_KEY%,Value=%SPARK_ROLE_TAG_VALUE% %EXTRA_INSTANCE_TAGS%

/usr/bin/time yum -y update 2> /tmp/yum_update_time.txt

yum -y install amazon-ssm-agent && start amazon-ssm-agent

stop_script=/sbin/stop-spark-container.sh

cat << EOF > $stop_script
#!/bin/bash

set -e

instance_id=\$(curl -s http://169.254.169.254/latest/meta-data/instance-id)

if [ \$(docker ps -f name=spark -q | wc -l) -eq 1 ]; then
  aws ec2 create-tags --resources \$instance_id --tags Key=%CONTAINER_STATE_TAG_KEY%,Value=%CONTAINER_STOPPING_STATE_TAG_VALUE%
  docker stop spark
fi

if [ \$(docker ps -f name=spark -q -a | wc -l) -eq 1 ]; then
  docker rm spark
fi

aws ec2 delete-tags --resources \$instance_id --tags Key=%DOCKER_IMAGE_TAG_KEY%
aws ec2 create-tags --resources \$instance_id --tags Key=%CONTAINER_STATE_TAG_KEY%,Value=%CONTAINER_STOPPED_STATE_TAG_VALUE%
EOF

chmod 755 $stop_script

echo "fs.file-max = 100000" >> /etc/sysctl.conf
sysctl -p

yum -y install docker

cat << EOF > /root/.dockercfg
{
  "https://index.docker.io/v1/": {
    "auth": "%DOCKER_AUTH%",
    "email": "%DOCKER_EMAIL%"
  }
}
EOF

echo 'OPTIONS="${OPTIONS} --iptables=false"' >> /etc/sysconfig/docker

service docker start

docker run --name=netdata -d --net=host \
  --cap-add SYS_PTRACE \
  -v /proc:/host/proc:ro -v /sys:/host/sys:ro \
  -p 19999:19999 \
  titpetric/netdata

start_script=/sbin/start-spark-container.sh

cat << EOF > $start_script
#!/bin/bash

set -e

if [ \$# -eq 1 ]; then
  image=\$1
else
  image=%DOCKER_IMAGE_VALUE%
fi

instance_id=\$(curl -s http://169.254.169.254/latest/meta-data/instance-id)

aws ec2 create-tags --resources \$instance_id \
  --tags Key=%DOCKER_IMAGE_KEY%,Value=\$image \
         Key=%CONTAINER_STATE_TAG_KEY%,Value=%CONTAINER_PENDING_STATE_TAG_VALUE%
/usr/bin/time docker pull \$image 2> /tmp/docker_pull_time.txt

EOF




© 2015 - 2024 Weber Informatics LLC | Privacy Policy