Commit Graph

547 Commits

Author SHA1 Message Date
Jason Zimdars 2382326a13 Merge pull request #1638 from basecamp/expand-activity-columns
Expand activity columns
2025-11-21 09:11:22 -06:00
Jorge Manrubia c1f5699443 Switch READ-COMMITED so that queries see the last committed data
This should help solving the problem with overlapping bundles

It is what we use in HEY and Basecamp
2025-11-21 14:35:29 +01:00
Jorge Manrubia 6e20c8c68f Add brakeman rule 2025-11-21 10:42:08 +01:00
Jorge Manrubia e4558f00ab Merge branch 'main' into expand-activity-columns 2025-11-21 10:25:39 +01:00
David Heinemeier Hansson ae640198ae Stick with the same general retention policy we use for everything 2025-11-21 09:40:50 +01:00
David Heinemeier Hansson 0a88565bd7 Slim down 2025-11-21 09:39:59 +01:00
David Heinemeier Hansson f66da318aa No longer needed now that we are back to a single DB 2025-11-21 09:39:33 +01:00
David Heinemeier Hansson 62d4998f27 We stopped using load_async in the code base 2025-11-21 09:35:25 +01:00
Mike Dalessio 2c2a1c4b4a Make sure jobs are enqueued only after all transactions are committed
This should fix the recurring ActiveStorage::FileNotFoundError errors
from ActiveStorage::AnalyzeJob.

The issue is that, when images are not direct uploaded (e.g. a card
background image or avatar image), the AnalyzeJob has been getting
enqueued before the file itself was uploaded to blob storage.

Setting ActiveJob::Base.enqueue_after_transaction_commit = true makes
sure that jobs are always enqueued only once *all* transactions have
been committed.

This will be the Rails default at some point, but for now we still
need to explicitly set it.

Big thanks to @jeremy for the assist. 👏
2025-11-20 18:47:42 -05:00
Mike Dalessio 362be963c0 Add a very rudimentary admin dashboard. 2025-11-19 14:23:47 -05:00
Jason Zimdars eba749a193 Expand activity columns 2025-11-19 12:48:36 -06:00
Fernando Álvarez 672816dec5 Move production jobs to specific hosts 2025-11-19 19:12:02 +01:00
Fernando Álvarez a6a4bb236b Split jobs hosts for Staging
Related to https://3.basecamp.com/2914079/buckets/37331921/todos/9266308208
2025-11-19 18:31:29 +01:00
Mike Dalessio 711cc8568e Fix account slugs in Active Storage URLs 2025-11-19 08:51:12 -05:00
Mike Dalessio 3b717bbe0d Move AccountSlug::Extractor later in the stack
so that in development, it runs after reloading; but still before the
database selector middleware in case we ever want to do something
account-specific.
2025-11-18 09:20:47 -05:00
Kevin McConnell 9b3b2f5d29 Prevent pinning writes in non-primary DCs 2025-11-18 11:03:58 +00:00
Kevin McConnell d584950457 Consolidate staging MySQL replica hostname 2025-11-18 08:29:42 +00:00
Mike Dalessio 695037c7ee Make sure rack-mini-profiler doesn't load in test 2025-11-17 15:03:26 -05:00
Mike Dalessio e3ce26c53d rubocop: more style fixes 2025-11-17 14:54:42 -05:00
Kevin McConnell a7ff18c437 Add regional cache DBs for production 2025-11-17 17:49:26 +00:00
Stanko K.R. 0b8c51c2e9 Preload cards for columns 2025-11-17 16:16:19 +01:00
Mike Dalessio 2a1817d902 Bringing back the TurboStreamsExtension
so that, for example, notification content contains the URLs properly
scoped to the account.
2025-11-17 09:12:41 -05:00
Mike Dalessio 142a342e53 Make sure ActiveJob preserves the current account context
This is a pretty common pattern, something like this is in both
ActiveRecord::Tenanted and ActsAsTenanted.
2025-11-17 09:12:41 -05:00
Mike Dalessio 62f469f609 brakeman: remove two obsolete ignore entries 2025-11-17 09:12:41 -05:00
Mike Dalessio 5ca2df22ce Load recurring jobs in development 2025-11-17 09:12:41 -05:00
Kevin McConnell ac9824122b Use direct hostnames for MySQL replicas (for now)
We will move this back to a single endpoint once the F5 setup is ready.
2025-11-17 09:12:41 -05:00
Kevin McConnell dcd8536e0c Set regional Solid Cache instances 2025-11-17 09:12:41 -05:00
Kevin McConnell 436caa8f74 Revert "Logging tweaks"
Debug logging interferes with the structured logging, so let's take that
back out.
2025-11-17 09:12:41 -05:00
Kevin McConnell 47f481525b Logging tweaks
- Enable debug logging
- Disable health check logs
- Set Solid Queue logger
2025-11-17 09:12:41 -05:00
Stanko K.R. a1d44b02ea Change the symbol to a string 2025-11-17 09:12:41 -05:00
Stanko K.R. a9e052d8cb Explicitly use a shard for caching
See: https://github.com/rails/solid_cache/pull/219
2025-11-17 09:12:41 -05:00
Mike Dalessio e3d86bb21e Clean up some spots where "current account" is ambiguous
Primarily this is in tests (which were caught by temporarily
introducing acts_as_tenant and enabling safety checks), but notably
action cable connections were not working properly, and that's now
fixed.
2025-11-17 09:12:41 -05:00
Stanko K.R. 488c74d99e Always use the cache db for caching 2025-11-17 09:12:41 -05:00
Kevin McConnell fd3ad90f47 Remove outdated job reference 2025-11-17 09:12:41 -05:00
Kevin McConnell 11a38a4526 Initial (wip) staging deployment
This adds an initial configuration for staging. Note that we are doing
this ahead of having the full infrastructure in all 3 DCs. So this
this will result in some cross-DC writes for now (e.g. we have a single cache in
IAD). We'll correct this as the infrastructure becomes available.

