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 https://github.com/sharelatex/sharelatex-docker-image
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
Now, SSH into your
dokku-alt host: we have to make some configuration changes before we can get ShareLatex to run successfully.
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
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
dokku config:set latex SHARELATEX_REDIS_HOST=redis SHARELATEX_REDIS_PORT=6379
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)
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