-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
278312b
commit 7a39a6b
Showing
8 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
CONFIG_DIR="config" | ||
|
||
# Ensure the config directory is cleaned up on exit | ||
trap "rm -rf ${CONFIG_DIR}" EXIT | ||
|
||
# Prompt the user for the Sentry upstream URL | ||
read -p "Enter your Sentry upstream URL (e.g. https://oXXXX.ingest.sentry.io): " SENTRY_UPSTREAM | ||
|
||
# Create a configuration directory for relay if it doesn't exist | ||
mkdir -p "${CONFIG_DIR}" | ||
|
||
echo "Initializing Relay configuration..." | ||
# Run relay config init to create config files (.relay/config.yml and credentials.json) | ||
# We assume you'll choose the default configuration by pressing enter. | ||
docker run --rm -it \ | ||
-v "$(pwd)/${CONFIG_DIR}":/work/.relay \ | ||
getsentry/relay \ | ||
config init | ||
|
||
# At this point, config.yml and credentials.json should be in ${CONFIG_DIR} | ||
CREDENTIALS_FILE="${CONFIG_DIR}/credentials.json" | ||
|
||
if [ ! -f "${CREDENTIALS_FILE}" ]; then | ||
echo "Error: ${CREDENTIALS_FILE} not found. Make sure relay config init completed successfully." | ||
exit 1 | ||
fi | ||
|
||
echo "Reading credentials from ${CREDENTIALS_FILE}..." | ||
# Parse the credentials file directly with jq | ||
SECRET_KEY=$(jq -r '.secret_key' "${CREDENTIALS_FILE}") | ||
PUBLIC_KEY=$(jq -r '.public_key' "${CREDENTIALS_FILE}") | ||
RELAY_ID=$(jq -r '.id' "${CREDENTIALS_FILE}") | ||
|
||
echo "Credentials and upstream URL obtained successfully." | ||
|
||
cat <<EOF | ||
Setup complete! | ||
Your relay chart can now be installed with the following command: | ||
helm install sentry-relay ../sentry-relay \\ | ||
--set relay.upstream="${SENTRY_UPSTREAM}" \\ | ||
--set credentials.secretKey="${SECRET_KEY}" \\ | ||
--set credentials.publicKey="${PUBLIC_KEY}" \\ | ||
--set credentials.relayId="${RELAY_ID}" | ||
Once deployed, you can port-forward and test sending events as noted in the chart's NOTES.txt. | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: sentry-relay | ||
description: A Helm chart for deploying Sentry Relay | ||
type: application | ||
version: 0.1.0 | ||
appVersion: "latest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Thank you for installing my-sentry-relay! | ||
|
||
To test your Relay instance: | ||
|
||
1. Port forward the service: | ||
kubectl port-forward svc/{{ include "my-sentry-relay.fullname" . }} 3000:3000 | ||
|
||
2. Update your DSN to point to Relay: | ||
Original DSN: https://<key>@oX.ingest.sentry.io/<project_id> | ||
Relay DSN: http://<key>@localhost:3000/<project_id> | ||
|
||
3. Test with sentry-cli: | ||
export SENTRY_DSN='http://<key>@localhost:3000/<project_id>' | ||
sentry-cli send-event -m 'A test event' | ||
|
||
4. Check in your Sentry project for the event. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "my-sentry-relay.fullname" . }}-config | ||
data: | ||
config.yml: | | ||
relay: | ||
mode: {{ .Values.relay.mode }} | ||
upstream: {{ .Values.relay.upstream }} | ||
host: {{ .Values.relay.host }} | ||
port: {{ .Values.relay.port }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "my-sentry-relay.fullname" . }} | ||
labels: | ||
app: {{ include "my-sentry-relay.name" . }} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: {{ include "my-sentry-relay.name" . }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ include "my-sentry-relay.name" . }} | ||
spec: | ||
containers: | ||
- name: relay | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
args: ["run"] | ||
ports: | ||
- containerPort: {{ .Values.relay.port }} | ||
volumeMounts: | ||
- name: relay-config | ||
mountPath: /work/.relay | ||
- name: relay-credentials | ||
mountPath: /work/.relay | ||
readOnly: true | ||
resources: | ||
requests: | ||
cpu: {{ .Values.resources.requests.cpu }} | ||
memory: {{ .Values.resources.requests.memory }} | ||
limits: | ||
cpu: {{ .Values.resources.limits.cpu }} | ||
memory: {{ .Values.resources.limits.memory }} | ||
volumes: | ||
- name: relay-config | ||
configMap: | ||
name: {{ include "my-sentry-relay.fullname" . }}-config | ||
- name: relay-credentials | ||
secret: | ||
secretName: {{ include "my-sentry-relay.fullname" . }}-credentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ include "my-sentry-relay.fullname" . }}-credentials | ||
type: Opaque | ||
stringData: | ||
credentials.json: | | ||
{ | ||
"secret_key": "{{ .Values.credentials.secretKey }}", | ||
"public_key": "{{ .Values.credentials.publicKey }}", | ||
"id": "{{ .Values.credentials.relayId }}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "my-sentry-relay.fullname" . }} | ||
labels: | ||
app: {{ include "my-sentry-relay.name" . }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: {{ .Values.relay.port }} | ||
protocol: TCP | ||
name: http | ||
selector: | ||
app: {{ include "my-sentry-relay.name" . }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
image: | ||
repository: getsentry/relay | ||
tag: latest | ||
pullPolicy: IfNotPresent | ||
|
||
service: | ||
type: ClusterIP | ||
port: 3000 | ||
|
||
relay: | ||
mode: managed | ||
host: 127.0.0.0 | ||
port: 3000 | ||
|
||
credentials: | ||
|
||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 128Mi | ||
limits: | ||
cpu: 500m | ||
memory: 512Mi |