overleaf-cep/services/history-v1
Jakob Ackermann 81f0807fc6 [web] prepare filestore migration for Server Pro/CE (#27230)
* [web] prepare filestore migration for Server Pro/CE

* [history-v1] remove unused USER_FILES_BUCKET_NAME env var from script

* [server-ce] tests: write default docker-compose.override.yml on startup

* [server-ce] tests: extend access logging of host-admin for response

* [server-ce] tests: test text and binary file upload

* [server-ce] tests: add tests for filestore migration

* [web] simplify feature gate for filestore/project-history-blobs logic

Co-authored-by: Brian Gough <brian.gough@overleaf.com>

* [server-ce] test: fix flaky test helper

---------

Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: f89bdab2749e2b7a49d609e2eac6bf621c727966
2025-07-22 08:06:58 +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 [web] prepare filestore migration for Server Pro/CE (#27230) 2025-07-22 08:06:58 +00:00
test [history-v1] make back_fill_file_hash_fix_up compatible with Server Pro (#27280) 2025-07-22 08:06:41 +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 #27255 from overleaf/revert-27252-revert-26843-csh-issue-26608-mongo8-dev-ci 2025-07-22 08:05:25 +00:00
docker-compose.yml Merge pull request #27255 from overleaf/revert-27252-revert-26843-csh-issue-26608-mongo8-dev-ci 2025-07-22 08:05:25 +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.