Installing ShareLatex on Dokku-Alt

Sharelatex’s community edition is now commonly distributed as a dockerfile, so it seems prudent to launch it with one of the smallest platform-as-a-service systems available.

The process is fairly straightforward, with a caveat or two.

ShareLatex Docker Repository

First, check out a copy of the ShareLatex Dockerfile:

git clone

Then, add your dokku-alt host as a remote:

git remote add dokku dokku@YOUR_HOST.COM:latex

and push the master branch:

git push dokku master

For the remainder of this tutorial, we will assume that ShareLatex was deployed to latex.YOUR_HOST.COM.

Now, SSH into your dokku-alt host: we have to make some configuration changes before we can get ShareLatex to run successfully.

Redis Configuration

Unfortunately, dokku-alt by default uses an older version of redis that isn’t compatible with ShareLatex. Thankfully, fixing this is pretty simple:

Switch to the dokku user and edit ~dokku/dokkurc. Add the following line to use redis-2.8:

export REDIS_IMAGE=ayufan/dokku-alt-redis:2.8

Then, link a redis container to your ShareLatex install:

dokku redis:create latex

and set the relevant environment variables:

dokku config:get latex REDIS_URL

should return something like redis://redis:6379. ShareLatex expects it as separate variables SHARELATEX_REDIS_HOST and SHARELATEX_REDIS_PORT.

dokku config:set latex SHARELATEX_REDIS_HOST=redis SHARELATEX_REDIS_PORT=6379

MongoDB configuration

This one is fairly straightforward, just link a new MongoDB database:

dokku mongodb:create latexdb
dokku mongodb:link latex latexdb

and then set the environment variable:

dokku config:set latex SHARELATEX_MONGO_URL=$(dokku config:get latex MONGODB_URL)

Persistent Volume

We want to store our data between container rebuilds, so we need to map a persistent volume to the ShareLatex install.

dokku volume:create latexvol /var/lib/sharelatex
dokku volume:link latex latexvol

Site URL and final deployment

Finally, we need to set the URL used internally by ShareLatex and redeploy our application!

dokku config:set latex SHARELATEX_SITE_URL=http://latex.YOUR_HOST.COM
dokku deploy latex

You might also want to add more latex libraries with

dokku exec latex tlmgr install scheme-full

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>