Skip to content

Instantly share code, notes, and snippets.

@pavelpatrin
Last active October 22, 2018 21:27
Show Gist options
  • Select an option

  • Save pavelpatrin/d8ed6a9b15bc57554a7439609a00b738 to your computer and use it in GitHub Desktop.

Select an option

Save pavelpatrin/d8ed6a9b15bc57554a7439609a00b738 to your computer and use it in GitHub Desktop.

Revisions

  1. pavelpatrin renamed this gist Oct 22, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. pavelpatrin renamed this gist Oct 22, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. pavelpatrin created this gist Oct 22, 2018.
    69 changes: 69 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,69 @@
    [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