Skip to content

pre-build or provide stable hashing for "specialpages" #7213

@Loki-Afro

Description

@Loki-Afro

Describe the bug
The code in question is here

const convertTypescript = (content: string) => {
const outputRaw = buildSync({
stdin: {
contents: content,
resolveDir: path.join(settings.root, 'var','js'),
loader: 'js'
},
alias:{
"ep_etherpad-lite/static/js/browser": 'ep_etherpad-lite/static/js/vendors/browser',
"ep_etherpad-lite/static/js/nice-select": 'ep_etherpad-lite/static/js/vendors/nice-select'
},
bundle: true, // Bundle the files together
minify: process.env.NODE_ENV === "production", // Minify the output
sourcemap: !(process.env.NODE_ENV === "production"), // Generate source maps
sourceRoot: settings.root+"/src/static/js/",
target: ['es2020'], // Target ECMAScript version
metafile: true,
write: false, // Do not write to file system,
})
const output = outputRaw.outputFiles[0].text
return {
output,
hash: outputRaw.outputFiles[0].hash.replaceAll('/','2').replaceAll("+",'5').replaceAll("^","7")
}
}

every time an etherpad deployment starts it generates new hashes for the same files although their content hasn't changed

imagine the following environment
ingress -> etherpad service -> multiple etherpad pods
you are using socket.io under the hood which is versatile however the plain js code is kinda bound to one pod since each pod will have their own hashes.
so if one pod serves some html references its js with its own hashes but next request goes to a pod which has other hashes this results in a 404

To Reproduce
Steps to reproduce the behavior:

  1. start with prod and put a breakpoint here
    const padSliderWrite = convertTypescript(padString)
  2. see whats hashed
  3. restart
  4. compare new hash

Expected behavior
hashes are stable

Server (please complete the following information):

  • Etherpad version: 2.5.2

Additional context
this makes it very hard to run multiple etherpad pods at once even though socket.io already provides a nice basis

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions