Yet again double quotes variable issue

This commit is contained in:
Luis Guzmán 2020-07-04 05:05:59 -05:00
parent fb00d603e6
commit 40f78f1477
1 changed files with 34 additions and 14 deletions

View File

@ -17,27 +17,35 @@ PUBLIC_IP="$(dig -4 @resolver1.opendns.com ANY myip.opendns.com +short)"
# Min requirements # Min requirements
apt update && apt install -y gnupg2 curl wget jq apt update && apt install -y gnupg2 curl wget jq
echo "# Setup InfluxDB Packages" echo "
# Setup InfluxDB Packages
"
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add - wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
apt update && apt install influxdb -y apt update && apt install influxdb -y
systemctl enable --now influxdb systemctl enable --now influxdb
systemctl status influxdb systemctl status influxdb
echo "# Setup Grafana Packages" echo "
# Setup Grafana Packages
"
curl -s https://packages.grafana.com/gpg.key | sudo apt-key add - curl -s https://packages.grafana.com/gpg.key | sudo apt-key add -
add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
apt update && apt install grafana -y apt update && apt install grafana -y
systemctl enable --now grafana-server systemctl enable --now grafana-server
systemctl status grafana-server systemctl status grafana-server
echo "# Setup Telegraf Packages" echo "
# Setup Telegraf Packages
"
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add - wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
apt update && apt install telegraf -y apt update && apt install telegraf -y
mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.conf.original mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.conf.original
echo "# Setup Telegraf config files" echo "
# Setup Telegraf config files
"
cat << TELEGRAF > $MAIN_TEL cat << TELEGRAF > $MAIN_TEL
[global_tags] [global_tags]
@ -86,29 +94,41 @@ cat << JITSI_TELEGRAF > $TEL_JIT
JITSI_TELEGRAF JITSI_TELEGRAF
systemctl enable --now telegraf systemctl enable telegraf
systemctl restart telegraf
systemctl status telegraf systemctl status telegraf
echo "# Setup videobridge options" echo "
# Setup videobridge options
"
sed -i "s|JVB_OPTS=\"--apis.*|JVB_OPTS=\"--apis=rest,xmpp\"|" /etc/jitsi/videobridge/config sed -i "s|JVB_OPTS=\"--apis.*|JVB_OPTS=\"--apis=rest,xmpp\"|" /etc/jitsi/videobridge/config
sed -i "s|TRANSPORT=muc|TRANSPORT=muc,colibri|" /etc/jitsi/videobridge/sip-communicator.properties sed -i "s|TRANSPORT=muc|TRANSPORT=muc,colibri|" /etc/jitsi/videobridge/sip-communicator.properties
systemctl restart jitsi-videobridge2 systemctl restart jitsi-videobridge2
echo "# Setup Grafana credentials." echo "
# Setup Grafana credentials.
"
# Reset Grafana admin password # Reset Grafana admin password
curl -X PUT -H "Content-Type: application/json" -d '{ #grafana-cli admin reset-admin-password $GRAFANA_PASS
"oldPassword": "admin", set -x
"newPassword": "$GRAFANA_PASS", curl -X PUT -H "Content-Type: application/json" -d "{
"confirmNew": "$GRAFANA_PASS" \"oldPassword\": \"admin\",
}' http://admin:admin@localhost:3000/api/user/password \"newPassword\": \"$GRAFANA_PASS\",
\"confirmNew\": \"$GRAFANA_PASS\"
}" http://admin:admin@localhost:3000/api/user/password
set +x
echo "# Create InfluxDB datasource" echo "
# Create InfluxDB datasource
"
curl "http://admin:$GRAFANA_PASS@localhost:3000/api/datasources" -X \ curl "http://admin:$GRAFANA_PASS@localhost:3000/api/datasources" -X \
POST -H 'Content-Type: application/json;charset=UTF-8' \ POST -H 'Content-Type: application/json;charset=UTF-8' \
--data-binary \ --data-binary \
'{"name":"InfluxDB","type":"influxdb","url":"http://localhost:8086","access":"proxy","isDefault":true,"database":"jitsi"}' '{"name":"InfluxDB","type":"influxdb","url":"http://localhost:8086","access":"proxy","isDefault":true,"database":"jitsi"}'
echo "# Add Grafana Dashboard" echo "
# Add Grafana Dashboard
"
grafana_host="http://localhost:3000" grafana_host="http://localhost:3000"
grafana_cred="admin:$GRAFANA_PASS" grafana_cred="admin:$GRAFANA_PASS"
grafana_datasource="InfluxDB" grafana_datasource="InfluxDB"