Commit Graph

707 Commits

Author SHA1 Message Date
f03c7a1ba1 FIX: Force ActiveRecord reading role if Redis is down. 2020-07-09 11:13:02 +08:00
82964265cc DEV: Remove logster current context config.
Multisite middleware sits at the top of the middleware stack.
2020-07-01 11:44:22 +08:00
2c4c953bf8 DEV: Avoid logging errors on bad Redis connection during PG failover. 2020-06-29 11:54:55 +08:00
42a6c8a85f DEV: Rescue from ActiveRecord::Readonly error in lograge. 2020-06-25 10:25:28 +08:00
27b2e335ef DEV: Retry on distributed mutex timeout error when starting sidekiq.
We need Sidekiq to start `mini_scheduler` no matter what. Timeouts
happen when trying to boot an app with Redis in readonly mode.
2020-06-23 15:43:28 +08:00
def4cd33ea DEV: Disable Redis warnings. 2020-06-16 12:53:04 +08:00
c611f3703c DEV: Don't use logster when logging in Redis failover. 2020-06-16 11:53:52 +08:00
b08a0d15c4 DEV: Fix undefined method due to rails_failover. 2020-06-16 11:03:57 +08:00
092ae858af DEV: Bump rails_failover.
Avoid configuring AR stuff if `replica_host` and `replica_port` hasn't
been provided.
2020-06-16 10:51:21 +08:00
402b80f306 DEV: Make rails_failover compatible with SKIP_DB_AND_REDIS env. 2020-06-15 16:23:24 +08:00
e0d798c06c DEV: Fix undefined method. 2020-06-15 16:04:41 +08:00
e0fdf41537 DEV: Don't configure rails_failover is db and redis is skipped. 2020-06-15 15:56:57 +08:00
58e52c0e4f DEV: Use rails_failover gem for ActiveRecord and Redis failover handling 2020-06-15 15:47:07 +08:00
0ff86b00cb DEV: Upgrade Redis to 4.2.1. 2020-06-15 10:05:22 +08:00
c9964b95ce DEV: Increase log level for /srv/status route.
This reduces the amount of noise in our logs.
2020-06-12 12:17:28 +08:00
78b5ab746c DEV: No longer need to clear anon cache when toggling readonly mode. 2020-06-12 09:58:17 +08:00
dc4071dfef DEV: Use Rails.logger instead of logster for rails_failover callbacks
`Discourse.warn_exception` logs to logger by default but it means we
lose all the backtrace when the logs are written to the log file.
2020-06-11 17:24:32 +08:00
1411b095eb DEV: Rescue errors when runngin AR failover/fallback callbacks. 2020-06-11 13:02:42 +08:00
34ee1f2e71 DEV: Fix undefined method in rails_failover initializer. 2020-06-11 12:30:01 +08:00
cbb4ea1ea8 DEV: Don't blow up request redis can't be reached during failover. 2020-06-11 11:41:06 +08:00
a3dfd553a1 Revert "Bump redis to 4.2.0."
This reverts commit 98bc28cea259b823552e1b953506bcf2f76347a9.
2020-06-10 14:52:05 +08:00
98bc28cea2 Bump redis to 4.2.0. 2020-06-10 14:28:56 +08:00
2ce829cc01 DEV: Allow multisite apps to boot with reading connection handler. 2020-06-10 14:18:29 +08:00
a1c13eb3c6 DEV: Redis failover should only clear redis recently readonly. 2020-06-09 16:36:31 +08:00
f6628e4f43 DEV: Disable messageBus keepalive when Redis fails over. 2020-06-08 12:33:08 +08:00
e82d4d8a75 DEV: Update rails_failover to avoid monkey patching Rails config. 2020-06-05 09:05:19 +08:00
87673e6571 DEV: Fix moving of rails_failover middleware. 2020-06-04 20:29:47 +08:00
aaece34e8b DEV: Update rails_failover so that we can move middleware up the stack. 2020-06-04 17:14:13 +08:00
54f79ea3ba DEV: Pausing Sidekiq is multisite aware. 2020-06-04 15:46:30 +08:00
8e1681d356 Bump rails_failover. 2020-06-04 15:22:35 +08:00
439db7ca1e DEV: Add REDIS_RAILS_FAILOVER env to test our new redis failover. 2020-06-02 17:24:14 +08:00
ade60b0cbc DEV: Enable readonly mode for all multisite sites when PG goes down.
The risk here is that the database for one site goes down in the multisite setup and we drop everything to readonly mode. However, I discussed this with Sam and we agree that one database having problem is very rare. Most of the time, it is the entire DB cluster that goes down.
2020-06-02 11:32:07 +08:00
326d6d5b0f DEV: Pause Sidekiq when forcing pg readonly mode. 2020-06-02 09:20:03 +08:00
32735be5bd DEV: Fix publish to message_bus when forcing pg readonly. 2020-06-01 13:26:12 +08:00
2c3ff3e524 DEV: Missing readonly mode banner when forcing PG readonly. 2020-06-01 12:25:27 +08:00
b0b37bf5a3 DEV: Add force rails_over switch via Redis. 2020-06-01 11:23:58 +08:00
8c86a109bb DEV: Add ENV flag to test out ActiveRecord::Failover. 2020-05-28 16:24:22 +08:00
878f06f1fe DEV: Remove custom connection reaper.
Rails 6 fixed the reaper to use one thread to reap all the connection pools.
2020-05-26 09:09:46 +08:00
d9a02d1336 Revert "Revert "Merge branch 'master' of https://github.com/discourse/discourse""
This reverts commit 20780a1eeed56b321daf18ee6bbfe681a51d1bf4.

