Skip to content

Instantly share code, notes, and snippets.

@leejsinclair
Last active December 31, 2021 00:50
Show Gist options
  • Save leejsinclair/0c766f2f2d79de732312 to your computer and use it in GitHub Desktop.
Save leejsinclair/0c766f2f2d79de732312 to your computer and use it in GitHub Desktop.
Sentry via docker #docker
#!/bin/bash
# Variables
IP=$(ifconfig | grep 192 | awk '/inet addr/{print substr($2,6)}')
echo "*"
echo "* CREATING PRIVATE SENTRY ENVIRONMENT"
echo "*"
echo "* Docker UI: http://$IP:9000"
echo "* Senry UI: http://$IP:80"
echo "*"
# Setup
mkdir -p ~/sentry
mkdir -p ~/sentry/data
mkdir -p ~/sentry/postgresql
mkdir -p ~/sentry/redis
# environment file
echo "DATABASE_URL=postgres://sentry:sentry@postgresdb/sentry" | tee ~/environment
echo "SENTRY_REDIS_HOST=setry-redis" | tee -a ~/environment
# Stop existing containers
echo "Stopping / cleaning up containers"
docker kill $(docker ps -q)
docker rm $(docker ps -a -q)
# Docker UI
docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock dockerui/dockerui
# Postgress
docker run --name sentry-postgresql -d \
--env 'DB_NAME=sentry' \
--env 'DB_USER=sentry' --env 'DB_PASS=sentry' \
--volume ~/sentry/postgresql:/var/lib/postgresql \
sameersbn/postgresql
# Redis
docker run --name sentry-redis -d \
--volume ~/sentry/redis:/var/lib/redis \
sameersbn/redis:latest
# Sentry
docker run -d --name sentry-app \
--link sentry-redis:redis \
--link sentry-postgresql:postgresdb \
--volume=~/sentry/data:/data \
-p 80:9000 \
--env 'SECRET_KEY=gobble' \
--env 'SENTRY_URL_PREFIX=http://$IP' \
--env 'SENTRY_ADMIN_USERNAME=admin' \
--env 'SENTRY_ADMIN_PASSWORD=sentry' \
--env 'SENTRY_ADMIN_EMAIL=some-name@gmail.com' \
--env 'CACHE_URL=hiredis://redis:6379/2/' \
--env 'EMAIL_USE_TLS=True' \
--env "EMAIL_HOST='smtp.gmail.com'" \
--env "EMAIL_HOST_USER='some-name@gmail.com'" \
--env "EMAIL_HOST_PASSWORD='some-password'" \
--env 'EMAIL_PORT=587' \
--env-file=~/environment \
slafs/sentry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment