Commit Graph

1247 Commits

Author SHA1 Message Date
Mike Dalessio 325c49ec2a doc: adding beta+production tenant URLs to the README 2025-03-12 12:18:28 -04:00
Mike Dalessio 31bbb6c76f deploy: keeping beta to one tenant 2025-03-12 12:14:53 -04:00
Mike Dalessio a337294650 deploy: update beta hosts for multi-tenancy 2025-03-12 11:56:58 -04:00
Mike Dalessio 5ea619fb8a doc: update README with the development-tenant URL
and a note about db:fixtures:load
2025-03-12 10:51:34 -04:00
Mike Dalessio dcb8d52dcd dep: bump active_record-tenanted for a db:fixture:load fix 2025-03-12 09:54:39 -04:00
Mike Dalessio 52a1b49155 Merge pull request #295 from basecamp/flavorjones-update-ar-tenanted-for-trim-job-fix
dep: update active_record-tenanted
2025-03-12 09:37:53 -04:00
Mike Dalessio 11df869dfc dep: update active_record-tenanted
for the fix in https://github.com/basecamp/active_record-tenanted/pull/45
2025-03-12 09:34:03 -04:00
Mike Dalessio eb96412465 The 404 page is in the new Rails style, and lists the tenants 2025-03-12 08:40:11 -04:00
Mike Dalessio bb5ed28130 kamal-proxy: add fizzy.37signals.com so we can return 404
instead of the TLD handshake error now seen
2025-03-12 08:29:40 -04:00
Mike Dalessio dbe783c182 Final version of the tenancy migration script. 2025-03-12 08:27:30 -04:00
Mike Dalessio a945f29e29 Merge pull request #279 from basecamp/flavorjones-tenant-v4
Introduce tenanting (v3)
2025-03-12 08:26:57 -04:00
Mike Dalessio d8075b74b7 hack: to handle tenantname.fizzy.37signals.com
Let's do the needful thing for now, and clean it up once the gem has
exposed the tenant resolver as a config in a cleaner way.
2025-03-12 07:53:31 -04:00
Mike Dalessio 300dffd376 Script and configuration for a multi-tenant migration
ref: https://3.basecamp.com/2914079/buckets/37331921/messages/8422006338

The script takes advantage of the fact that we can bind to the
existing untenanted database by adding it explicitly (and temporarily)
as a readonly shard to the database.yml, and so in the script
with_original_db is connected to the original database.

storage/tenants/%{tenant}/ is now the root directory for all
state stored for a particular tenant, including active storage and the
database.

We leave the existing files and production database in place after the
migration, in case we need to roll back (by reverting the code and
config).

We also don't do a granular active storage blob copy, since the
attachments are mostly on Account (and not on Bubble). Instead we
hardlink the blobs on disk (so we don't take up additional space with
duplicates).

Finally, we're manually adding the kamal-proxy hosts to the deploy
file, so that we can generate letsencrypt certs for the
subdomains. This is only intended to be a short-term solution, we'll
want something like a wildcard cert before we go live.
2025-03-12 07:53:31 -04:00
Mike Dalessio 4af0fe01d6 Update recurring jobs to iterate over all tenants 2025-03-12 07:53:31 -04:00
Mike Dalessio ca77968e55 Work around Rails' shard swapping lock in the Solid Cache config
Because solid cache started using shard swapping when given a
`database:` key in https://github.com/rails/solid_cache/pull/219, and
Rails doesn't distinguish which database is being swapped and which
was locked.

