フロントエンドのエラーログモニタリングサービスSentoryをMacのdocker-composeでサクッと立ち上げて起動するまでの手順

MacツールインストールDocker
フロントエンドのエラーログモニタリングサービスSentoryをMacのdocker-composeでサクッと立ち上げて起動するまでの手順
Memo
この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

フロントエンドのエラーログモニタリングサービスSentoryをMacのdocker-composeでサクッと立ち上げて起動するまでの手順をメモしました。

Sentry(セントリー)

Sentryとは?

Sentryとは、フロントエンドのエラー監視ツールになります。
エラーログや日時、ユーザーの情報、ブラウザや端末の情報などを集積し
GUIでログの確認を行うことができます。

Sntoryの特徴

  • Sentryは様々なプラットフォームで利用が可能
  • ユーザーデータ(UA、OS)やユーザー行動ログに応じたエラーを検証することができる
  • プロジェクトごとにエラーのチケットを管理することができる

公式サイト

やること

環境

  • Mac OS Big SUR 11.3.1
  • Docker 20.10.2
  • docker-compose 1.25.0

要件

実際に利用するにはそこそこのスペックが必要になります。

  • Docker 19.03.6+
  • Compose 1.24.1+
  • 4 CPU Cores
  • 8 GB RAM
  • 20 GB Free Disk Space

Sentryのインストール

githubからclone

setsentry/onpremiseのリポジトリからソースコードをクローンします。

terminal
$ git clone https://github.com/getsentry/onpremise.git

cloneしたonpremiseディレクトリへ移動

cloneしたonpremiseディレクトリへ移動します。

terminal
$ cd onpremise

インストールスクリプトを実行

インストールスクリプトである./install.shを実行します。

terminal
$ ./install.sh ./install/_lib.sh: line 15: realpath: command not found

realpathコマンドが見つからないエラー

realpathコマンドが見つからないエラーが発生しました。

realpath: command not found

realpathが入っているcoreutilsをインストール

Homebrewで realpathが入っているGNU Linux coreutils をいれます。

terminal
$ brew install coreutils

再度インストールスクリプトを実行

再度インストールスクリプトを実行します。

terminal
$ ./install.sh

メモリ不足エラー

今度はメモリが不足しているというエラーが発生しました。

terminal
FAIL: Required minimum RAM available to Docker is 3800 MB, found 2993 MB

メッセージを確認する限り最低4G必要なようです。

dockerのメモリ設定変更

dockerのメモリ設定を4Gへ変更します。
dockerのメモリ設定を4Gへ変更

再度インストールスクリプトを実行

再度インストールスクリプトを実行します。

terminal
$ ./install.sh

アカウント作成

アカウント作成の有無を問われるので必要に応じて回答します。

terminal
Would you like to create a user account now? [Y/n]:

Emailの入力

アカウント作成へYと回答するとアカウントを作成します。 Emailを入力して実行します。

terminal
Email:

Passwordの入力

続いてPasswordの入力を求めらるので入力して実行します。

terminal
Password

しばらくするとインストールが完了し下記のメッセージが表示されいます。


-----------------------------------------------------------------

You're all done! Run the following command to get Sentry running:

  docker-compose up -d

-----------------------------------------------------------------

Sentryの起動

docker-compose upでSentryを起動

docker-compose upコマンドでSentryを起動します。

terminal
$ docker-compose up -d //中略 Starting sentry_onpremise_zookeeper_1 ... done Starting sentry_onpremise_memcached_1 ... done Starting sentry_onpremise_symbolicator_1 ... done Starting sentry_onpremise_clickhouse_1 ... done Starting sentry_onpremise_postgres_1 ... done Starting sentry_onpremise_redis_1 ... done Starting sentry_onpremise_smtp_1 ... done Creating sentry_onpremise_symbolicator-cleanup_1 ... done Creating sentry_onpremise_geoipupdate_1 ... done Starting sentry_onpremise_kafka_1 ... done Starting sentry_onpremise_snuba-sessions-consumer_1 ... done Starting sentry_onpremise_snuba-subscription-consumer-events_1 ... done Starting sentry_onpremise_snuba-api_1 ... done Starting sentry_onpremise_snuba-subscription-consumer-transactions_1 ... done Starting sentry_onpremise_snuba-outcomes-consumer_1 ... done Starting sentry_onpremise_snuba-consumer_1 ... done Starting sentry_onpremise_snuba-replacer_1 ... done Starting sentry_onpremise_snuba-transactions-consumer_1 ... done Creating sentry_onpremise_snuba-transactions-cleanup_1 ... done Creating sentry_onpremise_snuba-cleanup_1 ... done Creating sentry_onpremise_ingest-consumer_1 ... done Creating sentry_onpremise_cron_1 ... done Creating sentry_onpremise_web_1 ... done Creating sentry_onpremise_subscription-consumer-transactions_1 ... done Creating sentry_onpremise_sentry-cleanup_1 ... done Creating sentry_onpremise_subscription-consumer-events_1 ... done Creating sentry_onpremise_worker_1 ... done Creating sentry_onpremise_post-process-forwarder_1 ... done Creating sentry_onpremise_relay_1 ... done Creating sentry_onpremise_nginx_1 ... done

Sentry起動の確認

docker psコマンドでSentryの起動を確認します。
ものすごい数のコンテナが立ち上がっています。

terminal
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d1af99d79486 nginx:1.21.0-alpine "/docker-entrypoint.…" 2 minutes ago Up 2 minutes 0.0.0.0:9000->80/tcp, :::9000->80/tcp sentry_onpremise_nginx_1 31bd40c2d0b1 getsentry/relay:nightly "/bin/bash /docker-e…" 3 minutes ago Up 2 minutes 3000/tcp sentry_onpremise_relay_1 96946f054f97 getsentry/sentry:nightly "/etc/sentry/entrypo…" 3 minutes ago Up 3 minutes 9000/tcp sentry_onpremise_web_1 142cbe99bcab getsentry/sentry:nightly "/etc/sentry/entrypo…" 3 minutes ago Up 3 minutes 9000/tcp sentry_onpremise_post-process-forwarder_1 a73d30ffeecf getsentry/sentry:nightly "/etc/sentry/entrypo…" 3 minutes ago Up 3 minutes 9000/tcp sentry_onpremise_worker_1 53710796c597 sentry-cleanup-onpremise-local "/entrypoint.sh '0 0…" 3 minutes ago Up 3 minutes 9000/tcp sentry_onpremise_sentry-cleanup_1 0fc66120b6e7 getsentry/sentry:nightly "/etc/sentry/entrypo…" 3 minutes ago Up 3 minutes 9000/tcp sentry_onpremise_subscription-consumer-events_1 6660c44c85d3 getsentry/sentry:nightly "/etc/sentry/entrypo…" 3 minutes ago Up 3 minutes 9000/tcp sentry_onpremise_subscription-consumer-transactions_1 1178f9de7dcb getsentry/sentry:nightly "/etc/sentry/entrypo…" 3 minutes ago Up 3 minutes 9000/tcp sentry_onpremise_ingest-consumer_1 247403b0cf0a getsentry/sentry:nightly "/etc/sentry/entrypo…" 3 minutes ago Up 3 minutes 9000/tcp sentry_onpremise_cron_1 2485d8b09449 snuba-cleanup-onpremise-local "/entrypoint.sh '*/5…" 3 minutes ago Up 3 minutes 1218/tcp sentry_onpremise_snuba-transactions-cleanup_1 3cdd89173e06 snuba-cleanup-onpremise-local "/entrypoint.sh '*/5…" 3 minutes ago Up 3 minutes 1218/tcp sentry_onpremise_snuba-cleanup_1 35672074e478 symbolicator-cleanup-onpremise-local "/entrypoint.sh '55 …" 4 minutes ago Up 3 minutes 3021/tcp sentry_onpremise_symbolicator-cleanup_1 d0f963485d02 getsentry/snuba:nightly "./docker_entrypoint…" 9 minutes ago Up 3 minutes 1218/tcp sentry_onpremise_snuba-api_1 e9b9a080ae5b getsentry/snuba:nightly "./docker_entrypoint…" 9 minutes ago Up 2 minutes 1218/tcp sentry_onpremise_snuba-outcomes-consumer_1 761ef79ae530 getsentry/snuba:nightly "./docker_entrypoint…" 9 minutes ago Up 3 minutes 1218/tcp sentry_onpremise_snuba-replacer_1 5670be83129d getsentry/snuba:nightly "./docker_entrypoint…" 9 minutes ago Up About a minute 1218/tcp sentry_onpremise_snuba-subscription-consumer-transactions_1 0f855d1ee7d4 getsentry/snuba:nightly "./docker_entrypoint…" 9 minutes ago Up About a minute 1218/tcp sentry_onpremise_snuba-consumer_1 7c3727466982 getsentry/snuba:nightly "./docker_entrypoint…" 9 minutes ago Up About a minute 1218/tcp sentry_onpremise_snuba-transactions-consumer_1 5ce98cc4b2ae getsentry/snuba:nightly "./docker_entrypoint…" 9 minutes ago Up 3 minutes 1218/tcp sentry_onpremise_snuba-subscription-consumer-events_1 0ce211d4efc9 getsentry/snuba:nightly "./docker_entrypoint…" 9 minutes ago Up About a minute 1218/tcp sentry_onpremise_snuba-sessions-consumer_1 7fa51fba889b postgres:9.6 "/opt/sentry/postgre…" 9 minutes ago Up 3 minutes (healthy) 5432/tcp sentry_onpremise_postgres_1 81956699bb54 memcached:1.6.9-alpine "docker-entrypoint.s…" 9 minutes ago Up 4 minutes (healthy) 11211/tcp sentry_onpremise_memcached_1 4e57cfe13532 getsentry/symbolicator:nightly "/bin/bash /docker-e…" 9 minutes ago Up 3 minutes 3021/tcp sentry_onpremise_symbolicator_1 c65e4f13f9a4 tianon/exim4 "docker-entrypoint.s…" 9 minutes ago Up 3 minutes 25/tcp sentry_onpremise_smtp_1 d23c00d76349 confluentinc/cp-kafka:5.5.0 "/etc/confluent/dock…" 10 minutes ago Up 3 minutes (healthy) 9092/tcp sentry_onpremise_kafka_1 8bbb79e2d190 yandex/clickhouse-server:20.3.9.70 "/entrypoint.sh" 10 minutes ago Up 3 minutes 8123/tcp, 9000/tcp, 9009/tcp sentry_onpremise_clickhouse_1 f4f40b5dd5fe redis:6.2.4-alpine "docker-entrypoint.s…" 10 minutes ago Up 3 minutes (healthy) 6379/tcp sentry_onpremise_redis_1 5ff06b679111 confluentinc/cp-zookeeper:5.5.0 "/etc/confluent/dock…" 10 minutes ago Up 3 minutes (healthy) 2181/tcp, 2888/tcp, 3888/tcp sentry_onpremise_zookeeper_1

