Sentry is a service that helps you monitor and fix crashes in realtime. The server is in Python, but it contains a full API for sending events from any language, in any application.
This article is about how to use Pulumi, kubernetes (K8S) provider, Helm Chart and TypeScript SDK to deploy Sentry within Kubernetes (K8S).
Pulumi is a modern infrastructure-as-code platform that allows you to use common programming languages, tools, and frameworks, to provision, update, and manage cloud infrastructure resources.
$ mkdir -p col-example-pulumi-typescript-sentry $ cd col-example-pulumi-typescript-sentry
Pulumi login into local file system.
1 2 3
$ pulumi login file://. Logged in to cloudolife as cloudolife (file://.) or visit https://pulumi.com/docs/reference/install/ for manual instructions and release notes.
Pulumi new a project with kubernetes-typescript SDK.
1
$ pulumi new kubernetes-typescript
The above command will create some files within the current directory.
Install js-yaml package to load and parse yaml file.
1
$ npm i js-yaml
Pulumi Configuration
Configure Kubernetes
By default, Pulumi will look for a kubeconfig file in the following locations, just like kubectl:
The environment variable: $KUBECONFIG,
Or in current user’s default kubeconfig directory: ~/.kube/config
If the kubeconfig file is not in either of these locations, Pulumi will not find it, and it will fail to authenticate against the cluster. Set one of these locations to a valid kubeconfig file, if you have not done so already.
Configure Values.yaml
Edit values.yaml and replace content within {{ }}.
root@sentry-snuba-api-7cd89745f7-9dd2f:/usr/src/snuba# snuba migrations migrate --force 2021-11-17 01:28:07,978 Running migration: 0001_migrations Traceback (most recent call last): File "/usr/local/bin/snuba", line 33, in <module> sys.exit(load_entry_point('snuba', 'console_scripts', 'snuba')()) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/usr/src/snuba/snuba/cli/migrations.py", line 64, in migrate runner.run_all(force=force) File "/usr/src/snuba/snuba/migrations/runner.py", line 157, in run_all self._run_migration_impl(migration_key, force=force) File "/usr/src/snuba/snuba/migrations/runner.py", line 215, in _run_migration_impl migration.forwards(context, dry_run) File "/usr/src/snuba/snuba/migrations/migration.py", line 145, in forwards op.execute(local=True) File "/usr/src/snuba/snuba/migrations/operations.py", line 23, in execute nodes = cluster.get_local_nodes() if local else cluster.get_distributed_nodes() File "/usr/src/snuba/snuba/clusters/cluster.py", line 263, in get_local_nodes assert self.__cluster_name is not None, "cluster_name must be set" AssertionError: cluster_name must be set