Hopefully I can make a change upstream that will enable swap locking
only for a specific databases. Until then, let's just use a slightly
more verbose configuration to work around it.
2025-03-12 07:53:31 -04:00
Mike Dalessio d9ece38753 Make the application multi-tenant 2025-03-12 07:53:31 -04:00
Mike Dalessio b90cc9bd06 dep: bundle update rails and rack 2025-03-12 07:53:31 -04:00
Mike Dalessio 37c8ca1b65 dep: add active_record-tenanting 2025-03-12 07:53:28 -04:00
Kevin McConnell f50a880d6b Avoid double render in Avatars#show
After sending the conditional 304 response, we were still attempting to
render the response, which is unnecessary.
2025-03-12 09:05:50 +00:00
Mike Dalessio e0fa376d4f Update scoreable to return a large positive number when score==0 (#290)
Avoid infinite activity score orders

Items with a zero activity score were getting an activity sorting score
of -infinity, because we base the value on log2(score). Adjusting the
calculation avoids this edge case, by always basing the sorting score on
a non-zero number.

---------

Co-authored-by: Kevin McConnell <kevin@37signals.com>
2025-03-11 07:39:17 -04:00
Mike Dalessio 7420adb2c4 Merge pull request #288 from basecamp/flavorjones-20250310-bundle-update
dep: bundle update
2025-03-10 13:00:09 -04:00
Mike Dalessio 232e5e4ed2 lint: tell brakeman 7 to ignore the class eval in has_markdown 2025-03-10 12:56:36 -04:00
Mike Dalessio f1ec43db28 dep: bundle update
except Rails
2025-03-10 12:53:21 -04:00
Mike Dalessio 9c26633673 Inject the GITHUB_TOKEN secret into the container builder 2025-03-10 12:32:32 -04:00
Mike Dalessio 40256a4420 Merge pull request #249 from basecamp/dependabot/bundler/net-imap-0.5.6
Bump net-imap from 0.5.5 to 0.5.6
2025-03-10 12:20:07 -04:00
Mike Dalessio 2a4b85007d Merge pull request #286 from basecamp/dependabot/bundler/rack-3.1.11
Bump rack from 3.1.8 to 3.1.11
2025-03-10 12:19:38 -04:00
Mike Dalessio fa0f8fa2b1 Merge pull request #287 from basecamp/dependabot/bundler/uri-1.0.3
Bump uri from 1.0.2 to 1.0.3
2025-03-10 12:19:28 -04:00
Mike Dalessio f339105593 Merge pull request #285 from basecamp/flavorjones-structured-logging
Configure structured JSON logging
2025-03-10 12:19:19 -04:00
dependabot[bot] d3d4b4c85b Bump uri from 1.0.2 to 1.0.3
Bumps [uri](https://github.com/ruby/uri) from 1.0.2 to 1.0.3.
- [Release notes](https://github.com/ruby/uri/releases)
- [Commits](https://github.com/ruby/uri/compare/v1.0.2...v1.0.3)

---
updated-dependencies:
- dependency-name: uri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 16:16:53 +00:00
dependabot[bot] 9c6405e524 Bump net-imap from 0.5.5 to 0.5.6
Bumps [net-imap](https://github.com/ruby/net-imap) from 0.5.5 to 0.5.6.
- [Release notes](https://github.com/ruby/net-imap/releases)
- [Commits](https://github.com/ruby/net-imap/compare/v0.5.5...v0.5.6)

---
updated-dependencies:
- dependency-name: net-imap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 16:16:34 +00:00
dependabot[bot] 14ecae6aef Bump rack from 3.1.8 to 3.1.11
Bumps [rack](https://github.com/rack/rack) from 3.1.8 to 3.1.11.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/v3.1.8...v3.1.11)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 16:16:03 +00:00
Mike Dalessio 2756a0ebc1 ci: Set access token to pull from the private repo 2025-03-10 12:12:56 -04:00
Mike Dalessio 989600c590 Configure structured JSON logging
This configuration is emulating what we do in HEY.
2025-03-10 12:12:56 -04:00
Kevin McConnell 6f1d200316 Use fixed date as well as time in test
Otherwise this will be affected by DST.
2025-03-10 16:12:22 +00:00
Mike Dalessio d9c9166dfb Merge pull request #260 from basecamp/dependabot/bundler/nokogiri-1.18.3
Bump nokogiri from 1.18.1 to 1.18.3
2025-03-10 12:02:38 -04:00
Kevin McConnell 0b068d62a7 Merge pull request #280 from basecamp/scoring
More dynamic activity scores
2025-03-06 11:29:31 +00:00
Kevin McConnell 16a80ff3a6 More dynamic activity scores
This introduces a more dynamic system of activity scoring, to improve
the way bubbles "bubble up" due to their activity. There are a few
different parts we can tune here, and it's likely we'll need to make
adjustments once we get a feel for how this works in practice.

The basic idea here is:

- We assign points for certain types of event that happen on a bubble. A
  boost gets 1 point, a comment gets 10 points, and so on.
- These points decay over time, at a rate of 50% per day. So old
  activity is worth much less than new activity. Bubbles should rise up
  quickly when acted upon, bit will float back down if left idle.
- Some comments can score higher than others: the first comment from
  each person on a bubble is worth more (20) because it signals that
  more people are getting involved; and comments that follow a comment
  by a different author are also worth more (15) because that signals
  there's ongoing conversation between people, not just a series of
  notes being left by one individual.

In terms of implementation, we persist the score on the bubble
whenever it changes, but we handle the decay on the client side. That
allows us to cache the bubble representation without having to
continually change it while its activity decays.

We also keep a separate `activity_score_order` attribute on the model.
This can be used to sort the bubbles in order of "most active", without
having to think about the decay.
2025-03-05 17:16:31 +00:00
Kevin McConnell a65d7b0397 Don't blow up on missing comment 2025-03-05 16:51:14 +00:00
Kevin McConnell 748d09a5f7 Cache comment partial 2025-03-03 17:04:16 +00:00
Kevin McConnell 49fa8b21a6 Move current user check to controller
This is necessary to a) ensure people can't edit/delete comments they
don't own, and b) make the comment partial cacheable.
2025-03-03 17:04:16 +00:00
Jason Zimdars 65ceb3c5f0 Tighten-up headings so they look good when they wrap to two lines (rare) 2025-03-03 09:04:37 -07:00
Jason Zimdars 72592ec3cc Order events in the cluster so that the oldest is closest to the timestamp 2025-03-03 09:04:08 -07:00
Jason Zimdars a87ffd6473 Avoid squishing the switch when the bucket name is very long 2025-03-03 08:55:49 -06:00
Kevin McConnell e7da0d5327 Merge pull request #276 from basecamp/autosave-comments
Autosave comments
2025-02-28 15:30:21 +00:00
Kevin McConnell 5d1206e067 remote-auto-save -> outlet-auto-save 2025-02-28 15:15:09 +00:00
Kevin McConnell 4d13db0f8b Rename to local-save-controller 2025-02-28 15:13:23 +00:00
Kevin McConnell 06dcb11e4b Refactor the controller a little bit 2025-02-28 15:12:10 +00:00
Kevin McConnell a7cde91a10 Don't save draft comment to local storage
Since we already save this to the database, along with the title.
2025-02-28 14:50:26 +00:00
Kevin McConnell bb2a2c618b Don't lose formatting in draft comment
When displaying a bubble in the `creating` state, we were wrongly using
the plaintext version of the draft comment. This has the effect of
losing formatting whenever the page is saved and reloaded.
2025-02-28 12:43:22 +00:00
Kevin McConnell eaf4903afc Formatting 2025-02-28 11:48:29 +00:00