Skip to content

Instantly share code, notes, and snippets.

@mrbald
Forked from tristanbes/example.sh
Last active January 20, 2021 15:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrbald/74f77cda2ba62269e022b8ea72055d39 to your computer and use it in GitHub Desktop.
Save mrbald/74f77cda2ba62269e022b8ea72055d39 to your computer and use it in GitHub Desktop.
Install Graphite on a Debian Server
# Install graphite dependencies
apt-get install -y python3 python3-pip python3-cairo python3-django
apt-get install -y apache2 libapache2-mod-wsgi-py3
# Install graphite
pip3 install https://github.com/graphite-project/whisper/tarball/master
pip3 install https://github.com/graphite-project/carbon/tarball/master
pip3 install https://github.com/graphite-project/graphite-web/tarball/master
# Setup a vhost by grabbing the example the graphite team released on their repo.
# In this file, you'll provide the url used to access to your Graphite dashboard
wget https://github.com/graphite-project/graphite-web/blob/master/examples/example-graphite-vhost.conf -O /etc/apache2/sites-available/graphite.conf
perl -i -pe 's/\@DJANGO_ROOT\@/\/usr\/lib\/python3\/dist-packages\/django/g' /etc/apache2/sites-available/graphite.conf
WSGISocketPrefix /var/run/apache2/wsgi
# Configuring graphite
cd /opt/graphite/conf
cp graphite.wsgi.example graphite.wsgi
cp carbon.conf.example carbon.conf
cp storage-schemas.conf.example storage-schemas.conf
cp storage-aggregation.conf.example storage-aggregation.conf
# Let's go back to the installation process
django-admin.py makemigrations --settings=graphite.settings --pythonpath=/opt/graphite/webapp
django-admin.py migrate --run-syncdb --settings=graphite.settings --pythonpath=/opt/graphite/webapp
django-admin.py createsuperuser --settings=graphite.settings --pythonpath=/opt/graphite/webapp
django-admin.py collectstatic --noinput --settings=graphite.settings --pythonpath=/opt/graphite/webapp
chown -R www-data:www-data /opt/graphite/storage/
chown -R www-data:www-data /opt/graphite/static/
# Adjust dir permissions (in /etc/apache2/sites-enabled/graphite.conf
<Directory /opt/graphite/conf/>
Require all granted
</Directory>
<Directory /opt/graphite/static/>
Require all granted
</Directory>
# Enabling graphite host
a2ensite graphite
a2enmod wsgi
/opt/graphite/bin/carbon-cache.py start
systemctl restart apache2
@gabor-aranyossy
Copy link

gabor-aranyossy commented Jan 20, 2021

to get the raw config the url needs to be: https://raw.githubusercontent.com/graphite-project/graphite-web/master/examples/example-graphite-vhost.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment