From edfe1492e288bc7343aaa5d9cfce010f44c7f068 Mon Sep 17 00:00:00 2001 From: sue445 Date: Sat, 31 Aug 2019 16:21:28 +0900 Subject: [PATCH] Add Sentry configuration to gitlab.yml --- README.md | 4 ++++ assets/runtime/config/gitlabhq/gitlab.yml | 7 +++++++ assets/runtime/env-defaults | 6 ++++++ assets/runtime/functions | 9 +++++++++ 4 files changed, 26 insertions(+) diff --git a/README.md b/README.md index 4a76ec4a..eaca90bd 100644 --- a/README.md +++ b/README.md @@ -1059,6 +1059,10 @@ Below is the complete list of available options that can be used to customize yo | `RACK_ATTACK_FINDTIME` | Number of seconds before resetting the per IP auth attempt counter. Defaults to `60`. | | `RACK_ATTACK_BANTIME` | Number of seconds an IP should be banned after too many auth attempts. Defaults to `3600`. | | `GITLAB_WORKHORSE_TIMEOUT` | Timeout for gitlab workhorse http proxy. Defaults to `5m0s`. | +| `SENTRY_ENABLED` | Enables Error Reporting and Logging with Sentry. Defaults to `false`. | +| `SENTRY_DSN` | Sentry DSN. No defaults. | +| `SENTRY_CLIENTSIDE_DSN` | Sentry clientside DSN. No defaults. | +| `SENTRY_ENVIRONMENT` | Sentry environment. Defaults to `production`. | ### Docker secrets and configs diff --git a/assets/runtime/config/gitlabhq/gitlab.yml b/assets/runtime/config/gitlabhq/gitlab.yml index 5aeeb457..7a6d9e7d 100644 --- a/assets/runtime/config/gitlabhq/gitlab.yml +++ b/assets/runtime/config/gitlabhq/gitlab.yml @@ -310,6 +310,13 @@ production: &base path: {{GITLAB_REGISTRY_DIR}} issuer: {{GITLAB_REGISTRY_ISSUER}} + ## Error Reporting and Logging with Sentry + sentry: + enabled: {{SENTRY_ENABLED}} + dsn: {{SENTRY_DSN}} + clientside_dsn: {{SENTRY_CLIENTSIDE_DSN}} + environment: '{{SENTRY_ENVIRONMENT}}' # e.g. development, staging, production + # # 2. GitLab CI settings # ========================== diff --git a/assets/runtime/env-defaults b/assets/runtime/env-defaults index 630a6b87..12be5083 100644 --- a/assets/runtime/env-defaults +++ b/assets/runtime/env-defaults @@ -475,3 +475,9 @@ GITLAB_MONITORING_IP_WHITELIST=${GITLAB_MONITORING_IP_WHITELIST:-"0.0.0.0/8"} GITLAB_MONITORING_SIDEKIQ_EXPORTER_ENABLED=${GITLAB_MONITORING_SIDEKIQ_EXPORTER_ENABLED:-true} GITLAB_MONITORING_SIDEKIQ_EXPORTER_ADDRESS=${GITLAB_MONITORING_SIDEKIQ_EXPORTER_ADDRESS:-"0.0.0.0"} GITLAB_MONITORING_SIDEKIQ_EXPORTER_PORT=${GITLAB_MONITORING_SIDEKIQ_EXPORTER_PORT:-3807} + +## Sentry +SENTRY_ENABLED=${SENTRY_ENABLED:-false} +SENTRY_DSN=${SENTRY_DSN:-} +SENTRY_CLIENTSIDE_DSN=${SENTRY_CLIENTSIDE_DSN:-} +SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT:-production} diff --git a/assets/runtime/functions b/assets/runtime/functions index fa313bd5..dd282d2d 100644 --- a/assets/runtime/functions +++ b/assets/runtime/functions @@ -1111,6 +1111,14 @@ gitlab_configure_pages(){ fi } +gitlab_configure_sentry(){ + echo "Configuring gitlab::sentry..." + update_template ${GITLAB_CONFIG} \ + SENTRY_ENABLED \ + SENTRY_DSN \ + SENTRY_CLIENTSIDE_DSN \ + SENTRY_ENVIRONMENT +} nginx_configure_gitlab_ssl() { if [[ ${GITLAB_HTTPS} == true && -f ${SSL_CERTIFICATE_PATH} && -f ${SSL_KEY_PATH} && -f ${SSL_DHPARAM_PATH} ]]; then @@ -1592,6 +1600,7 @@ configure_gitlab() { gitlab_configure_backups gitlab_configure_registry gitlab_configure_pages + gitlab_configure_sentry # remove stale gitlab.socket rm -rf ${GITLAB_INSTALL_DIR}/tmp/sockets/gitlab.socket