Skip to content

Instantly share code, notes, and snippets.

@cwilby
Last active December 19, 2023 20:26
Show Gist options
  • Save cwilby/8eb42a224ac3d87f1deaf5a53720ac2b to your computer and use it in GitHub Desktop.
Save cwilby/8eb42a224ac3d87f1deaf5a53720ac2b to your computer and use it in GitHub Desktop.
#!/bin/bash
echo 'Installing Grafana-SMS...'
# Creates folder, sets permissions to current user, and changes directory
sudo mkdir /usr/local/share/grafana-sms
sudo chown $(whoami): /usr/local/share/grafana-sms
cd /usr/local/share/grafana-sms
# Downloads the latest release of Grafana-SMS
wget https://github.com/cwilby/grafana-sms/archive/refs/heads/main.zip
# Unzips the downloaded file, removes the zip file, and moves the contents of the unzipped folder to the current directory
unzip main.zip
rm main.zip
mv grafana-sms-main/* .
mv grafana-sms-main/.gitignore .
rmdir grafana-sms-main # cleanup
# Asks for Twilio credentials and stores them in an .env file
read -p "Enter the token used to authenticate with NodeRED in exchange for Twilio credentials: " nodered_token
echo "NODERED_TOKEN=$nodered_token" > .env
# Installs dependencies and sets up systemd service
npm install
sudo cp /usr/local/share/grafana-sms/grafana-sms.service /etc/systemd/system/grafana-sms.service
sudo systemctl start grafana-sms # start service
sudo systemctl enable grafana-sms # enable service on boot
# Health check
sleep 5
curl http://localhost:32012
echo 'Grafana-SMS has been installed successfully!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment