1
0
Fork 0
mirror of https://github.com/overleaf/overleaf.git synced 2025-04-21 03:53:39 +00:00
overleaf/services/history-v1
Jakob Ackermann a530cca2c5 [history-v1] increase timeout for preparing test environment ()
GitOrigin-RevId: a11a16f07da61603218ff14bef32172d4f32c469
2025-03-18 09:05:53 +00:00
..
api Merge pull request from overleaf/em-async-await-persist-changes 2025-02-07 09:05:44 +00:00
backupVerifier Add verification looper and handle shutdown signals 2025-03-18 09:04:54 +00:00
benchmarks
config Add script for verifying sampled sets of projects 2025-03-12 09:05:35 +00:00
migrations
storage Merge pull request from overleaf/bg-warn-old-pending-changes 2025-03-18 09:05:49 +00:00
test [history-v1] increase timeout for preparing test environment () 2025-03-18 09:05:53 +00:00
.gitignore
.mocharc.json
.nvmrc
app.js
backup-deletion-app.mjs
backup-verifier-app.mjs Add verification looper and handle shutdown signals 2025-03-18 09:04:54 +00:00
backup-worker-app.mjs Merge pull request from overleaf/bg-fix-backup-worker 2025-03-12 09:05:04 +00:00
buildscript.txt [misc] align initializing of mongodb replica set () 2025-03-17 09:04:58 +00:00
docker-compose.ci.yml [misc] align initializing of mongodb replica set () 2025-03-17 09:04:58 +00:00
docker-compose.yml [misc] align initializing of mongodb replica set () 2025-03-17 09:04:58 +00:00
Dockerfile
install_deps.sh
knexfile.js
Makefile [misc] align initializing of mongodb replica set () 2025-03-17 09:04:58 +00:00
package.json Merge pull request from overleaf/ar-mocha-11 2025-02-28 09:05:40 +00:00
README.md
tsconfig.json [misc] align initializing of mongodb replica set () 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.