We'll also run jobs on every app server, until we split them out to
separate instances.
2025-11-17 09:12:41 -05:00
Mike Dalessio aca00d6218 Configure a reading: connection for solid gems
because I'm getting exceptions from Mission Control
2025-11-17 09:12:41 -05:00
Stanko K.R. e0693de7c3 Scope jobs and controllers by account 2025-11-17 09:12:41 -05:00
Mike Dalessio fe6df7085f Finish the rollout of account_id to all core data models
Schema:
- add account_id to tables it was missing from
- make account_id a required column everywhere
- add [account_id] indexes, or add `account_id` to existing indices

Models:
- add `belongs_to :account` to all models (default to using a domain
  model's account whenever possible)
- add account_id in all the necessary fixtures
- add account_id to insert_all hashes
- pass account_id to a few initialize calls

Miscellaneous:
- update the import script to set account_id

Note that I'm not adding account_id to the join tables primarily
because I couldn't think of an easy way to populate it without making
it a full Join model, and that was more work than I have time to take
on right now.
2025-11-17 09:12:40 -05:00
Mike Dalessio 5a7f08067a Move setting Current.account into the middleware
so that code called from the Rails controllers can use Current.account
2025-11-17 09:12:40 -05:00
Stanko K.R. 34d83aaa7c Fix tests after the removal of memberships 2025-11-17 09:12:40 -05:00
Mike Dalessio adaf6966c6 brakeman: drop two obsolete warnings, ignore new searchable sql 2025-11-17 09:12:36 -05:00
Donal McBreen 6323e0abee Use uuid as the id type in schema.rb
This matches the format in the migration files and makes the type_to_sql
override redundant.

The only wart we are left with is that since there are no true UUID
types in MySQL we'll have to assume that binary(16) columns are UUIDs.

In practice this is probably fine as the MySQL adapter doesn't map any
other types to binary.
2025-11-17 09:12:36 -05:00
Donal McBreen ac82f20051 Memoize native_database_types and consolidate modules 2025-11-17 09:12:36 -05:00
Donal McBreen d81b7af7bb Switch to binary and add uuid as a native type for MySQL 2025-11-17 09:12:36 -05:00
Donal McBreen 8ec5c1af5c Use Binary::Data for serialization
This handles quoting for us automatically
2025-11-17 09:12:36 -05:00
Donal McBreen f6ec9bbeea Use a custom class for Uuid values 2025-11-17 09:12:35 -05:00
Donal McBreen f4729577b6 Use uuids in the search_index tables too 2025-11-17 09:12:35 -05:00
Donal McBreen fc56ad9d7c Combine uuid-old and uuid branch changes
- Switch to binary 16 for UUID keys
- Remove AccountScopedRecord base class, all model use binary uuids now
- Fix the search sql to serialize uuids properly
- Patch the MySQL schema dumper to output binary lengths
2025-11-17 09:12:34 -05:00
Mike Dalessio e4011ef211 Update primary keys on customer data to UUIDs
- schema changes to primary and foreign keys
- fixture changes
- customer data models subclass AccountScopedRecord
- import script updated
2025-11-17 09:12:30 -05:00
Stanko K.R. 71a332bb08 Remove dead code 2025-11-17 09:12:17 -05:00