Skip to content

Commit 20ca013

Browse files
authored
update: update sentry example (#759)
1 parent 973d834 commit 20ca013

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

docs/monitoring.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,15 @@ To generate the auth token, click
3939
[this](https://sentry.io/orgredirect/settings/:orgslug/developer-settings/new-internal/)
4040
to create an internal integration (which grants the selected capabilities to the
4141
recipient, similar to how RBAC works). Give it a name and add the scope for
42-
`Releases:Admin` and `Organization:Read`. Press Save, find the auth token at the
43-
bottom of the page under "Tokens", and copy that to secure location (this
44-
becomes `SENTRY_AUTH_TOKEN`). Then visit the organization settings page and copy
45-
that organization slug (`SENTRY_ORG`), and the slug name for your project too
42+
`Releases:Admin` and `Organization:Read`. Press Save, and then generate the auth token at the
43+
bottom of the page under "Tokens", and copy that to a secure location (this
44+
becomes `SENTRY_AUTH_TOKEN`). Then visit the organization general settings page and copy
45+
the organization slug (`SENTRY_ORG`), and the slug name for your project under `Organization > Projects > Project > Name`
4646
(`SENTRY_PROJECT`).
4747

4848
In the 'build' section of the [Dockerfile](../other/Dockerfile), there is an
49-
example of how to pass (mount) the `SENTRY_AUTH_TOKEN` as a docker secret, so it
50-
is available to Vite when `npm run build` is run. You can do the same for
51-
`SENTRY_ORG` and `SENTRY_PROJECT` or actually any other secret (environment
49+
example of how to pass `SENTRY_AUTH_TOKEN` secret, so it
50+
is available to Vite when `npm run build` is run. You may also uncomment and hard code your `SENTRY_ORG` and `SENTRY_PROJECT` values. Setup up your secrets in [GitHub Actions secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions). You can do the same for any other secret (environment
5251
variable) you need at build time, just make sure those secrets (variables) are
5352
available on the CI runner: see the 'deploy' job from
5453
[`deploy`](../.github/workflows/deploy.yml) workflow. Note that these do not
@@ -57,7 +56,6 @@ schema, as they are only used during the build and not the runtime.
5756

5857
The Sentry Vite plugin in [`vite.config.ts`](../vite.config.ts) will create
5958
sentry releases for you and automatically associate commits during the vite
60-
build once the `SENTRY_AUTH_TOKEN` is set, which in our set-up is done via
61-
[GitHub Actions secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions).
59+
build once the `SENTRY_AUTH_TOKEN` is set.
6260
In this setup we have utilized a simple strategy for naming releases of using
6361
the commit sha, passed in as a build arg via the GitHub action workflow.

other/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ FROM base as build
3232
ARG COMMIT_SHA
3333
ENV COMMIT_SHA=$COMMIT_SHA
3434

35+
# Use the following environment variables to configure Sentry
36+
# ENV SENTRY_ORG=
37+
# ENV SENTRY_PROJECT=
38+
39+
3540
WORKDIR /myapp
3641

3742
COPY --from=deps /myapp/node_modules /myapp/node_modules
@@ -43,8 +48,8 @@ ADD . .
4348

4449
# Mount the secret and set it as an environment variable and run the build
4550
RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN \
46-
export SENTRY_AUTH_TOKEN=$(cat /run/secrets/SENTRY_AUTH_TOKEN) && \
47-
npm run build
51+
export SENTRY_AUTH_TOKEN=$(cat /run/secrets/SENTRY_AUTH_TOKEN) && \
52+
npm run build
4853

4954
# Finally, build the production image with minimal footprint
5055
FROM base

0 commit comments

Comments
 (0)