1
0
Fork 0
mirror of https://github.com/overleaf/toolkit.git synced 2025-04-19 15:28:06 +02:00

Merge pull request #258 from overleaf/jpa-pull-texlive

bin/up: pull TeX Live images before starting up
This commit is contained in:
Jakob Ackermann 2024-05-28 11:49:18 +02:00 committed by GitHub
commit ed8513ac91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 1 deletions

View file

@ -1,5 +1,9 @@
# Changelog
## 2024-05-27
### Added
- Pull TeX Live images from `bin/up`
## 2024-05-24
### Added
- Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.0.4`.

27
bin/up
View file

@ -46,6 +46,29 @@ function initiate_mongo_replica_set() {
mongo --eval "rs.initiate({ _id: \"overleaf\", members: [ { _id: 0, host: \"mongo:27017\" } ] })" > /dev/null'
}
function pull_sandboxed_compiles() {
if [[ "${SIBLING_CONTAINERS_PULL:-true}" == "false" ]]; then
echo "Skipping pulling of TeX Live images"
return
fi
local images=$(read_variable "ALL_TEX_LIVE_DOCKER_IMAGES")
if [[ -z "$images" ]]; then
echo
echo "Please configure ALL_TEX_LIVE_DOCKER_IMAGES in $TOOLKIT_ROOT/config/variables.env"
echo
echo "You can read more about configuring Sandboxed Compiles in our documentation:"
echo " https://github.com/overleaf/overleaf/wiki/Server-Pro:-sandboxed-compiles#changing-the-texlive-image"
echo
exit 1
fi
echo "Pulling TeX Live images..."
for image in ${images//,/ }; do
echo " - $image download started (may take some time)"
docker pull $image
echo " - $image download finished"
done
}
function __main__() {
if [[ "${1:-null}" == "help" ]] || [[ "${1:-null}" == "--help" ]]; then
usage
@ -60,6 +83,10 @@ function __main__() {
initiate_mongo_replica_set
fi
if [[ "$SIBLING_CONTAINERS_ENABLED" == "true" ]]; then
pull_sandboxed_compiles
fi
exec "$TOOLKIT_ROOT/bin/docker-compose" up "$@"
}

View file

@ -16,6 +16,8 @@ When sandboxed compiles are enabled, the toolkit will mount the docker socket fr
In `config/overleaf.rc`, set `SIBLING_CONTAINERS_ENABLED=true`, and ensure that the `DOCKER_SOCKET_PATH` setting is set to the location of the docker socket on the host.
The next time you start the docker services (with `bin/up`), the overleaf container will verify that it can communicate with docker on the host machine, and will pull the `texlive` image it requires to create the sandboxed compile containers. This process can take several minutes, and compiles will be un-available during this time.
The next time you start the docker services (with `bin/up`), the requested TeX Live image (`ALL_TEX_LIVE_DOCKER_IMAGES`) will get downloaded. This process can take several minutes. Once the images have been downloaded, the Server Pro container will get started with the latest configuration changes applied (such as enabling the Sandboxed Compiles feature or adding new TeX Live images).
You can skip the download of images using `SIBLING_CONTAINERS_PULL=false` in `config/overleaf.rc`.
Note: We do not support running sandboxed compiles with Docker as installed via `snap`. Please follow the steps for installing Docker CE on https://docs.docker.com/engine/install/.

View file

@ -125,3 +125,9 @@ function check_sharelatex_env_vars() {
fi
fi
}
function read_variable() {
local name=$1
grep -E "^$name=" "$TOOLKIT_ROOT/config/variables.env" \
| sed -r "s/^$name=([\"']*)(.+)\1*\$/\2/"
}