Add Overleaf as an app?

Summary

Overleaf is an open source collaborative latex editor. It can be installed on your own server then provides a web interface for multiple users to edit, compile, and view the document. It is now heavily used in academia especially. It would be useful to include it as a freedombox app to reduce the difficultly of installation.

Solution
There are a few sites with regular install instructions available, such as

However AFAIK they are mostly using a method based on docker and containers, which might not be suitable for smaller freedomboxes. It is hard to find install instructions which don’t rely on containers.

Tasks
Look around for any more suitable install instructions
If available, use them. Otherwise would need to study the source code directly.
Package overleaf first as a regular debian package
Then figure out how to wrap it as a freedombox app.

A bit more information on this: looks like there is a .deb package and tool for generating it available for an 2015 version of overleaf here, Debian/Ubuntu package generation removed · Issue #292 · overleaf/overleaf · GitHub . Hasn’t been updated since then as the main overleaf team have been focussed on the docker version. But either the 2015 deb could be used as is, or it could be updated to later versions.

I added it to FreedomBox wiki - Leaving The Cloud, but I’m concerned about the dependency on MongoDB. As I understand, it is currently under a license that cannot be used in Debian (main).

Thanks for adding to the wiki. Hmm, the mongo dependency sounds tricky, so I wonder how can overleaf claim to be open source if it relies on a non-open component there? Maybe someone will need to fork overleaf to use a different database?

For the meantime, I figured out how to install overleaf onto freedombox manually, rather than creating it as a plinth app. I’m copying my recipe below in case useful for others.

Installing Docker:

su
apt update && apt full-upgrade && apt auto-remove
apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository “deb [arch=amd64] Index of linux/debian/ $(lsb_release -cs) stable”
apt update
apt install docker-ce
systemctl status docker
curl -L “https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version

Installing Overleaf on Docker:

mkdir git; cd git
git clone GitHub - overleaf/toolkit ./overleaf
cd overleaf
bin/init
bin/init --tls
vi config/overleaf.rc

change this lines to, replacing <X.Y> with the servers LOCAL ip:

SHARELATEX_LISTEN_IP=0.0.0.0
SHARELATEX_PORT=8080

nginx_enabled=true
NGINX_HTTP_PORT=8081
NGINX_HTTP_LISTEN=192.168.<X.Y>
NGINX_HTTP_LISTEN=192.168.<X.Y>
TLS_PRIVATE_KEY_PATH=/etc/dovecot/letsencrypt//privkey.pem
TLS_CERTIFICATE_PATH=/etc/dovecot/letsencrypt//cert.pem
TLS_PORT=8443

Upgrade overleaf to full tex install: (this is done inside the container’s own shell):

bin/shell
wget https://mirror.clientvps.com/CTAN/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xf install-tl-unx.tar.gz
rm install-tl-unx.tar.gz
cd install-tl-*
perl install-tl

At the prompt, enter command: i

This may take an hour to install – full tex is big!

Ctrl-D to exit the container, back to server

The following configures the system to start overleaf on boot:

$ vi /etc/systemd/system/myoverleaf.service

and paste in

Description= My Overleaf Service
Wants=network.target
After=syslog.target network-online.target
[Service]
Type=simple
ExecStart=/home/username/git/overleaf/bin/up
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target

$ systemctl daemon-reload
$ systemctl enable myoverleaf
$ systemctl start myoverleaf
$ systemctl status myoverleaf

Reboot freedombox (eg from plinth) and test overleaf its running on reboot

can now access overleaf on local network https://freedombox.local:8443 or remotely as https://mydomain.com:8443

To create the admin user:

bin/docker-compose exec sharelatex /bin/bash -c “grunt user:create-admin --email=myname@myemail.com”

This outputs a URL with a secret in it. Go to this URL on the server to set the admin password.

The admin can then add users from the web interface on the home page.

1 Like