mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Sandboxed Compiles: support configurable texlive image root via env var
This commit is contained in:
@@ -29,7 +29,7 @@ The CLSI can be configured through the following environment variables:
|
|||||||
- `PROCESS_LIFE_SPAN_LIMIT_MS` - Process life span limit in milliseconds
|
- `PROCESS_LIFE_SPAN_LIMIT_MS` - Process life span limit in milliseconds
|
||||||
- `SMOKE_TEST` - Whether to run smoke tests
|
- `SMOKE_TEST` - Whether to run smoke tests
|
||||||
- `TEXLIVE_IMAGE` - The TeX Live Docker image to use for sibling containers, e.g. `us-east1-docker.pkg.dev/overleaf-ops/ol-docker/texlive-full:2026.1`
|
- `TEXLIVE_IMAGE` - The TeX Live Docker image to use for sibling containers, e.g. `us-east1-docker.pkg.dev/overleaf-ops/ol-docker/texlive-full:2026.1`
|
||||||
- `TEX_LIVE_IMAGE_NAME_OVERRIDE` - The name of the registry for the Docker image e.g. `us-east1-docker.pkg.dev/overleaf-ops/ol-docker`
|
- `TEX_LIVE_DOCKER_IMAGE_ROOT` - The name of the registry for the Docker image e.g. `us-east1-docker.pkg.dev/overleaf-ops/ol-docker`
|
||||||
- `TEXLIVE_IMAGE_USER` - When using sibling containers, the user to run as in the TeX Live image. Defaults to `tex`
|
- `TEXLIVE_IMAGE_USER` - When using sibling containers, the user to run as in the TeX Live image. Defaults to `tex`
|
||||||
- `TEXLIVE_OPENOUT_ANY` - Sets the `openout_any` environment variable for TeX Live (see the `\openout` primitive [documentation](http://tug.org/texinfohtml/web2c.html#tex-invocation))
|
- `TEXLIVE_OPENOUT_ANY` - Sets the `openout_any` environment variable for TeX Live (see the `\openout` primitive [documentation](http://tug.org/texinfohtml/web2c.html#tex-invocation))
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ function compile(req, res, next) {
|
|||||||
draft: request.draft,
|
draft: request.draft,
|
||||||
png2pdf: request.png2pdf,
|
png2pdf: request.png2pdf,
|
||||||
imageName: request.imageName
|
imageName: request.imageName
|
||||||
? request.imageName
|
? Path.basename(request.imageName)
|
||||||
: undefined,
|
: undefined,
|
||||||
rootResourcePath: request.rootResourcePath,
|
rootResourcePath: request.rootResourcePath,
|
||||||
stopOnFirstError: request.stopOnFirstError,
|
stopOnFirstError: request.stopOnFirstError,
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ const DockerRunner = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.texliveImageNameOveride != null) {
|
if (Settings.texliveImageNameOveride != null) {
|
||||||
const img = image.split('/')
|
const img = Path.basename(image)
|
||||||
image = `${Settings.texliveImageNameOveride}/${img[2]}`
|
image = `${Settings.texliveImageNameOveride}/${img}`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compileGroup === 'synctex-output') {
|
if (compileGroup === 'synctex-output') {
|
||||||
@@ -238,6 +238,7 @@ const DockerRunner = {
|
|||||||
const match = image.match(/:([0-9]+)\.[0-9]+|:TL([0-9]+)/)
|
const match = image.match(/:([0-9]+)\.[0-9]+|:TL([0-9]+)/)
|
||||||
// the rolling build does not follow our <year>.<version>.<patch> convention
|
// the rolling build does not follow our <year>.<version>.<patch> convention
|
||||||
const year = match ? match[1] || match[2] : 'rolling'
|
const year = match ? match[1] || match[2] : 'rolling'
|
||||||
|
|
||||||
env.PATH = `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/${year}/bin/x86_64-linux/`
|
env.PATH = `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/texlive/${year}/bin/x86_64-linux/`
|
||||||
const options = {
|
const options = {
|
||||||
Cmd: command,
|
Cmd: command,
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ module.exports = {
|
|||||||
parallelFileDownloads:
|
parallelFileDownloads:
|
||||||
parseInt(process.env.FILESTORE_PARALLEL_FILE_DOWNLOADS, 10) || 1,
|
parseInt(process.env.FILESTORE_PARALLEL_FILE_DOWNLOADS, 10) || 1,
|
||||||
filestoreDomainOveride: process.env.FILESTORE_DOMAIN_OVERRIDE,
|
filestoreDomainOveride: process.env.FILESTORE_DOMAIN_OVERRIDE,
|
||||||
texliveImageNameOveride: process.env.TEX_LIVE_IMAGE_NAME_OVERRIDE,
|
texliveImageNameOveride: process.env.TEX_LIVE_DOCKER_IMAGE_ROOT,
|
||||||
texliveOpenoutAny: process.env.TEXLIVE_OPENOUT_ANY,
|
texliveOpenoutAny: process.env.TEXLIVE_OPENOUT_ANY,
|
||||||
texliveMaxPrintLine: process.env.TEXLIVE_MAX_PRINT_LINE,
|
texliveMaxPrintLine: process.env.TEXLIVE_MAX_PRINT_LINE,
|
||||||
enablePdfCaching: process.env.ENABLE_PDF_CACHING === 'true',
|
enablePdfCaching: process.env.ENABLE_PDF_CACHING === 'true',
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const ProjectOptionsHandler = {
|
|||||||
if (!isAllowed) {
|
if (!isAllowed) {
|
||||||
throw new OError('invalid imageName', { imageName })
|
throw new OError('invalid imageName', { imageName })
|
||||||
}
|
}
|
||||||
return settings.imageRoot + '/' + imageName
|
return imageName
|
||||||
},
|
},
|
||||||
|
|
||||||
async setImageName(projectId, imageName) {
|
async setImageName(projectId, imageName) {
|
||||||
|
|||||||
@@ -20,3 +20,6 @@ if (process.env.SANDBOXED_COMPILES === 'true') {
|
|||||||
}
|
}
|
||||||
Settings.currentImageName = process.env.TEX_LIVE_DOCKER_IMAGE
|
Settings.currentImageName = process.env.TEX_LIVE_DOCKER_IMAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SandboxedCompilesModule = {}
|
||||||
|
export default SandboxedCompilesModule
|
||||||
|
|||||||
Reference in New Issue
Block a user