* SECURITY: re-adds accidentally reverted commit:
  03d26cd6: ensure embed_url contains valid http(s) uri
* when the merge commit e62a85cf was reverted, git chose the 2660c2e2 parent to land on
  instead of the 03d26cd6 parent (which contains security fixes)
2020-05-23 00:56:13 -04:00
20780a1eee Revert "Merge branch 'master' of https://github.com/discourse/discourse"
This reverts commit e62a85cf6fd81a2a34aff6144bd36b9ac459964a, reversing
changes made to 2660c2e21d84bea667e1ea339f91cda352328062.
2020-05-22 20:25:56 -07:00
2f03a879f9 DEV: Require rails_failover before global settings. 2020-05-20 16:06:40 +08:00
f7f436e536 DEV: Install rails_failover gem to test our Redis changes. 2020-05-20 15:40:27 +08:00
96c02caba7 DEV: Change use of Redis flushall to flushdb.
FLUSHALL removes all keys from all databases. Instead we only want to
remove keys from the current Redis database.
2020-05-19 10:20:00 +08:00
609e929186 Revert "Revert "DEV: upgrade to Rails 6.0.3""
This reverts commit 2ff8b4f5d9dd72a55d7ebdc23a3758dd5ec4682d.

Attempt #2 at a Rails update this time we also update the
rails_multisite gem to allow for cleaner reordering
2020-05-08 11:49:22 +10:00
2ff8b4f5d9 Revert "DEV: upgrade to Rails 6.0.3"
This was causing issues during multisite:migrate

https://meta.discourse.org/t/multisite-migrate-broken-since-rails-6-0-3-update/150691

This reverts commit 136a5456534c7e468b8052f865ce970a3bf375e9.
2020-05-07 11:44:39 +01:00
136a545653 DEV: upgrade to Rails 6.0.3
Upgrades Rails to latest, this version has better compatibility
with Ruby 2.7

During the upgrade we needed a new cleaner mechanism for configuring
message bus.

All tests are green.

If anything weird pops up please revert.
2020-05-07 15:53:40 +10:00
d0d5a138c3 DEV: stop freezing frozen strings
We have the `# frozen_string_literal: true` comment on all our
files. This means all string literals are frozen. There is no need
to call #freeze on any literals.

For files with `# frozen_string_literal: true`

```
puts %w{a b}[0].frozen?
=> true

puts "hi".frozen?
=> true

puts "a #{1} b".frozen?
=> true

puts ("a " + "b").frozen?
=> false

puts (-("a " + "b")).frozen?
=> true
```

For more details see: https://samsaffron.com/archive/2018/02/16/reducing-string-duplication-in-ruby
2020-04-30 16:48:53 +10:00
17cf300b71 DEV: Use more specific error responses (#9472)
* DEV: Use `render_json_error` (Adds specs for Admin::GroupsController)
* DEV: Use a specific error on blank category slug (Fixes a `render_json_error` warning)
* DEV: Use a specific error on reviewable claim conflict (Fixes a `render_json_error` warning)
* DEV: Use specific errors in Admin::UsersController (Fixes `render_json_error` warnings)
* FIX: PublishedPages error responses
* FIX: TopicsController error responses (There was an issue of two separate `Topic` instances for the same record. This makes sure there's only one up-to-date instance.)
2020-04-21 03:50:20 +02:00
3d9c320aab PERF: Cache Category.subcategory_ids (#9350)
Also reset category cache after backup restore.
2020-04-09 15:42:24 +03:00
138d4aebde FEATURE: Webhooks and Event for user being granted a badge
Adding a webhook for badge revocation is left for future work as it's relatively rare.
2020-04-08 14:38:30 -07:00