2024-11-04 04:09:11 -05:00
|
|
|
import util from 'node:util'
|
2024-10-02 05:32:13 -04:00
|
|
|
const { promisify } = util
|
2024-06-10 04:41:39 -04:00
|
|
|
const sleep = promisify(setTimeout)
|
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const tags = ['server-ce', 'server-pro']
|
2023-05-16 13:41:10 -04:00
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const migrate = async client => {
|
2023-05-16 13:41:10 -04:00
|
|
|
const { db } = client
|
|
|
|
const count = await db.projects.countDocuments({
|
|
|
|
'overleaf.history.display': { $ne: true },
|
|
|
|
})
|
|
|
|
if (count > 0) {
|
2024-06-10 04:41:39 -04:00
|
|
|
console.error(`
|
|
|
|
-----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Full Project History migration not completed for ${count} projects.
|
|
|
|
|
|
|
|
Starting with Server Pro/Community Edition version 4.0,
|
|
|
|
all projects must use the full project history feature.
|
|
|
|
|
|
|
|
Release 3.5 includes a migration process. Please go back to version
|
|
|
|
3.5 and run through the migration process:
|
|
|
|
|
|
|
|
Overleaf Toolkit setups:
|
|
|
|
|
|
|
|
toolkit$ echo "3.5.13" > config/version
|
|
|
|
toolkit$ bin/up
|
|
|
|
|
|
|
|
Legacy docker compose setups/Horizontal scaling setups:
|
|
|
|
|
|
|
|
Update the image tag for "services -> sharelatex" to
|
|
|
|
Server Pro: quay.io/sharelatex/sharelatex-pro:3.5.13.
|
|
|
|
Community Edition: sharelatex/sharelatex:3.5.13
|
|
|
|
Then use "docker compose up" to apply the changes.
|
|
|
|
|
|
|
|
Documentation for the migration process:
|
|
|
|
https://github.com/overleaf/overleaf/wiki/Full-Project-History-Migration
|
|
|
|
|
|
|
|
|
|
|
|
Refusing to start up, exiting in 10s.
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------
|
|
|
|
`)
|
|
|
|
await sleep(10_000)
|
|
|
|
|
2023-05-16 13:41:10 -04:00
|
|
|
throw new Error(
|
|
|
|
`Found ${count} projects not migrated to Full Project History`
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-02 05:32:13 -04:00
|
|
|
const rollback = async client => {
|
2023-05-16 13:41:10 -04:00
|
|
|
// Not applicable
|
|
|
|
}
|
2024-10-02 05:32:13 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
tags,
|
|
|
|
migrate,
|
|
|
|
rollback,
|
|
|
|
}
|