Skip to content

Instantly share code, notes, and snippets.

@pavelpatrin
Last active October 22, 2018 21:27
Show Gist options
  • Save pavelpatrin/d8ed6a9b15bc57554a7439609a00b738 to your computer and use it in GitHub Desktop.
Save pavelpatrin/d8ed6a9b15bc57554a7439609a00b738 to your computer and use it in GitHub Desktop.
Sentry bootstrap (MySQL, Redis, Docker, Systemd)
[root@li145-5 Sentry]# cat Dockerfile
FROM centos/systemd
CMD ["/usr/sbin/init"]
RUN yum install -y epel-release
RUN yum install -y redis
RUN systemctl enable redis
RUN yum install -y mariadb mariadb-server
RUN systemctl enable mariadb
RUN mysql_install_db --user=mysql 1>/dev/null 2>&1
RUN yum groupinstall -y "Development tools"
RUN yum install -y python python-devel python-pip MySQL-python
RUN pip install --upgrade pip
RUN pip install ipython
RUN pip install sentry
RUN sentry init
RUN echo $'\n\
DATABASES = {\n\
\'default\': {\n\
\'ENGINE\': \'django.db.backends.mysql\',\n\
\'NAME\': \'sentry\',\n\
\'USER\': \'sentry\',\n\
\'PASSWORD\': \'sentrypass\',\n\
\'HOST\': \'127.0.0.1\',\n\
\'PORT\': 3306,\n\
\'AUTOCOMMIT\': True,\n\
\'ATOMIC_REQUESTS\': False,\n\
}\n\
}' >> /root/.sentry/sentry.conf.py
RUN mysqld_safe & sleep 10; \
mysql -e 'CREATE USER sentry@localhost IDENTIFIED BY "sentrypass";'; \
mysql -e 'GRANT ALL PRIVILEGES ON *.* TO sentry@localhost;'; \
mysql -e 'CREATE DATABASE sentry CHARACTER SET utf8 COLLATE utf8_bin;'; \
mysqladmin shutdown
RUN mysqld_safe & redis-server /etc/redis.conf & sleep 10; \
sentry upgrade --noinput; \
mysqladmin shutdown
[root@li145-5 Sentry]# cat Makefile
rerun: kill rm build run exec
rebash: kill rm build bash
build:
docker build --tag sentry .
run:
docker run --privileged --detach --name sentry sentry
bash:
docker run --privileged -ti --name sentry sentry /bin/bash
exec:
docker exec -ti sentry /bin/bash
kill:
-docker kill sentry 1>/dev/null 2>&1
rm:
-docker rm sentry 1>/dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment