-
-
Save ChrisMcKee/d4db567bcd1b36777f66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo ' | |
### | |
# Welcome to graphite creator | |
### | |
!!! | |
! THIS WILL REMOVE /var/www - MAKE SURE YOU WANT TO DO THIS! | |
!!! | |
You will need two domains mapped to this server. The first one runs graphite, the second one the grafana web-frontend. | |
Please enter just the domain, without http:// or trailing slash. (grafana.example.org) | |
domain of graphite: ' | |
read graphite_url | |
echo 'domain of grafana: ' | |
read grafana_url | |
apt-get update && sudo apt-get dist-upgrade -y | |
apt-get install graphite-carbon graphite-web apache2 libapache2-mod-wsgi curl | |
echo 'CARBON_CACHE_ENABLED=true' >> /etc/default/graphite-carbon | |
service carbon-cache start | |
graphite-manage syncdb | |
chown _graphite:_graphite /var/lib/graphite/graphite.db | |
tee /etc/apache2/sites-available/graphite-web.conf <<DELIM | |
<VirtualHost *:80> | |
Header set Access-Control-Allow-Origin "http://$grafana_url" | |
Header set Access-Control-Allow-Methods "GET, OPTIONS" | |
Header set Access-Control-Allow-Headers "origin, authorization, accept" | |
ServerName $graphite_url | |
DELIM | |
grep -E "^\s" /usr/share/graphite-web/apache2-graphite.conf >> /etc/apache2/sites-available/graphite-web.conf | |
echo '</VirtualHost>' >> /etc/apache2/sites-available/graphite-web.conf | |
a2ensite graphite-web | |
a2enmod headers | |
service apache2 restart | |
rm -rf /var/www | |
curl http://grafanarel.s3.amazonaws.com/grafana-1.8.1.tar.gz | tar xvzf - --strip-components=1 -C /var/www | |
cp /var/www/config.sample.js /var/www/config.js | |
sed -i s/my.graphite.server.com/$graphite_url/g config.js | |
echo ' | |
All done! Happy graphing ... ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment