85 Commits

Author SHA1 Message Date
Amin Vakil
3c060fc8d8
Check for latest commit before install.sh (#1186) 2021-12-06 15:41:13 -05:00
Filippo Pacifici
8dc84600c5
feat(cdc): Prepare the self hosted environment for the Change Data Capture pipeline (#938)
We will use Change Data Capture to stream WAL updates from postgres into clickhouse so that features like issue search will be able to join event data and metadata (from postgres) through Snuba.

This requires the followings:

A logical replicaiton plugin to be installed in postgres (https://github.com/getsentry/wal2json)
A service to run that streams from the replication log to Kafka (https://github.com/getsentry/cdc)
Datasets in Snuba.
This PR is preparing postgres to stream updates via the replication log.
The idea is to

download the the replication log plugin binary during install.sh
mount a volume with the binary when starting postgres
providing a new entrypoint to postgres that ensures everything is correctly configured.
There is a difference between how this is set up and how we do the same in the development environment.
In the development environment we download the library from the entrypoint itself and store it in a persistent volume, so we do not have to download it every time.
Unfortunately this does not work here as the postgres image is postgres:9.6 while it is postgres:9.6-alpine. This one does not come with either wget or curl. I don't think installing that in the entrypoint would be a good idea, so the download happens in install.sh. I actually think this way is safer so we never depend on connectivity for postgres to start properly.
2021-05-24 17:51:36 -07:00
Chad Whitacre
a0a86e400f
Finish the refactor (#908) 2021-03-30 10:23:49 -04:00
Chad Whitacre
7e7401a668
Refactor most of the rest (#903) 2021-03-30 10:21:05 -04:00
Chad Whitacre
f086157548
Clean up the refactor (#907)
- Use source appropriately (needed for config to propagate properly)
- Standardize group/endgroup line-spacing
- Clean up envvar defaults
2021-03-30 12:21:30 +03:00
Chad Whitacre
568f9052b5
Factor out a few more things (#906) 2021-03-29 17:28:39 -04:00
Chad Whitacre
cf4f21c039
Fix a regression with unset envvars (#905) 2021-03-29 17:41:20 +03:00
Chad Whitacre
a868b09044
Factor out volume creation (#901) 2021-03-26 15:04:54 -04:00
Chad Whitacre
0ce7856117
Refactor relay config (#900) 2021-03-26 10:06:04 -04:00
ktmitton
ae0251d1a8
Fixed CPU soft limit check (#885) 2021-03-12 13:09:20 +00:00
Dmitry Dygalo
26f11c425c
fix: Typo in the "recommended minimum CPU cores" message (#855) 2021-02-11 14:20:19 +00:00
Burak Yigit Kaya
a1c0c1fd0c
ref: Stop building local images for Sentry services (#834)
We used to build local images for Sentry services to be able to
include required plugins in the image. With this change we instead
do this in a custom entrypoint script and use the volume `/data`
to store the plugins permanently.

This should resolve many issues people have around building local
images and pushing them to places like private repositories or swarm
clusters.

This is not 100% compatible with the old way but it should still be
a mostly transparent change to many folks.
2021-02-04 12:15:59 +00:00
Burak Yigit Kaya
ab5b867474
ref(requirements): Add min CPU requirement, relax soft RAM (#844)
* ref(requirements): Add min CPU requirement, relax soft RAM

Adds minimum of 4 CPU cores requirement as anything below will perform quite poorly even on lower loads. Relaxes the soft RAM requirement from 8000 MB to 7800 MB as even when there is 8 GB RAM installed, the system reserves some of it to itself and under reports the amount.

* pass on CI with soft limit
2021-02-01 16:41:12 +03:00
arusa
2da7e84024
Change MIN_RAM_HARD from 4000 to 3800 (#840)
On machines with 4gb the available memory is often a little bit lower than 4000
2021-01-29 08:14:56 -05:00
Burak Yigit Kaya
ee53f18ad0
breaking: Remove Python 2 support (#833) 2021-01-20 15:28:14 +00:00
Chad Whitacre
612a14c63c
Add some structure to logging with ::group:: (#827) 2021-01-19 17:30:07 -05:00
Burak Yigit Kaya
640e7fe290
ci(test): Fix 'pool is closed' errors (#826)
Fixes #823. In `install.sh` we build a local sentry image that is used by many services from using the build context under the `./sentry` directory. To avoid building this image multiple times, we also give it a specific name which is referred from multiple services. The issue is, we also run `docker-compose build --parallel` which creates a race condition when building this image as `docker-compose` doesn't check whether the image is already there or not. This is the root cause of all these random failures: an unsurprising race condition.
2021-01-19 20:43:27 +00:00
Burak Yigit Kaya
f2f1e77622
feat: Add Python 2 deprecation warning (w/ style) (#812)
* feat: Add Python 2 deprecation warning (w/ style)

* ensure successful exit

* always succeed at the end

* try again; set +x
2021-01-14 20:04:48 +03:00
Chad Whitacre
8d6893f0bf
Source install/geoip.sh, to work in more envs (#809) 2021-01-13 11:28:00 -05:00
Chad Whitacre
e7ec11aa3b
Bump RAM requirement in install.sh (#803)
* Bump RAM requirement in install.sh

* Hard requirement vs. soft recommendation
2021-01-08 10:36:34 -05:00
Chad Whitacre
a623e72e7e
Integrate with MaxMind out of the box (#766)
Integrate with MaxMind out of the box
2020-12-14 11:56:04 -05:00
Burak Yigit Kaya
f885eceaec
ref(py3): Remove SENTRY_PYTHON3 and -py3 versons (#764)
This is in preparation to make the PY3 version the default for Docker images and self-hosted. It is part **4/5**:

1. ~~Add `-py2` variants for the Python 2 build tags and introduce the `SENTRY_PYTHON2` env variable usage~~ (getsentry/sentry#22460)
2. ~~Switch getsentry/onpremise to Python 3 by default*, introducing the `SENTRY_PYTHON2` env var for Py2 builds via the `-py2` suffix~~ (getsentry/onpremise#763)
3. ~~Move the unsuffixed version of the builds to Python 3~~ (getsentry/sentry#22466)
4. **Remove the `SENTRY_PYTHON3` env var support and `-py3` prefix usage from getsentry/onpremise**
5. Remove tagging of `-py3` builds from getsentry/sentry
2020-12-05 01:46:20 +03:00
Burak Yigit Kaya
06fb0d75de
ref(py3): Make PY3 the default*, add SENTRY_PYTHON (#763)
This is in preparation to make the PY3 version the default* for Docker images and self-hosted. It is part **2/5**:

1. ~~Add `-py2` variants for the Python 2 build tags and introduce the `SENTRY_PYTHON2` env variable usage~~ (getsentry/sentry#22460)
2. __Switch getsentry/onpremise to Python 3 by default*, introducing the `SENTRY_PYTHON2` env var for Py2 builds via the `-py2` suffix__
3. Move the unsuffixed version of the builds to Python 3
4. Remove the `SENTRY_PYTHON3` env var support and `-py3` prefix usage from getsentry/onpremise
5. Remove tagging of `-py3` builds from here

_* this will only happen when item 3 above gets landed_
2020-12-04 22:43:36 +03:00
Burak Yigit Kaya
bee98fd897
fix(install): Disable the script on git-bash (#741)
We kept getting issue reports that we traced down to `git-bash` which doesn't seem to play nice with Docker for Windows with bind mounts. This PR uses the existence of `$MSYSTEM` to detect `git-bash` and exit early with a relevant message.

Co-authored-by: Chad Whitacre <chadwhitacre@sentry.io>
2020-11-17 20:35:55 +03:00
Burak Yigit Kaya
2a1a171233
fix(install): Increase stop timeout to 60 seconds (#731)
This is to ensure clean shutdown of Celery, with fully drained queues. This is needed as versions may change the event format and not be backwards compatible. FWIW this is a hacky workaround without a strong guarantee that the queues will be empty. Ideally we'd shutdown everything first, spin up the workers and check for queues being drained every second or so.
2020-10-29 23:30:43 +03:00
Burak Yigit Kaya
1399be6a68
feat(py3): Add Python 3 support via SENTRY_PYTHON3 env variable (#702) 2020-10-14 21:54:55 +03:00
Burak Yigit Kaya
e333dbd56a
fix(install): Only use .env for fallbacks
This fixes a serious bug in install.sh where it ignored externaly set env variable values such as `SENTRY_IMAGE` in favor of the ones defined in `.env`, essentially making all our e2e tests usless.
2020-10-03 01:30:56 +03:00
Anton Ovchinnikov
0a4b2ad033
fix(install): Check that all ingest topics exist (#686)
Probably this is not needed anymore after https://github.com/getsentry/sentry/pull/20984 is merged, but just in case
2020-09-25 20:54:52 +03:00
Burak Yigit Kaya
74464695ec
fix(docker): Lower docker version to 19.03.6 (#682)
Fixes #689.
2020-09-23 00:17:21 +03:00
Burak Yigit Kaya
ce8538e83f
fix(ingest-consumer): Create the missing Kafka topics (#685)
Fixes #683, supercedes #684.
2020-09-23 00:04:42 +03:00
Burak Yigit Kaya
49dbeabb2b
ci(gcb): Drop Docker version to 19.03.8 as that's the latest on GCB 2020-09-15 20:19:58 +03:00
Burak Yigit Kaya
f8a2e48ed6
build(docker): Bump min Docker & Compose versions (#676)
We need `docker-compose ps -a` for CI so we were already using 1.24.1, this aligns the rest with that.

For Docker, there are a bunch of network-related fixes in 19.03.12 and prior (DNS fallback and IPv6 advertising) that we'd like to have to see if they are going to fix some reported connectivity issues w/ onpremise.
2020-09-15 19:40:42 +03:00
Bruno Bronosky
5631d45115
fix(install): Use proper bash testing (#673)
Fixes https://github.com/getsentry/onpremise/issues/672

I split this PR up into 4 commits. The first one is the bare minimum for the issue. The rest are just consistency corrections that we neckbeards at irc://chat.freenode.net/%23bash would always make.
2020-09-14 23:19:20 +03:00
Lyn Nagara
9b9066fc02
feat(snuba): Run new migration system (#663)
This is for the onpremise release on Sept 15th.

The new migration system has a migration to handle recreating the
transaction table if the old one is present, we no longer need to do
this in `install.sh`.
2020-09-08 21:17:55 +03:00
Tomasz Kontusz
e293a0fc97
fix(install): Don't use getopt for options parsing (#660)
The code assumed GNU getopt, which is not the default on many platforms, notably OSX.

Fixes #656, and replaces #659.
2020-09-07 11:04:43 +03:00
Tomasz Kontusz
1a9b45fb9f
EditorConfig and indentation fixes (#650)
EditorConfig based on conversation in https://github.com/getsentry/onpremise/pull/615#discussion_r477338006, and with the indentation fixes.

This PR will probably conflict with everything, but at least the code is a little bit more consistent :-D
2020-08-31 14:40:52 +03:00
Kevin Waddle
175ad09057
install: Add flag to skip create user prompt during install (#646)
Fixes #611.
2020-08-27 18:32:20 +03:00
Tomasz Kontusz
627c366f27
install: Keep relay available while upgrading (#615)
This continues on the ideas from #607. By "downtime" here I mean "not accepting events" - web, smtp and background processes are out of scope.

This PR adds a `--minimize-downtime` option to install.sh. This options changes the behaviour of the script by:
1. keeping nginx and relay running until the very end,
2. disabling cleanup on exit and failure,
3. explicitly reloading nginx configuration,
4. and starting the whole cluster at the end.

The results are promising: no downtime if relay version doesn't change, and only a second when it does. So far this was only tested with a curl loop, so I'm still not sure if Relay flushes the events to Sentry before getting recreated by `$dc up`.
2020-08-27 18:02:33 +03:00
Burak Yigit Kaya
fb125a1e4c
fix(install): TSDB migration should not create invalid config file (#631)
Fixes #624
2020-08-17 18:31:15 +03:00
Chad Whitacre
67f70915b5
fix(env): Read and set .env in install.sh, portably (#626)
h/t https://unix.stackexchange.com/a/79077

Fixes #622, cf. #600 

cc: @NullIsNot0
2020-08-17 16:16:06 +03:00
Tomasz Kontusz
35ad7dc477
feat: Only stop the cluster after building images (#614)
This reduces downtime for users with custom Dockerfiles. Fixes #607.
2020-08-03 23:32:56 +03:00
Burak Yigit Kaya
094d8e38a3
fix(install): Read and set .env in install.sh (#600)
Fixes #597.
2020-07-17 15:29:55 +03:00
Burak Yigit Kaya
4f39b57a53
install(clickhouse): Ensure we have the newest transactions table (#594)
See getsentry/sentry#19882 and getsentry/sentry/#19883.

Fixes #587.
2020-07-15 20:37:51 +03:00
Burak Yigit Kaya
75fe6c073b
fix(ingest): Fix Relay auth issues and add e2e event ingestion test (#578)
This is a long-needed test that tests the whole pipeline from Nginx, Relay, to Kafka, and Snuba. The final missing piece is testing the Symbolicator integration.

This PR is also a follow up to #576 as it didn't solve the Relay issues fully (the earlier fix was a coincidence or is not as reliable as it seemed).

Fixes #486 (finally?).
2020-07-13 13:07:05 +03:00
Burak Yigit Kaya
73213bc51f
ref(relay): Remove PK and rely on INTERNAL_IPS (#572)
This patch adds `INTERNAL_IPS` definition to `sentry.conf.py` by sniffing the network from eth0 and relies on this for trusted Relays instead of the ALLOWLISTED PKs. This removes the necessity of syncing Relay PKs to `sentry.conf.py`.

This PR needs getsentry/sentry#19798 to work.
2020-07-10 23:53:50 +03:00
Mike Purvis
96889a6175
Add volumed-out config directory for symbolicator. (#566)
I would like to be able to customize the configuration for my Sentry 10 symbolicator instance, which this change allows me to easily do.

See related: https://github.com/getsentry/symbolicator/issues/245

Co-authored-by: Burak Yigit Kaya <ben@byk.im>
2020-07-08 20:42:33 +03:00
strange-developer
e75e6f1dee
fix(zookeeper): cp: cannot create regular file (#552)
Hi,

I've been through quite a few different ways of implementing this fix and settled on creating a variable to store the output of checking whether the zookeeper copy target folder exists and copying the snapshot file based on the copy target folder existing. I've ran quite a few manual tests for each option as well. Currently the PR sits on Option 3 from the below options.

**Option 1**
Judging from the [Jira issue](https://issues.apache.org/jira/browse/ZOOKEEPER-3056), it seems like the work around for zookeeper upgrades could be omitted entirely since the issue relates to upgrades from v3.4.10 to v3.5.4. I've tested removing the zookeeper workaround entirely and that install ran smoothly on a clean install of Sentry (no existing data) as well as an install of Sentry that currently has very minimal amount of log entries (roughly 100 log entries). Could we possibly remove the workaround entirely? 

**Option 2**
The second option was to simply add a check to the currently [existing line](https://github.com/getsentry/onpremise/blob/master/install.sh#L178) of whether the copy target folder exists and perform the snapshot file copy only if the copy target folder exists. This is the least amount of code and possibly the simpler fix while also setting the `ZOOKEEPER_SNAPSHOT_TRUST_EMPTY` env var to `true`, however, some unnecessary calculations will be done to determine the `ZOOKEEPER_LOG_FILE_COUNT` and `ZOOKEEPER_SNAPSHOT_FILE_COUNT`.

**Option 3**
I've created a variable to store whether the copy target folder exists and proceed with the zookeeper upgrade workaround only if the copy target folder exists. This means that if the copy target folder does not exist, the env var `ZOOKEEPER_SNAPSHOT_TRUST_EMPTY` will not be set.

Fixes #547.

Co-authored-by: chamirb <chamirb@globalkinetic.com>
2020-06-29 16:16:42 +03:00
Burak Yigit Kaya
c2120aafc9
fix(zookeeper): Temp ZK fix should run in detached mode (#525)
Fixes #519.
2020-06-02 19:45:07 +03:00
Burak Yigit Kaya
83160e8bdb
fix(gcb): We need to pull SENTRY_IMAGE on GCB
Follow up to #514.
2020-05-25 10:18:18 +03:00
Burak Yigit Kaya
3e7df7be17
fix(install): Skip pull when SENTRY_IMAGE is set (#514)
This also uses SENTRY_VERSION instead of hard-coding `:latest` as the tag when pulling (follow up to #509).
2020-05-25 01:11:19 +03:00