Skip to content

Commit 0c63bec

Browse files
authored
docs: encourage community patches (#3794)
Hopefully this will provide a better guide on how to create patches.
1 parent e2ad04d commit 0c63bec

File tree

3 files changed

+86
-42
lines changed

3 files changed

+86
-42
lines changed

optional-modifications/README.md

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Optional Modifications
22

3-
Other than the default self-hosted Sentry installation, sometimes users
4-
can leverage their existing infrastructure to help them with limited
5-
resources. "Patches", or you might call this like a "plugin system", is
6-
a collection of patch files (see [man patch(1)](https://man7.org/linux/man-pages/man1/patch.1.html))
7-
that can be used with to modify the existing configuration to achieve
8-
the desired goal.
3+
While the default self-hosted Sentry installation is often sufficient, there are instances where leveraging existing infrastructure becomes a practical necessity, particularly for users with limited resources. This is where **patches**, or what can be understood as a **plugin system**, come into play.
4+
5+
A patch system comprises a collection of patch files (refer to man patch(1) for detailed information) designed to modify an existing Sentry configuration. This allows for targeted adjustments to achieve specific operational goals, optimizing Sentry's functionality within your current environment. This approach provides a flexible alternative to a full, customized re-installation, enabling users to adapt Sentry to their specific needs with greater efficiency.
6+
7+
We also actively encourage the community to contribute! If you've developed a patch that enhances your self-hosted Sentry experience, consider submitting a pull request. Your contributions can be invaluable to other users facing similar challenges, fostering a collaborative environment where shared solutions benefit everyone.
98

109
> [!WARNING]
1110
> Beware that this is very experimental and might not work as expected.
@@ -14,28 +13,38 @@ the desired goal.
1413
1514
## How to use patches
1615

17-
The patches are designed mostly to help modify the existing
18-
configuration files. You will need to run the `install.sh` script
19-
afterwards.
16+
The patches are designed mostly to help modify the existing configuration files. You will need to run the `install.sh` script afterwards.
2017

21-
They should be run from the root directory. For example, the
22-
`external-kafka` patches should be run as:
18+
They should be run from the root directory. For example, the `external-kafka` patches should be run as:
2319

2420
```bash
25-
patch < optional-modifications/patches/external-kafka/.env.patch
26-
patch < optional-modifications/patches/external-kafka/config.example.yml.patch
27-
patch < optional-modifications/patches/external-kafka/sentry.conf.example.py.patch
28-
patch < optional-modifications/patches/external-kafka/docker-compose.yml.patch
21+
patch -p0 < optional-modifications/patches/external-kafka/.env.patch
22+
patch -p0 < optional-modifications/patches/external-kafka/config.example.yml.patch
23+
patch -p0 < optional-modifications/patches/external-kafka/sentry.conf.example.py.patch
24+
patch -p0 < optional-modifications/patches/external-kafka/docker-compose.yml.patch
2925
```
3026

31-
Some patches might require additional steps to be taken, like providing
32-
credentials or additional TLS certificates.
27+
The `-p0` flag is important to ensure the patch applies to the correct absolute file path.
28+
29+
Some patches might require additional steps to be taken, like providing credentials or additional TLS certificates. Make sure to see your changed files before running the `install.sh` script.
30+
31+
## How to create patches
32+
33+
1. Copy the original file to a temporary file name. For example, if you want to create a `clustered-redis` patch, you might want to copy `docker-compose.yml` to `docker-compose.clustered-redis.yml`.
34+
2. Make your changes on the `docker-compose.clustered-redis.yml` file.
35+
3. Run the following command to create the patch:
36+
```bash
37+
diff -Naru docker-compose.yml docker-compose.clustered-redis.yml > docker-compose.yml.patch
38+
```
39+
Or the template command:
40+
```bash
41+
diff -Naru [original file] [patched file] > [destination file].patch
42+
```
43+
4. Create a new directory in the `optional-modifications/patches` folder with the name of the patch. For example, `optional-modifications/patches/clustered-redis`.
44+
5. Move the patched files (like `docker-compose.yml.patch` earlier) into the new directory.
3345

3446
## Official support
3547

36-
Sentry employees are not obliged to provide dedicated support for
37-
patches, but they can help by providing information to move us forward.
38-
We encourage the community to contribute for any bug fixes or
39-
improvements.
48+
While Sentry employees aren't able to offer dedicated support for these patches, they can provide valuable information to help move things forward. Ultimately, we really encourage the community to take the wheel, maintaining and fostering these patches themselves. If you have questions, Sentry employees will be there to help guide you.
4049
4150
See the [support policy for self-hosted Sentry](https://develop.sentry.dev/self-hosted/support/) for more information.

optional-modifications/_lib.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

optional-modifications/patches/external-kafka/docker-compose.yml.patch

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
--- docker-compose.yml 2025-03-17 13:32:15.120328412 +0700
2-
+++ docker-compose.external-kafka.yml 2025-05-15 08:39:05.509951068 +0700
1+
--- docker-compose.yml 2025-07-08 10:22:36.600616503 +0700
2+
+++ docker-compose.external-kafka.yml 2025-07-08 10:36:44.069900011 +0700
33
@@ -26,8 +26,6 @@
44
depends_on:
55
redis:
@@ -48,7 +48,7 @@
4848
REDIS_HOST: redis
4949
UWSGI_MAX_REQUESTS: "10000"
5050
UWSGI_DISABLE_LOGGING: "true"
51-
@@ -140,43 +151,7 @@
51+
@@ -136,43 +147,7 @@
5252
POSTGRES_HOST_AUTH_METHOD: "trust"
5353
volumes:
5454
- "sentry-postgres:/var/lib/postgresql/data"
@@ -93,7 +93,7 @@
9393
clickhouse:
9494
<<: *restart_policy
9595
image: clickhouse-self-hosted-local
96-
@@ -475,9 +450,8 @@
96+
@@ -509,9 +484,8 @@
9797
read_only: true
9898
source: ./geoip
9999
target: /geoip
@@ -104,7 +104,32 @@
104104
redis:
105105
<<: *depends_on-healthy
106106
web:
107-
@@ -486,15 +460,21 @@
107+
@@ -520,8 +494,22 @@
108+
<<: *restart_policy
109+
image: "$TASKBROKER_IMAGE"
110+
environment:
111+
- TASKBROKER_KAFKA_CLUSTER: "kafka:9092"
112+
- TASKBROKER_KAFKA_DEADLETTER_CLUSTER: "kafka:9092"
113+
+ TASKBROKER_KAFKA_CLUSTER: ${KAFKA_BOOTSTRAP_SERVERS:-kafka:9092}
114+
+ TASKBROKER_KAFKA_SECURITY_PROTOCOL: ${KAFKA_SECURITY_PROTOCOL:-PLAINTEXT}
115+
+ TASKBROKER_KAFKA_SSL_CA_LOCATION: ${KAFKA_SSL_CA_LOCATION:-}
116+
+ TASKBROKER_KAFKA_SSL_CERTIFICATE_LOCATION: ${KAFKA_SSL_CERTIFICATE_LOCATION:-}
117+
+ TASKBROKER_KAFKA_SSL_KEY_LOCATION: ${KAFKA_SSL_KEY_LOCATION:-}
118+
+ TASKBROKER_KAFKA_SASL_MECHANISM: ${KAFKA_SASL_MECHANISM:-}
119+
+ TASKBROKER_KAFKA_SASL_USERNAME: ${KAFKA_SASL_USERNAME:-}
120+
+ TASKBROKER_KAFKA_SASL_PASSWORD: ${KAFKA_SASL_PASSWORD:-}
121+
+ TASKBROKER_KAFKA_DEADLETTER_CLUSTER: ${KAFKA_BOOTSTRAP_SERVERS:-kafka:9092}
122+
+ TASKBROKER_KAFKA_DEADLETTER_SECURITY_PROTOCOL: ${KAFKA_SECURITY_PROTOCOL:-PLAINTEXT}
123+
+ TASKBROKER_KAFKA_DEADLETTER_SSL_CA_LOCATION: ${KAFKA_SSL_CA_LOCATION:-}
124+
+ TASKBROKER_KAFKA_DEADLETTER_SSL_CERTIFICATE_LOCATION: ${KAFKA_SSL_CERTIFICATE_LOCATION:-}
125+
+ TASKBROKER_KAFKA_DEADLETTER_SSL_KEY_LOCATION: ${KAFKA_SSL_KEY_LOCATION:-}
126+
+ TASKBROKER_KAFKA_DEADLETTER_SASL_MECHANISM: ${KAFKA_SASL_MECHANISM:-}
127+
+ TASKBROKER_KAFKA_DEADLETTER_SASL_USERNAME: ${KAFKA_SASL_USERNAME:-}
128+
+ TASKBROKER_KAFKA_DEADLETTER_SASL_PASSWORD: ${KAFKA_SASL_PASSWORD:-}
129+
TASKBROKER_DB_PATH: "/opt/sqlite/taskbroker-activations.sqlite"
130+
volumes:
131+
- sentry-taskbroker:/opt/sqlite
132+
@@ -538,15 +526,21 @@
108133
<<: *restart_policy
109134
image: "$VROOM_IMAGE"
110135
environment:
@@ -131,7 +156,32 @@
131156
profiles:
132157
- feature-complete
133158
vroom-cleanup:
134-
@@ -523,8 +503,6 @@
159+
@@ -571,7 +565,14 @@
160+
image: "$UPTIME_CHECKER_IMAGE"
161+
command: run
162+
environment:
163+
- UPTIME_CHECKER_RESULTS_KAFKA_CLUSTER: kafka:9092
164+
+ UPTIME_CHECKER_RESULTS_KAFKA_CLUSTER: ${KAFKA_BOOTSTRAP_SERVERS:-kafka:9092}
165+
+ UPTIME_CHECKER_KAFKA_SECURITY_PROTOCOL: ${KAFKA_SECURITY_PROTOCOL:-PLAINTEXT}
166+
+ UPTIME_CHECKER_KAFKA_SSL_CA_LOCATION: ${KAFKA_SSL_CA_LOCATION:-}
167+
+ UPTIME_CHECKER_KAFKA_SSL_CERT_LOCATION: ${KAFKA_SSL_CERTIFICATE_LOCATION:-}
168+
+ UPTIME_CHECKER_KAFKA_SSL_KEY_LOCATION: ${KAFKA_SSL_KEY_LOCATION:-}
169+
+ UPTIME_CHECKER_KAFKA_SASL_MECHANISM: ${KAFKA_SASL_MECHANISM:-}
170+
+ UPTIME_CHECKER_KAFKA_SASL_USERNAME: ${KAFKA_SASL_USERNAME:-}
171+
+ UPTIME_CHECKER_KAFKA_SASL_PASSWORD: ${KAFKA_SASL_PASSWORD:-}
172+
UPTIME_CHECKER_REDIS_HOST: redis://redis:6379
173+
# Set to `true` will allow uptime checks against private IP addresses
174+
UPTIME_CHECKER_ALLOW_INTERNAL_IPS: "false"
175+
@@ -582,8 +583,6 @@
176+
# resolver.
177+
#UPTIME_CHECKER_HTTP_CHECKER_DNS_NAMESERVERS: "8.8.8.8,8.8.4.4"
178+
depends_on:
179+
- kafka:
180+
- <<: *depends_on-healthy
181+
redis:
182+
<<: *depends_on-healthy
183+
profiles:
184+
@@ -597,8 +596,6 @@
135185
external: true
136186
sentry-redis:
137187
external: true

0 commit comments

Comments
 (0)