
Overleaf is an open-source LaTeX editor with a browser-based interface. It supports real-time collaboration, allowing multiple users to edit the same LaTeX document simultaneously. The Community Edition is the self-hosted variant, built for deployment on private infrastructure.
This article covers the deployment of Overleaf Community Edition on Linux using Docker Compose. It explains how to configure the Overleaf Toolkit and secure the installation with HTTPS using a Traefik reverse proxy.
Before you begin, you need to:
overleaf.example.com).The Overleaf Toolkit manages MongoDB, Redis, and the Overleaf application as a single Docker Compose stack. Application configuration resides in config/overleaf.rc and config/variables.env. A separate Traefik container handles TLS termination and certificate provisioning through Let's Encrypt.
Clone the official Overleaf Toolkit repository to your home directory.
Switch to the Overleaf Toolkit directory.
Initialize the configuration files using the provided initialization script.
The above command creates a config directory with three configuration files:
overleaf.rc: The main configuration file that controls top-level settings for your Overleaf instance.variables.env: Environment variables that are loaded into the Docker containers.version: Specifies the version of the Overleaf Docker images to use.Create the directory for the Traefik route configuration.
Open the variables.env file using a text editor.
Locate the Overleaf configuration variables and update them as follows:
overleaf.example.com with your actual domain name.Save and close the file.
OVERLEAF_BEHIND_PROXY and OVERLEAF_SECURE_COOKIE are required when Overleaf runs behind a reverse proxy. Omitting these causes cookie and redirect failures under HTTPS.
Open the main overleaf.rc configuration file.
Set SIBLING_CONTAINERS_ENABLED to false. The Community Edition does not support sibling containers. Leaving this enabled prevents the application from starting.
Save and close the file.
The overleaf.rc file controls:
OVERLEAF_DATA_PATH: Directory where Overleaf stores project data.SIBLING_CONTAINERS_ENABLED: Must be set to false for the Community Edition.MONGO_ENABLED: Enables the bundled MongoDB container.REDIS_ENABLED: Enables the bundled Redis container for caching.OVERLEAF_PORT: The port the Overleaf container listens on.Create a .env file in the toolkit directory to store the shared environment variables. Replace the values as indicated below.
Add the following environment variables:
Replace:
overleaf.example.com with your registered domain name.admin@example.com with your email address.192.0.2.1 with your server's public IP address.Save and close the file.
Create the Traefik route file for Overleaf.
Add the following configuration. Replace overleaf.example.com with your registered domain name:
Save and close the file.
The Overleaf Toolkit does not add Traefik labels to its generated containers. This static route file tells Traefik how to reach the sharelatex container on the internal Docker network without requiring labels.
Create the Docker Compose file for the Traefik container.
Add the following manifest:
Save and close the file.
Traefik joins the overleaf_default network that the Overleaf Toolkit creates. Binding the host ports to the server's public IP avoids a conflict with the Overleaf container, which binds to 127.0.0.1 on the same host. Port 80 handles the Let's Encrypt HTTP challenge and the HTTP-to-HTTPS redirect. Port 443 serves all proxied HTTPS traffic.
The Overleaf Toolkit starts MongoDB, Redis, and the Overleaf application container. Traefik runs as a separate service on the same Docker network and handles TLS termination.
The Overleaf Toolkit uses shell scripts to manage the Docker Compose deployment. Review the scripts in the bin/ directory before running them to understand their functionality.
Add your user account to the docker group to run Docker commands without sudo. This is required for the Overleaf Toolkit scripts to function correctly.
Apply the new group membership to your current session.
Run the Overleaf Toolkit doctor script to verify all dependencies are installed correctly.
The output displays the host information, dependency checks, and the Docker daemon status. Verify that all dependencies show status: present and the Docker daemon shows status: up.
The warning about SIBLING_CONTAINERS_ENABLED=false is expected for the Community Edition. It indicates that users have full access to the sharelatex container resources during LaTeX compiles. Only use this mode in environments where all users are trusted.
Start the Overleaf containers in detached mode.
This command starts the following services:
sharelatex: The main Overleaf application container.mongo: MongoDB database for storing user data and project metadata.redis: Redis server for caching and session management.Check the status of all running containers.
Output:
Start the Traefik reverse proxy container.
Verify that the Traefik container is running.
Output:
Confirm that Traefik has applied the route and provisioned the TLS certificate by checking the logs.
The log output contains entries indicating that the route was applied and the certificate was obtained from Let's Encrypt. Initial certificate provisioning may take a few seconds after the container starts.
Overleaf requires an administrator account before you can create LaTeX projects. The registration page is available at the /launchpad path on first access.
Open your browser and navigate to the Overleaf launchpad page. Replace overleaf.example.com with your registered domain name.
Enter an email address and a strong password in the registration form.
Click Register to create the administrator account. You are redirected to the login page.
Enter your administrator email and password to log in to Overleaf. The welcome page displays after a successful login.
Navigate to the Admin panel. Replace overleaf.example.com with your registered domain name.
Click Manage Users to view the user management interface.
Use the user management interface to create new user accounts or manage existing users.
Overleaf supports multiple simultaneous projects. Each project has its own editor and a PDF compilation pipeline that runs inside the sharelatex container.
Navigate to the Overleaf project dashboard. Replace overleaf.example.com with your registered domain name.
Click Create a new project and select Example project from the available options.
Enter a name for your project, such as My First Document, and click Create.
The editor opens with a default LaTeX template.
Make some changes, then click Recompile to compile the document.
Verify that the PDF preview panel displays the compiled document.
Click Download PDF to download the compiled document to your workstation.
You have deployed Overleaf Community Edition on Ubuntu 24.04 using Docker Compose and secured the installation with HTTPS through a Traefik reverse proxy. The platform manages MongoDB, Redis, and the Overleaf application, with TLS certificates provisioned and renewed automatically through Let's Encrypt. For more information, refer to the official Overleaf Toolkit documentation.
0 Comments
Be the first to comment and share your perspective with the community.