Sentryへアクセス

ブラウザからSentryを開く

http://localhost:9000へブラウザからアクセスしSentryを開きます。

ブラウザからSentryを開く

ログイン画面が表示されたらインストールは成功です。

SentryのSetup

Sentoryの初期設定を実施します。

ログイン

続いてインストール時に登録したユーザー情報を入力しログインします。

Setup情報の入力

Setup情報の入力|Sentry

Root URL

Sentoryを利用するURLを指定します。

Admin Email

管理者のメールアドレスを登録します。

Outbound email

SMTPサーバーの設定をします。
詳しくはこちらをご確認ください。

Beacon

使用統計(Usage Statistics)の情報を送信するかどうかの設定です。

Send my contact information along with usage statistics

送信する場合はこちらを選択します。

Please keep my usage information anonymous

送信しない場合はこちらを選択します。

入力が完了したらContinueをクリックします。

Sentryのダッシュボード

ダッシュボードが表示されたらSentryのSetupは完了です。

ダッシュボードが表示|Sentry

終わりに

最後までご覧いただきありがとうございます。
この記事ではフロントエンドのエラーログモニタリングサービスSentoryをMacのdocker-composeでサクッと立ち上げて起動するまでの手順について紹介させていただきました。

これからも皆様の開発に役立つ情報を提供していきたいと考えています。
今後ともよろしくお願いいたします。