Etherpad (Lite) inside Moodle on Ubuntu 16.04 (updated: ssl with letsencrypt)

Collaborative writing is fun and it’s a very fast way to share ideas or other pieces of text within a group — in my case a classroom. Using publicly available solutions is ok (e.g. yourpart.eu is a good starting point) — I started using this. Using the solution presented here requires to be able to install a few linux packages but what you get is very attractive: a customizable writing place open only for a user group you can define yourself with some restrictive settings preventing annoyances (e.g. students changing their names to “funny” ones…) and a rich set of export features, your data storage being under control of yourself.

Since quite some years I wanted to have some collaborative writing tool inside moodle (there are plugins) or even better in Mahara (this could be true sometime) . Of course there is Google Docs (and Microsoft Word nowadays) — but I really like to use Open Source and to be frank, to be independent of some companies proprietary solution and their way/place to store data. So Etherpad was in my focus but installing new software and integrating into my running moodle instance requires some amount of motivation and spare time. Recently, teaching in my German Language/Literature courses (10th and 11th grade) I was audacious enough to try to do this and I was successful in just about two hours all single fine-tuning taken into account. I want to share my findings especially as some information is scattered among different places and my solution uses minimum effort (e.g. no proxy configuration required).

Prerequisites

My moodle instance is running on a VPS (virtual private server) reachable at moodle.klocker-mark.eu, using a standard LAMP-Server configuration. For Etherpad(lite) I choose my second VPS mirror.klocker-mark.eu generally used for backup and not so important services like BigBlueButton. Both are running Ubuntu 16.04 (LTS). I am sure this would have worked on the first machine too but I am a little cautious doing such modifications as in this case this involves installing node.js. So I did it on my second server which works like a charm so I will keep it that way.

My moodle is 3.3.2+ but the plugin works flawlessly.

Update: since moodle 3.4 the whole site has to be delivered via https:// requiring some little changes to etherpad-lite. See paragraph at the end.

Installing Etherpad

This is quite simple having root access, installing node.js, etherpad lite and abiword.

node.js

There are some ways to do this, the simplest and fastest is using the supported version using apt-get (for other way see here):
sudo apt install git curl python libssl-dev pkg-config build-essential
sudo apt-get install nodejs

There is one caveat: the executable is named nodejs which is simply linke to node on my system:
cd /usr/bin
sudo link -s /bin/nodejs node

Etherpad lite

Cloning via git into /opt is easy:
git clone git://github.com/ether/etherpad-lite.git
Creating a user and changing ownership:
adduser --system --home=/srv/etherpad-lite --group etherpad-lite

Finally create a service (download here):
sudo vi /etc/systemd/system/etherpad-lite.service
pasting the following lines (be sure to enter your path of installation):
[Unit] Description=etherpad-lite (real-time collaborative document editing)
After=syslog.target network.target
[Service] Type=simple
User=etherpad-lite
Group=etherpad-lite
ExecStart=/opt/etherpad-lite/bin/run.sh
[Install] WantedBy=multi-user.target

That’s it, just enable starting at boot time (and start now and check to test it):
sudo systemctl enable etherpad-lite
sudo systemctl start etherpad-lite
sudo systemctl status etherpad-lite

The last statement gives useful informations e.g. the port on which Etherpad is running, default being 9001. Now you should be able to run Etherpad on your server, in my case calling http://mirror.klocker-mark.eu:9001.

Etherpad should work standalone and is almost ready to be used with moodle. Some configuration has to be done which requires modifying settings.json in /opt/etherpad-lite.

The changes for the plugin I am using are described here, you need to do the following three changes:

  • “requireSession”:true
  • “editOnly”:true
  • “abiword”: “/usr/bin/abiword”

I have done this (and some other little tweaks described below in my settings.json which you are free to download. Be sure to modify the admin password which enables you to use the admin panel of Etherpad (at http://mirror.klocker-mark.eu:9001/admin/ in my case)e.g. to install/uninstall plugins.

I decided to install the following plugins:

  • authornames: gives very nice tooltips of author names when hovering above text
  • remove_embed: required (or recommended?) by moodle plugin.

Abiword

With Abiword installed there are many import and export options for your etherpad, which are very nice to have.
apt-get install abiword
does the installation, but there is a modification of sudoers required for Etherpad to use it:
visudo -f sudoers
Add the line:
www-data ALL = NOPASSWD: /usr/bin/abiword
The only remaining task is installing and configuring the moodle plugin.

Installing Moodle plugin

For my moodle version only installing via zip-file is possible but this works flawlessly. Configuration is required only for three parameters:

  • Server Url: I am using the above mentioned: http://mirror.klocker-mark.eu:9001/.
  • API Key: You can find this key in your installation directory, this is /opt/etherpad-lite/APIKEY.txt
  • Cookie domain: depends on your domain, in my case .klocker-mark.eu.

Generate and use ssl key with Letsencrypt (optional)

You don’t have to do this if you are using moodle < 3.4. To do this I generated keys in the usual way

/opt/certbot-auto certonly -d etherpad.klocker-mark.eu

After some fiddling around I decided to use an easy solution to make these keys available to etherpad: with every renewal attempt (which is a script in my crontab being called daily) the keys are copied to /opt/etherpad-lite, changing the ownership to be usable by etherpad:

cp /etc/letsencrypt/live/etherpad.klocker-mark.eu/privkey.pem /opt/etherpad-lite/
cp /etc/letsencrypt/live/etherpad.klocker-mark.eu/cert.pem /opt/etherpad-lite/
chown etherpad-lite /opt/etherpad-lite/*.pem.

Now uncomment the ssl section in settings.json changing only two settings to

"ssl" : {
"key" : "/opt/etherpad-lite/privkey.pem",
"cert" : "/opt/etherpad-lite/cert.pem"
},

and restart etherpad. Moodles plugin configuration has to be changed to use this new address

  • Server Url: https://etherpad.klocker-mark.eu:9001/.
0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments