Skip to content

Instantly share code, notes, and snippets.

@yuvve
Last active September 7, 2024 18:43
Show Gist options
  • Save yuvve/184165ab645a46f5fdc453981a249014 to your computer and use it in GitHub Desktop.
Save yuvve/184165ab645a46f5fdc453981a249014 to your computer and use it in GitHub Desktop.
Run Overleaf with Traefik

Overleaf

To add Overleaf to your Traefik stack you should use the Overleaf Toolkit with very minimal adjustments (taken from this issue comment).

Please read the quick start guide and config guide.

Toolkit configuration

  1. Clone the toolkit repo into your server
  2. run toolkit/bin/init
  3. Edit config/overleaf.rc (more info) to your liking, make sure that:
    1. OVERLEAF_LISTEN_IP=0.0.0.0
    2. NGINX_ENABLED=false
  4. Edit config/variables.env to your liking

Toolkit modifications

I call my Traefik network traefik, but you need to change it to whatever network you have your Traefik instance running on.

lib/docker-compose.base.yml

Add at the top:

networks:
    traefik:
        name: traefik
    sharelatex:
        name: sharelatex

Disable ports (in the sharelatex service):

        #ports:
            #- "${OVERLEAF_LISTEN_IP:-127.0.0.1}:${OVERLEAF_PORT:-80}:80"

Add to the sharelatex service:

        networks:
            - traefik
            - sharelatex
        labels:
            - traefik.enable=true
            - traefik.docker.network=traefik
            - traefik.http.services.sharelatex.loadbalancer.server.port=80
            - traefik.http.routers.sharelatex.rule=Host(`overleaf.DOMAIN.TLD`, `www.overleaf.DOMAIN.TLD`)
            - traefik.http.routers.sharelatex.entrypoints=websecure
            - traefik.http.routers.sharelatex.service=sharelatex
            - traefik.http.routers.sharelatex.tls=true
            - traefik.http.routers.sharelatex.tls.certresolver=production

lib/docker-compose.mongo.yml

Add at the top:

networks:
    sharelatex:
        name: sharelatex

Add to mongo service:

        networks:
          - sharelatex

lib/docker-compose.redis.yml

Add at the top:

networks:
    sharelatex:
        name: sharelatex

Add to redis service:

        networks:
          - sharelatex

Run the instance

  1. Run toolkit/bin/up -d
  2. Follow the quick guide instructions (open overleaf.DOMAIN.TLD/launchpad).
  3. If you want a full LaTeX install, or specific LaTeX packages, then follow this guide.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment