Skip to content

Commit

Permalink
Merge pull request #5 from lcpu-club/feat-texlive-image
Browse files Browse the repository at this point in the history
feat: select compiler image closes #6
  • Loading branch information
HolgerHuo authored Oct 5, 2024
2 parents 5181fd3 + 1d4ae83 commit 12545ec
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
9 changes: 7 additions & 2 deletions docker-compose-lcpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ services:
OVERLEAF_LEFT_FOOTER: '[{"text": "由北京大学学生 Linux 俱乐部构建并维护. 感谢 <a href=\"https://osslab-pku.github.io\">北京大学开源软件数据分析实验室</a>支持"},{"text":"<a href=\"https://github.com/lcpu-club/overleaf\">GitHub repo</a>"} ]'
OVERLEAF_RIGHT_FOOTER: '[{"text": "v0.2.0-alpha, pre stable release"} ]'
OVERLEAF_SITE_LANGUAGE: 'zh-CN'
TEX_LIVE_DOCKER_IMAGE: "code.lcpu.dev/lcpu/sharelatex-base:2024"
ALL_TEX_LIVE_DOCKER_IMAGES: "code.lcpu.dev/lcpu/sharelatex-base:2024"
OVERLEAF_IS_SERVER_PRO: true
# Sandboxed Compile
DOCKER_RUNNER: true
DOCKER_USER: "www-data"
SANDBOXED_COMPILES_HOST_DIR: '/opt/volumes/sharelatex/data/data/compiles'
SANDBOXED_COMPILES_CONTAINER_TIMEOUT: 3600000
TEX_LIVE_DOCKER_IMAGE: "code.lcpu.dev/lcpu/sharelatex-base:2024.1"
ALL_TEX_LIVE_DOCKER_IMAGES: "code.lcpu.dev/lcpu/sharelatex-base:2024.1,code.lcpu.dev/lcpu/sharelatex-base:2022.1,code.lcpu.dev/lcpu/sharelatex-base:2020.1"
ALL_TEX_LIVE_DOCKER_IMAGE_NAMES: "TeX Live 2024,TeX Live 2022,TeX Live 2020"

mongo:
restart: always
Expand Down
20 changes: 16 additions & 4 deletions server-ce/config/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,29 @@ const parseIntOrFail = function (value) {

const DATA_DIR = '/var/lib/overleaf/data'
const TMP_DIR = '/var/lib/overleaf/tmp'
const images = process.env.ALL_TEX_LIVE_DOCKER_IMAGES.split(',')
const imageNames = process.env.ALL_TEX_LIVE_DOCKER_IMAGE_NAMES.split(',')

if (images.length !== imageNames.length) {
throw new Error(`image and imageName count mismatched`)
}
const allowedImageNames = []

images.forEach((_, i) => {
allowedImageNames.push({imageName: images[i], imageDesc: imageNames[i]})
});
const settings = {
clsi: {
optimiseInDocker: process.env.OPTIMISE_PDF === 'true',
dockerRunner: true,
dockerRunner: process.env.DOCKER_RUNNER === 'true',
docker: {
maxContainerAge: 3600000,
image: "code.lcpu.dev/lcpu/sharelatex-base:2024",
user: "www-data",
maxContainerAge: process.env.SANDBOXED_COMPILES_CONTAINER_TIMEOUT,
image: process.env.TEX_LIVE_DOCKER_IMAGE,
user: process.env.DOCKER_USER,
},
},

allowedImageNames: allowedImageNames,

brandPrefix: '',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const ProjectOptionsHandler = {
throw new Error(`invalid imageName: ${imageName}`)
}
const conditions = { _id: projectId }
const update = { imageName: settings.imageRoot + '/' + imageName }
const update = { imageName: imageName }
return Project.updateOne(conditions, update, {})
},

Expand Down

0 comments on commit 12545ec

Please sign in to comment.