Help us understand the problem. What is going on with this article?

Sentryをローカル環境で立ち上げる(docker-compose 編)

More than 1 year has passed since last update.

エラーモニタリングサービスであるSentryはOSSで公開されていて、公式の手順に沿えば、誰でも構築できる。とはいえ、ちょっとした挙動確認をしたいときに公式の手順だと不便なので、docker-compose.ymlにまとめた。

設定ファイルは次の通り。

docker-compose.yml

version: '3'
services:
  sentry:
    container_name: sentry
    image: sentry
    env_file:
      - .env
    ports:
      - '9000:9000'
    depends_on:
      - db
      - redis
    tty: true
    stdin_open: true
  cron:
    container_name: sentry-cron
    image: sentry
    command: run cron
    env_file:
      - .env
    depends_on:
      - db
      - redis
  worker:
    container_name: sentry-worker
    image: sentry
    command: run worker
    env_file:
      - .env
    depends_on:
      - db
      - redis
  redis:
    container_name: sentry-redis
    image: redis
    volumes:
      - redis-data:/data
    ports:
      - '6379:6379'
  db:
    container_name: sentry-postgres
    image: postgres
    environment:
      POSTGRES_USER: sentry
      POSTGRES_PASSWORD: secret
    volumes:
      - pg-data:/var/lib/postgresql/data
    ports:
      - '5432:5432'
volumes:
  redis-data:
  pg-data:

.env

SENTRY_POSTGRES_HOST=db
SENTRY_POSTGRES_PORT=5432
SENTRY_DB_USER=sentry
SENTRY_DB_PASSWORD=secret
SENTRY_REDIS_HOST=redis
SENTRY_REDIS_PORT=6379
SENTRY_SECRET_KEY=***YOUR_SECRET_KEY***

ビルド手順

# 秘密鍵の生成: 生成後 .env の SENTRY_SECRET_KEY にセットする
$ docker-compose run --rm sentry config generate-secret-key

# DB初期化と初期ユーザーの作成
$ docker-compose run --rm sentry upgrade

# 起動: http://localhost:9000でアクセス可能
$ docker-compose up -d

なお、次のリポジトリをチェックアウトすれば、Dockerに慣れていない場合でも、5分程度でセットアップできる(はず)

yhirano55/sentry-docker-compose

参考

本記事のdocker-compose.ymlは、Sentryの公式イメージの「How to setup a full Sentry instance」をまとめたので、不明点があればそちらを確認してほしい。

https://hub.docker.com/_/sentry/

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした