/ctan-mirror-docker

Dockerised CTAN mirror

Primary LanguageShellGNU Affero General Public License v3.0AGPL-3.0

A Dockerized CTAN mirror

A Docker image for mirroring the CTAN, aka Comprehensive TeX Archive Network. Available on the Docker Hub as gutenberg/ctan-mirror.

This image is based on Alpine, use Nginx to serve CTAN directories and crontab with rsync for synching with the master CTAN archive.

You need (as of December, 2020) approximately 43 Go of available disk space to mirror the CTAN.

Getting started

Run with Docker, binding on port 8080:

docker run -p 8080:80 gutenberg/ctan-mirror

You can then access the mirror on http://localhost:8080.

Note: for a server deployment, we suggest you launch the container a localhost port - and then reverse-proxy it to the domain name of your choice (eg. Nginx; Apache2).

Options

Env variable Meaning Default Value
CTAN_RSYNC_MIRROR The rsync mirror URI to sync from rsync.dante.ctan.org/CTAN
SYNC_CRON_PERIOD The rsync cron periodicity 42 6,12,18,23 * * *
RANDOM_MODULO Random modulo used to differ the sync script (used with $[RANDOM%<RANDOM_MODULO>]) 179

For eg., to launch the CTAN mirror on port 8282, synchronizing each day at 3 am and mounting the archive directory to ./ctan_mirror, you can use:

docker run -p 8282:80 -e SYNC_CRON_PERIOD="0 3 * * *" -v ./ctan_mirror:/var/ctan_mirror gutenberg/ctan-mirror

Persistency

To enable persistency of the synchronized CTAN data (and avoid losing the data on the container restarts), you should mount the container /var/ctan_mirror directory. You have two main choices:

  • mount it to a host directory, for eg. with -v /var/my_host_directory_for_ctan:/var/ctan_mirror
  • use a named Docker volume, for eg. with my_named_volume_ctan_mirror:/var/ctan_mirror

Building the image from code

Build image with Docker:

docker build -t gutenberg/ctan-mirror .

Resources

Credits

This image is brought to you by the GUTenberg team, the French user group of TeX, LaTeX and others.