Skip to content

Instantly share code, notes, and snippets.

@kobaltz
Created October 28, 2017 04:44
Show Gist options
  • Save kobaltz/d5d1749e79f16a36db3590d0852a9d14 to your computer and use it in GitHub Desktop.
Save kobaltz/d5d1749e79f16a36db3590d0852a9d14 to your computer and use it in GitHub Desktop.
# Install programs
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y python-virtualenv python-setuptools python-pip libxslt1-dev gcc
sudo apt-get install -y libffi-dev libjpeg-dev libxml2-dev libxslt-dev libyaml-dev python-dev
sudo apt-get install -y python-setuptools python-dev libxslt1-dev gcc libffi-dev libjpeg-dev
sudo apt-get install -y libxml2-dev libxslt-dev libyaml-dev libpq-dev postgresql
sudo apt-get install -y postgresql-server-dev-9.5 supervisor redis-server nginx htop
# Create a user to run Sentry
sudo adduser sentry
# Enter password
# Allow sentry to use sudo
sudo adduser sentry sudo
# Create a postgres user matching the newly created sentry user:
sudo su - postgres
psql template1
create user sentry with password 'sentry'; # <--- this is your db password
create database sentrydb with owner sentry;
\q
# This step is important. Otherwise sentry upgrade will fail.
psql sentrydb
create extension citext;
\q
exit
# Switch to the newly created user
sudo su - sentry
# Pick a location for the environment and create it:
virtualenv ~/sentry_app/
# Source the environment and use this whenever you want to run the sentry command
# sudo su - sentry
source ~/sentry_app/bin/activate
# Begin the Sentry installation:
pip install -U sentry
# Initialize the sentry config files, this will create a config directory of ~/.sentry:
sentry init
# Modify the sentry.conf.py file with the Postgresql information created above:
nano ~/.sentry/sentry.conf.py
DATABASES = {
'default': {
'ENGINE': 'sentry.db.postgres',
'NAME': 'sentrydb',
'USER': 'sentry',
'PASSWORD': 'sentry', # <-- or whatever you set with the psql command
'HOST': 'localhost',
'PORT': '5432',
}
}
# Run the database migration scripts.
# At the end of this process it’ll ask you to create a user, do so and make it a superuser:
sentry upgrade
# Exit out of the Sentry user and create a startup script for supervisord.
exit
sudo nano /etc/supervisor/conf.d/sentry.conf
# Paste the following into the sentry.conf supervisor file:
[program:sentry-web]
directory=/home/sentry/sentry_app/
environment=SENTRY_CONF="/home/sentry/.sentry"
command=/home/sentry/sentry_app/bin/sentry run web
autostart=true
autorestart=true
redirect_stderr=true
user=sentry
stdout_logfile=syslog
stderr_logfile=syslog
[program:sentry-worker]
directory=/home/sentry/sentry_app/
environment=SENTRY_CONF="/home/sentry/.sentry"
command=/home/sentry/sentry_app/bin/sentry run worker
autostart=true
autorestart=true
redirect_stderr=true
user=sentry
stdout_logfile=syslog
stderr_logfile=syslog
[program:sentry-cron]
directory=/home/sentry/sentry_app/
environment=SENTRY_CONF="/home/sentry/.sentry"
command=/home/sentry/sentry_app/bin/sentry run cron
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=syslog
stderr_logfile=syslog
# Save, exit, and tell supervisor to update:
sudo supervisorctl reread
sudo supervisorctl update
# Check on the status of the components by running:
sudo supervisorctl
status
# Update NGINX config - https://docs.sentry.io/server/nginx/
sudo nano /etc/nginx/sites-enabled/default
# use the following location
location / {
proxy_pass http://localhost:9000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Configure Email if needed in
/home/sentry/.sentry/config.yml
# Removing Old Data
crontab -e
0 3 * * * sentry cleanup --days=30
# NOW you can access http://yourip/auth/login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment