box-archiveSetup Sandbox Compiles

There are a little difference between development and production environment, if you want to setup sandbox compile for dev. There are 3 things you need to mind:

  • File Permission Problem

  • Volume Share Between history-v1 and filestore

  • Subdirectories Problem

Enable Sandbox Compiles

Here, we just need to enable Sandbox Compiles like what we do in overleaf ce. However, we only need to mind the user. Here we set it to root.

In production environment, we use www-data as a shared user between overleaf container and tex compile container. However, in dev env, node is the default user in container. And there's no www-data user to hook this. So we just use root as a workaround.

circle-exclamation
#################
#   Sandbox     #
#################
SANDBOXED_COMPILES=true
TEXLIVE_IMAGE_USER=root
ALL_TEX_LIVE_DOCKER_IMAGES=ghcr.io/ayaka-notes/texlive-full:2025.1, ghcr.io/ayaka-notes/texlive-full:2024.1
ALL_TEX_LIVE_DOCKER_IMAGE_NAMES=Texlive 2025, Texlive 2024
TEX_LIVE_DOCKER_IMAGE=ghcr.io/ayaka-notes/texlive-full:2025.1

Fix File Permissions

LaTeX runs in the sibling containers as the user specified in the TEXLIVE_IMAGE_USER environment variable. In the example above this is set to root, which has uid 0. This creates a problem with the above permissions, as the root user does not have permission to write to subfolders of compiles.

A quick fix is to give the root group ownership and read write permissions to compiles, with setgid set so that new subfolders also inherit this ownership:

For detailed document, you can see services/clsi/README.md.

Volume Share Between history-v1 and filestore

By default, filestore act as a bridge between s3 and other services in overleaf. However, in overleaf ce or server pro, all files are stored locally by default. So, overleaf introduced a very tricky method.

And in the meantime, data/history is also used by history service. In this way, they can share the same data between different micro service. You need to add this volume history-v1-buckets to your filestore service in develop. Otherwise, clsi will not be able to pull blob files from filestore service.

Also you need to add BUCKET name to dev.env settings:

Use Subdirectories

Filestore use useSubdirectories as true by default, however, in development, history v1 will flatten all the data. This cause some conflict. To fix this, you need add the following:

In history v1, all project_blobs files are stored like this originally:

You need to set useSubdirectories to true to change it use subdir mode. Now, orignal _ in blob will be substitute as / .

Last updated