overleaf-cep/services/history-v1
Christopher Hoskin f4dc8f7ebc Merge pull request #27252 from overleaf/revert-26843-csh-issue-26608-mongo8-dev-ci
Revert "Upgrade the dev environment and CI to mongo 8"

GitOrigin-RevId: f2145812a5c1cf8d3d3ac31c76cc4aed4ea9d46d
2025-07-21 08:05:01 +00:00
..
api Merge pull request #27025 from overleaf/bg-delete-redis-buffer-when-project-deleted 2025-07-11 08:06:08 +00:00
backupVerifier Allow scaling in getEndDateForRPO 2025-03-27 14:16:40 +00:00
benchmarks Add prefer-node-protocol ESLint rule (#21532) 2024-11-11 09:04:51 +00:00
config Merge pull request #26477 from overleaf/em-redis-buffer-resync 2025-06-18 08:06:17 +00:00
migrations Merge pull request #24967 from overleaf/em-chunks-concurrency-pg-migration 2025-04-18 08:05:29 +00:00
storage Merge pull request #27173 from overleaf/bg-filestore-migration-remove-backups 2025-07-18 08:06:14 +00:00
test Merge pull request #27173 from overleaf/bg-filestore-migration-remove-backups 2025-07-18 08:06:14 +00:00
.mocharc.json Avoid duplicating a math-closing dollar sign (#11227) 2023-01-16 08:41:42 +00:00
.nvmrc Update node to 22.17.0 2025-07-09 08:06:01 +00:00
app.js [misc] improve logging in history system (#26086) 2025-06-04 08:05:50 +00:00
backup-deletion-app.mjs Merge pull request #21829 from overleaf/jpa-backup-deletion 2024-11-18 09:05:44 +00:00
backup-verifier-app.mjs Don't run the verifier loop when app created from test 2025-04-17 08:06:11 +00:00
backup-worker-app.mjs Merge pull request #24237 from overleaf/bg-fix-backup-worker 2025-03-12 09:05:04 +00:00
buildscript.txt Update node to 22.17.0 2025-07-09 08:06:01 +00:00
docker-compose.ci.yml Merge pull request #27252 from overleaf/revert-26843-csh-issue-26608-mongo8-dev-ci 2025-07-21 08:05:01 +00:00
docker-compose.yml Merge pull request #27252 from overleaf/revert-26843-csh-issue-26608-mongo8-dev-ci 2025-07-21 08:05:01 +00:00
Dockerfile Update node to 22.17.0 2025-07-09 08:06:01 +00:00
install_deps.sh Merge pull request #22092 from overleaf/jpa-jq 2024-11-28 09:05:02 +00:00
knexfile.js Avoid duplicating a math-closing dollar sign (#11227) 2023-01-16 08:41:42 +00:00
Makefile Update node to 22.17.0 2025-07-09 08:06:01 +00:00
package.json Merge pull request #26353 from overleaf/bg-history-redis-extend-persist-worker 2025-06-17 08:05:55 +00:00
README.md Avoid duplicating a math-closing dollar sign (#11227) 2023-01-16 08:41:42 +00:00
tsconfig.json [misc] align initializing of mongodb replica set (#24287) 2025-03-17 09:04:58 +00:00

Database migrations

The history service uses knex to manage PostgreSQL migrations.

To create a new migrations, run:

npx knex migrate:make migration_name

To apply migrations, run:

npx knex migrate:latest

For more information, consult the knex migrations guide.

Global blobs

Global blobs are blobs that are shared between projects. The list of global blobs is stored in the projectHistoryGlobalBlobs Mongo collection and is read when the service starts. Changing the list of global blobs needs to be done carefully.

Adding a blob to the global blobs list

If we identify a blob that appears in many projects, we might want to move that blob to the global blobs list.

  1. Add a record for the blob to the projectHistoryGlobalBlobs collection.
  2. Restart the history service.
  3. Delete any corresponding project blobs.

Removing a blob from the global blobs list

Removing a blob from the global blobs list is trickier. As soon as the global blob is made unavailable, every project that needs the blob will have to get its own copy. To avoid disruptions, follow these steps:

  1. In the projectHistoryGlobalBlobs collection, set the demoted property to false on the global blob to remove. This will make the history system write new instances of this blob to project blobs, but still read from the global blob.

  2. Restart the history service.

  3. Copy the blob to all projects that need it.

  4. Remove the blob from the projectHistoryGlobalBlobs collection.

  5. Restart the history service.