Notes
Notes - notes.io |
echo "Validating minimum requirements"
OS_VERSION=$(cat /etc/os-release | grep ^VERSION_ID | cut -d'=' -f 2- )
OS_TYPE=$(cat /etc/os-release | grep ^NAME | cut -d'=' -f 2- )
if [[ $OS_TYPE == "Ubuntu" ]]
then
if [[ ${OS_VERSION:1:2} -lt 18 ]]
then
echo "FAILED: OS check for Ubuntu"
echo "Device does not meet minimum OS requirements"
exit 1
fi
elif [[ $OS_TYPE == "Oracle Linux Server" ]]
then
if [[ ${OS_VERSION:1:1} -lt 7 ]]
then
echo "FAILED: OS check for Oracle Linux"
echo "Device does not meet minimum OS requirements"
exit 1
fi
else
echo "PASS: OS check "
fi
cpu_count=$(nproc --all)
if [[ $cpu_count -lt 8 ]]
then
echo "FAILED: vCPUs check for minimum 8 core"
echo "Device does not meet minimum vcpu requirements"
exit 1
else
echo "PASS: vCPUs check"
fi
total_mem=$(cat /proc/meminfo| awk '/MemTotal/ {print $2}')
total_mem_gb=$(($total_mem/1024/1024))
if [[ $total_mem_gb -lt 4 && $total_mem_gb -gt 3 ]]
then
echo "WARNING: Low memory on the machine, Please increase it to 4GB minimum."
elif [[ $total_mem_gb -lt 3 ]]
then
echo "FAILED: Memory check for minimum 4 GB RAM"
echo "Device does not meet minimum memory requirements"
exit 1
else
echo "PASS: Memory check "
fi
validate_input() {
if [[ -z $1 ]]
then
echo "Input cannot be blank, please try again!"
exit 1
fi
}
read -p "Enter the CBC cloud URL: " cbc_url
validate_input $cbc_url
read -p "Enter the API id: " api_id
validate_input $api_id
read -sp "Enter the API key: " api_key
validate_input $api_key
echo
read -p "Enter the mount path with free storage > 20GB, [/data]" volume_mount_path
volume_mount_path=${volume_mount_path:-/data}
mkdir -p $volume_mount_path/logs
read -p 'Enter the port number to map sensor-gateway service [443]: ' port_number
port_number=${port_number:-443}
read -p "Enter the sensor gateway entry point url: " sensor_gw_entry_point
validate_input $sensor_gw_entry_point
if [[ $1 == "--dev" ]]
then
sgw_image="harbor-repo.vmware.com/sbu/psc/sensor_gateway/sensor-gateway-mgmt-service:e32bb36d"
else
#update below image with customer facing harbor repo image
sgw_image="projects.registry.vmware.com/sensor_gateway/sensor-gateway-mgmt-service:0.1.0"
fi
sensor_gw_host_ip=$(hostname -I | cut -f1 -d' ')
echo "Creating docker volume.."
docker volume inspect sgw-volume > /dev/null 2>&1
if [[ $? -ne 0 ]]
then
docker volume create -o o=bind -o type=none -o device=$volume_mount_path sgw-volume
else
echo "Volume is already created...skipping"
fi
echo "Creating docker network.."
docker network inspect sgw-network > /dev/null 2>&1
if [[ $? -ne 0 ]]
then
docker network create sgw-network
else
echo "network is already created...skipping"
fi
docker pull $sgw_image
if [[ ! -d /etc/docker ]]
then
mkdir /etc/docker
fi
cat << EOF >> /etc/docker/daemon.json
{
"log-driver": "json-file",
"log-opts": {
"max-size": "50m",
"max-file": "4"
}
}
EOF
sudo systemctl restart docker
echo "Running commands to increase system-wide open file limits in Ubuntu"
echo "* soft nproc 100000" >> /etc/security/limits.conf
echo "* hard nproc 100000" >> /etc/security/limits.conf
echo "* soft nofile 100000" >> /etc/security/limits.conf
echo "* hard nofile 100000" >> /etc/security/limits.conf
echo "root soft nproc 100000" >> /etc/security/limits.conf
echo "root hard nproc 100000" >> /etc/security/limits.conf
echo "root soft nofile 100000" >> /etc/security/limits.conf
echo "root hard nofile 100000" >> /etc/security/limits.conf
if [[ $OS_TYPE == "Ubuntu" ]]
then
echo "session required pam_limits.so" >> /etc/pam.d/common-session
else
echo "session required pam_limits.so" >> /etc/pam.d/login
fi
echo "fs.file-max = 2097152" >> /etc/sysctl.conf
echo "Running sysctl command on the sensor-gateway"
sysctl -p
echo "creating a docker container from above docker image"
echo "Executing command: ==> docker run -d -v sgw-volume:/data -p $port_number:443 -p 80:80 --restart=always --network=sgw-network -e SENSOR_GATEWAY_HOST_IP=$sensor_gw_host_ip -e CBC_URL=$cbc_url -e API_ID=$api_id -e API_KEY=$api_key -e SENSOR_GATEWAY_ENTRY_POINT=$sensor_gw_entry_point $sgw_image"
docker run -d -v sgw-volume:/data -p $port_number:443 -p 80:80
--restart=always
--network=sgw-network
-e CBC_URL=$cbc_url
-e SENSOR_GATEWAY_HOST_IP=$sensor_gw_host_ip
-e API_ID=$api_id
-e API_KEY=$api_key
-e SENSOR_GATEWAY_ENTRY_POINT=$sensor_gw_entry_point $sgw_image
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team