95
edits
| Line 11: | Line 11: | ||
    sudo start etherpad-lite  |     sudo start etherpad-lite  | ||
==   | == Setting up an etherpad-lite instance ==  | ||
The following are the instructions that were used to install our instance of etherpad-lite and could be used to reinstall the instance from scratch. Instructions adapted from https://help.ubuntu.com/community/Etherpad-liteInstallation.  | The following are the instructions that were used to install our instance of etherpad-lite and could be used to reinstall the instance from scratch. Instructions adapted from https://help.ubuntu.com/community/Etherpad-liteInstallation.  | ||
1. Add a new etherpad-specific system user, etherpad should never be run as root in production.  | 1. Add a new etherpad-specific system user, etherpad should never be run as root in production.  | ||
    sudo adduser --system --home=/opt/etherpad --group etherpad  |     sudo adduser --system --home=/opt/etherpad --group etherpad-lite  | ||
2. Install prequistes, some of these may already be installed, but it is always good to check that they are up-to-date,  | 2. Install prequistes, some of these may already be installed, but it is always good to check that they are up-to-date,  | ||
    sudo apt-get update  |     sudo apt-get update  | ||
| Line 24: | Line 24: | ||
    sudo apt-get install nodejs  |     sudo apt-get install nodejs  | ||
4. Install and test etherpad-lite with following command,  | 4. Install and test etherpad-lite with following command,  | ||
    sudo su - etherpad -s /bin/bash    |     sudo su - etherpad-lite -s /bin/bash    | ||
    mkdir -p ~/local/etherpad  |     mkdir -p ~/local/etherpad  | ||
    cd ~/local/etherpad  |     cd ~/local/etherpad  | ||
| Line 44: | Line 44: | ||
    env EPHOME=/opt/etherpad/local/etherpad/etherpad-lite     |     env EPHOME=/opt/etherpad/local/etherpad/etherpad-lite     | ||
    env EPLOGS=/var/log/etherpad-lite  |     env EPLOGS=/var/log/etherpad-lite  | ||
    env EPUSER=etherpad  |     env EPUSER=etherpad-lite  | ||
    pre-start script  |     pre-start script  | ||
       cd $EPHOME  |        cd $EPHOME  | ||
| Line 65: | Line 65: | ||
9. Check if it worked by going again to <hostname>:9001  | 9. Check if it worked by going again to <hostname>:9001  | ||
==   | == Setting up the MySQL database ==  | ||
You may have noticed a warning about DirtyDB in the logs when you started the service. It is advised that you do not use DirtyDB in production, instead, we setup a MySQL database for etherpad in our existing MySQL instance.  | You may have noticed a warning about DirtyDB in the logs when you started the service. It is advised that you do not use DirtyDB in production, instead, we'll setup a MySQL database for etherpad in our existing MySQL server.  | ||
1. First, assumming that MySQL is already installed and configured on the server, log into the MySQL server as root,  | |||
   mysql -u root -p  | |||
2. Once in MySQL, execute the following commands,  | |||
   create database `etherpad-lite`;  | |||
   grant all privileges on `etherpad-lite`.* to 'etherpad'@'localhost';  | |||
   exit  | |||
3. Now go to the ethepad config file with,  | |||
   sudo nano /opt/etherpad/local/etherpad/etherpad-lite/settings.json  | |||
and change the settings to match the priveleges you just granted, replacing the default dbType categories with the following,  | |||
   "dbType" : "mysql",  | |||
      "dbSettings" : {  | |||
          "user"    : "etherpad",   | |||
          "host"    : "localhost",   | |||
          "database": "etherpad-lite"  | |||
          "charset" : "utf8mb4"  | |||
       },  | |||
4. Restart the service and go to <hostname>:9001 to enable the new settings and check that the instance is still working.  | |||
5. Finally, back on the server, we'll need to change a few of the database's settings to do this, log into the MySQL server with,  | |||
   mysql -u root -p  | |||
and then execute the following commands,  | |||
   ALTER DATABASE `etherpad-lite` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;  | |||
   USE `etherpad-lite`;  | |||
   ALTER TABLE `store` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;  | |||
   exit  | |||
6. To set backups of the etherpad-lite database...  | |||
== Setting up log rotation ==  | |||
Explain what log rotation does? Why is it neccessary?  | |||
1. Create a logrotate config file with,  | |||
   sudo nano /etc/logrotate.d/etherpad-lite  | |||
2. Copy and paste the following into this file,  | |||
   /var/log/etherpad-lite/*.log  | |||
   {  | |||
      rotate 4  | |||
      weekly  | |||
      missingok  | |||
      notifempty  | |||
      compress  | |||
      delaycompress  | |||
      sharedscripts  | |||
      postrotate  | |||
         restart etherpad-lite >/dev/null 2>&1 || true  | |||
      endscript  | |||
   }  | |||
3. Check that it is working with,  | |||
   logrotate -d /etc/logrotate.d/etherpad-lite  | |||
== TODOs ==  | == TODOs ==  | ||
* setup/check-on the timetable for clearing abandoned pads  | * setup/check-on the timetable for clearing abandoned pads  | ||
edits