Page MenuHomeDevCentral

D2881.diff
No OneTemporary

D2881.diff

diff --git a/pillar/paas/docker/docker-002/sentry.sls b/pillar/paas/docker/docker-002/sentry.sls
--- a/pillar/paas/docker/docker-002/sentry.sls
+++ b/pillar/paas/docker/docker-002/sentry.sls
@@ -14,6 +14,7 @@
- library/postgres
- library/redis:3.2-alpine
- library/sentry
+ - getsentry/snuba:nightly
- tianon/exim4
- yandex/clickhouse-server:20.3.9.70
@@ -72,7 +73,75 @@
max_memory_ratio: 0.2
#
- # Services maintained by Sentry
+ # Snuba
+ #
+
+ snuba:
+ sentry_snuba_api:
+ network: sentry
+ api: True
+ services: &sentry_snuba_services
+ broker: sentry_kafka:9092
+ clickhouse: sentry_clickhouse
+ redis: sentry_redis
+
+ sentry_snuba_consumer:
+ command: consumer --storage errors --auto-offset-reset=latest --max-batch-time-ms 750
+ network: sentry
+ services: *sentry_snuba_services
+
+ sentry_snuba_outcomes_consumer:
+ command: consumer --storage outcomes_raw --auto-offset-reset=earliest --max-batch-time-ms 750
+ network: sentry
+ services: *sentry_snuba_services
+
+ sentry_snuba_replacer:
+ command: replacer --storage errors --auto-offset-reset=latest
+ network: sentry
+ services: *sentry_snuba_services
+
+ sentry_snuba_replays_consumer:
+ command: consumer --storage replays --auto-offset-reset=latest --max-batch-time-ms 750
+ network: sentry
+ services: *sentry_snuba_services
+
+ sentry_snuba_sessions_consumer:
+ command: consumer --storage sessions_raw --auto-offset-reset=latest --max-batch-time-ms 750
+ network: sentry
+ services: *sentry_snuba_services
+
+ sentry_snuba_subscription_consumer_events:
+ command: subscriptions-scheduler-executor --dataset events --entity events --auto-offset-reset=latest
+ --no-strict-offset-reset --consumer-group=snuba-events-subscriptions-consumers
+ --followed-consumer-group=snuba-consumers --delay-seconds=60 --schedule-ttl=60
+ --stale-threshold-seconds=900
+ network: sentry
+ services: *sentry_snuba_services
+
+ sentry_snuba_subscription_consumer_sessions:
+ command: subscriptions-scheduler-executor --dataset sessions --entity sessions
+ --auto-offset-reset=latest --no-strict-offset-reset --consumer-group=snuba-sessions-subscriptions-consumers
+ --followed-consumer-group=sessions-group --delay-seconds=60 --schedule-ttl=60
+ --stale-threshold-seconds=900
+ network: sentry
+ services: *sentry_snuba_services
+
+ sentry_snuba_subscription_consumer_transactions:
+ command: subscriptions-scheduler-executor --dataset transactions --entity transactions
+ --auto-offset-reset=latest --no-strict-offset-reset --consumer-group=snuba-transactions-subscriptions-consumers
+ --followed-consumer-group=transactions_group --delay-seconds=60 --schedule-ttl=60
+ --stale-threshold-seconds=900
+ network: sentry
+ services: *sentry_snuba_services
+
+ sentry_snuba_transactions_consumer:
+ command: consumer --storage transactions --consumer-group transactions_group
+ --auto-offset-reset=latest --max-batch-time-ms 750
+ network: sentry
+ services: *sentry_snuba_services
+
+ #
+ # Sentry
#
sentry:
diff --git a/roles/paas-docker/containers/snuba.sls b/roles/paas-docker/containers/snuba.sls
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/containers/snuba.sls
@@ -0,0 +1,53 @@
+# -------------------------------------------------------------
+# Salt — Provision Docker engine
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Notes: Environment follows getsentry/self-hosted
+# -------------------------------------------------------------
+
+{% for instance, container in pillar['docker_containers']['snuba'].items() %}
+{% set is_api = container.get("api", False) %}
+
+# -------------------------------------------------------------
+# Container
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{{ instance }}:
+ docker_container.running:
+ - detach: True
+ - interactive: True
+ - image: getsentry/snuba:nightly
+ {% if "command" in container %}
+ - command: {{ container["command"] }}
+ {% endif %}
+ - environment:
+ SNUBA_SETTINGS: docker
+ CLICKHOUSE_HOST: {{ container["services"]["clickhouse"] }}
+ DEFAULT_BROKERS: {{ container["services"]["broker"] }}
+ REDIS_HOST: {{ container["services"]["redis"] }}
+ UWSGI_MAX_REQUESTS: 10000
+ UWSGI_DISABLE_LOGGING: "true"
+
+ # Leaving the value empty to just pass whatever is set
+ # on the host system (or in the .env file)
+ SENTRY_EVENT_RETENTION_DAYS:
+ - networks:
+ - {{ container["network"] }}
+
+# -------------------------------------------------------------
+# Bootstrap / migration
+#
+# docker exec doesn't follow the entrypoint, so full command
+# is needed.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% if is_api %}
+Boostrap and migrate Snuba - {{ instance }}:
+ cmd.run:
+ - name: |
+ docker exec {{ instance }} snuba bootstrap --no-migrate --force
+ docker exec {{ instance }} snuba migrations migrate --force
+{% endif %}
+
+{% endfor %}

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 20:32 (9 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2311253
Default Alt Text
D2881.diff (5 KB)

Event Timeline