Difference between revisions of "Etherpad"

From Fixme.ch
Jump to: navigation, search
 
(33 intermediate revisions by 2 users not shown)
Line 1: Line 1:
* Etherpad legacy installed via repositories
+
[[Category:Services]]
* Etherpad lite installed by hand in /home/etherpadlite and run by XXX (replace by futur init script)
+
 
 +
__TOC__
 +
 
 +
== Information ==
 +
 
 +
* https://pad.fixme.ch/
 +
* Deployed on [[Kubernetes]]
 +
* https://status.fixme.ch/pads/ (private list of pads mentionned in [[Mattermost]])
 +
* Pads are semi-public, as there's no authentication on the service, please be warned !
 +
 
 +
=== TODO ===
 +
 
 +
* Install etherdraw !
 +
* Migrate to CodiMD/HackMD
 +
** Example: https://md.chaospott.de/IICpTztRThGUwyiEkV-lrA
 +
** Copy pads https://github.com/hackmdio/codimd/blob/master/docs/guides/migrate-etherpad.md
 +
** We should keep pad.fixme.ch in readonly with etherpad
 +
** Add md.fixme.ch with CodiMD and an import of etherpad
 +
 
 +
== Legacy ==
 +
* Installed on [[Internal_Server]], uses [[MySQL]] and [[Apache]].
 +
* Etherpad lite installed by hand in /home/etherpadlite and run by /etc/init.d/etherpad-lite
 +
* http is redirected to https
 +
* https://pad.fixme.ch/padId is redirected to https://pad.fixme.ch/p/padId
 +
 
 +
=== Known pads ===
 +
* Script in /home/sysadmin/scripts/etherpad.sh lists all pads
 +
* https://pad.fixme.ch/p/acta
 +
* https://pad.fixme.ch/p/burgers
 +
* https://pad.fixme.ch/p/game5
 +
* https://pad.fixme.ch/p/game
 +
* https://pad.fixme.ch/p/dotlink
 +
* https://pad.fixme.ch/p/ndh2012-prequals
 +
 
 +
=== IPv6 and SSL ===
 +
* Here is a reverse proxy configuration for apache. It then supports IPv6 and SSL
 +
* /etc/apache2/sites-available/1_Etherpad
 +
 
 +
<syntaxhighlight lang="apache">
 +
<VirtualHost *:443>
 +
    ServerName pad.fixme.ch
 +
    ServerSignature Off
 +
    CustomLog /var/log/apache2/etherpad_access.log combined
 +
    ErrorLog /var/log/apache2/etherpad_error.log
 +
 
 +
    # SSL
 +
    SSLEngine on
 +
    SSLCertificateFile /etc/ssl/pad.fixme.ch.crt
 +
    SSLCertificateKeyFile /etc/ssl/pad.fixme.ch.key
 +
 
 +
    # Nice URLs
 +
    RewriteEngine On
 +
    RewriteRule /p/*$ https://pad.fixme.ch/ [NC,L]
 +
    RewriteCond %{REQUEST_URI} !^/p/
 +
    RewriteCond %{REQUEST_URI} !^/static/
 +
    RewriteCond %{REQUEST_URI} !^/socket.io/
 +
    RewriteCond %{REQUEST_URI} !^/ep/
 +
    RewriteCond %{REQUEST_URI} !^/minified/
 +
    RewriteCond %{REQUEST_URI} !^/api/
 +
    RewriteCond %{REQUEST_URI} !^/ro/
 +
    RewriteCond %{REQUEST_URI} !^/error/
 +
    RewriteCond %{REQUEST_URI} !^/jserror
 +
    RewriteCond %{REQUEST_URI} !/favicon.ico
 +
    RewriteCond %{REQUEST_URI} !/robots.txt
 +
    RewriteRule ^/+(.+)$ https://pad.fixme.ch/p/$1 [L]
 +
 
 +
    # Reverse Proxy for Etherpad
 +
    ProxyVia On
 +
    ProxyRequests Off
 +
    ProxyPass / http://127.0.0.1:9001/
 +
    ProxyPassReverse / http://127.0.0.1:9001/
 +
    ProxyPreserveHost on
 +
    <Proxy *>
 +
        Options FollowSymLinks MultiViews
 +
        AllowOverride All
 +
        Order allow,deny
 +
        allow from all
 +
    </Proxy>
 +
</VirtualHost>
 +
</syntaxhighlight>
 +
* SSL was not working, patched /home/etherpadlite/etherpad-lite/node/server.js (This is now replaced by the reverse proxy)
 +
** Here is the ugly patch
 +
<syntaxhighlight lang="diff">
 +
diff --git a/node/server.js b/node/server.js
 +
index c5377d8..2416a71 100644
 +
--- a/node/server.js
 +
+++ b/node/server.js
 +
@@ -68,7 +68,10 @@ exports.maxAge = settings.maxAge;
 +
//set loglevel
 +
log4js.setGlobalLogLevel(settings.loglevel);
 +
 +
-async.waterfall([
 +
+async.waterfall(startServer('0.0.0.0'));
 +
+async.waterfall(startServer('2001:788:dead:beef::5'));
 +
+
 +
+function startServer(ipAddr){ return [
 +
  //initalize the database
 +
  function (callback)
 +
  {
 +
@@ -78,7 +81,11 @@ async.waterfall([
 +
  function (callback)
 +
  {
 +
    //create server
 +
-    var app = express.createServer();
 +
+    var options = {
 +
+        key: fs.readFileSync('/home/etherpadlite/etherpad-lite/node_modules/socket.io/node_modules/policyfile/tests/ssl/ssl.private.key'),
 +
+        cert: fs.readFileSync('/home/etherpadlite/etherpad-lite/node_modules/socket.io/node_modules/policyfile/tests/ssl/ssl.crt'),
 +
+    }
 +
+    var app = express.createServer(options);
 +
 +
    app.use(function (req, res, next) {
 +
      res.header("Server", serverName);
 +
@@ -409,8 +416,8 @@ async.waterfall([
 +
    });
 +
   
 +
    //let the server listen
 +
-    app.listen(settings.port, settings.ip);
 +
-    console.log("Server is listening at " + settings.ip + ":" + settings.port);
 +
+    app.listen(settings.port, ipAddr);
 +
+    console.log("Server is listening at " + ipAddr + ":" + settings.port);
 +
 +
    var onShutdown = false;
 +
    var gracefulShutdown = function(err)
 +
@@ -497,4 +504,6 @@ async.waterfall([
 +
   
 +
    callback(null); 
 +
  }
 +
-]);
 +
+];
 +
+}
 +
+
 +
</syntaxhighlight>
 +
 
 +
=== Cosmetic ===
 +
* Modification of the file ''/home/etherpadlite/etherpad-lite/static/js/pad.js'' 96-102 so it's Monospace font by default (didn't find a better working way), editing ''static/custom/pad.js'' with ''pad.changeViewOption('useMonospaceFont', true);'' doesn't work.
 +
<syntaxhighlight lang="diff">
 +
diff --git a/static/js/pad.js b/static/js/pad.js
 +
index bda6895..4d2e4e9 100644
 +
--- a/static/js/pad.js
 +
+++ b/static/js/pad.js
 +
@@ -93,13 +93,13 @@ function getParams()
 +
      settings.LineNumbersDisabled = true;
 +
    }
 +
  }
 +
-  if(useMonospaceFont)
 +
-  {
 +
-    if(useMonospaceFont == "true")
 +
-    {
 +
+  //if(useMonospaceFont)
 +
+  //{
 +
+  //  if(useMonospaceFont == "true")
 +
+  //  {
 +
      settings.useMonospaceFontGlobal = true;
 +
-    }
 +
-  }
 +
+  //  }
 +
+  //}
 +
  if(userName)
 +
  {
 +
    // If the username is set as a parameter we should set a global value that we can call once we have initiated the pad.
 +
diff --git a/static/pad.html b/static/pad.html
 +
index 4c6d4d8..1318257 100644
 +
--- a/static/pad.html
 +
+++ b/static/pad.html
 +
@@ -1,7 +1,7 @@
 +
<!doctype html>
 +
<html>
 +
 +
-        <title>Etherpad Lite</title>
 +
+        <title>FIXME Etherpad Lite</title>
 +
 +
        <meta charset="utf-8">
 +
        <meta name="robots" content="noindex, nofollow">
 +
@@ -276,4 +276,4 @@
 +
            }());
 +
        </script>
 +
       
 +
-</html>
 +
\ No newline at end of file
 +
+</html>
 +
</syntaxhighlight>

Latest revision as of 21:38, 27 January 2021


Information

TODO

Legacy

Known pads

IPv6 and SSL

  • Here is a reverse proxy configuration for apache. It then supports IPv6 and SSL
  • /etc/apache2/sites-available/1_Etherpad
<VirtualHost *:443>
    ServerName pad.fixme.ch
    ServerSignature Off
    CustomLog /var/log/apache2/etherpad_access.log combined
    ErrorLog /var/log/apache2/etherpad_error.log
 
    # SSL
    SSLEngine on
    SSLCertificateFile /etc/ssl/pad.fixme.ch.crt
    SSLCertificateKeyFile /etc/ssl/pad.fixme.ch.key
 
    # Nice URLs
    RewriteEngine On
    RewriteRule /p/*$ https://pad.fixme.ch/ [NC,L]
    RewriteCond %{REQUEST_URI} !^/p/
    RewriteCond %{REQUEST_URI} !^/static/
    RewriteCond %{REQUEST_URI} !^/socket.io/
    RewriteCond %{REQUEST_URI} !^/ep/
    RewriteCond %{REQUEST_URI} !^/minified/
    RewriteCond %{REQUEST_URI} !^/api/
    RewriteCond %{REQUEST_URI} !^/ro/
    RewriteCond %{REQUEST_URI} !^/error/
    RewriteCond %{REQUEST_URI} !^/jserror
    RewriteCond %{REQUEST_URI} !/favicon.ico
    RewriteCond %{REQUEST_URI} !/robots.txt
    RewriteRule ^/+(.+)$ https://pad.fixme.ch/p/$1 [L]
 
    # Reverse Proxy for Etherpad
    ProxyVia On
    ProxyRequests Off
    ProxyPass / http://127.0.0.1:9001/
    ProxyPassReverse / http://127.0.0.1:9001/
    ProxyPreserveHost on
    <Proxy *>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Proxy>
</VirtualHost>
  • SSL was not working, patched /home/etherpadlite/etherpad-lite/node/server.js (This is now replaced by the reverse proxy)
    • Here is the ugly patch
diff --git a/node/server.js b/node/server.js
index c5377d8..2416a71 100644
--- a/node/server.js
+++ b/node/server.js
@@ -68,7 +68,10 @@ exports.maxAge = settings.maxAge;
 //set loglevel
 log4js.setGlobalLogLevel(settings.loglevel);
 
-async.waterfall([
+async.waterfall(startServer('0.0.0.0'));
+async.waterfall(startServer('2001:788:dead:beef::5'));
+
+function startServer(ipAddr){ return [
   //initalize the database
   function (callback)
   {
@@ -78,7 +81,11 @@ async.waterfall([
   function (callback)
   {
     //create server
-    var app = express.createServer();
+    var options = {
+        key: fs.readFileSync('/home/etherpadlite/etherpad-lite/node_modules/socket.io/node_modules/policyfile/tests/ssl/ssl.private.key'),
+        cert: fs.readFileSync('/home/etherpadlite/etherpad-lite/node_modules/socket.io/node_modules/policyfile/tests/ssl/ssl.crt'),
+    }
+    var app = express.createServer(options);
 
     app.use(function (req, res, next) {
       res.header("Server", serverName);
@@ -409,8 +416,8 @@ async.waterfall([
     });
 
     //let the server listen
-    app.listen(settings.port, settings.ip);
-    console.log("Server is listening at " + settings.ip + ":" + settings.port);
+    app.listen(settings.port, ipAddr);
+    console.log("Server is listening at " + ipAddr + ":" + settings.port);
 
     var onShutdown = false;
     var gracefulShutdown = function(err)
@@ -497,4 +504,6 @@ async.waterfall([
 
     callback(null);  
   }
-]);
+];
+}
+

Cosmetic

  • Modification of the file /home/etherpadlite/etherpad-lite/static/js/pad.js 96-102 so it's Monospace font by default (didn't find a better working way), editing static/custom/pad.js with pad.changeViewOption('useMonospaceFont', true); doesn't work.
diff --git a/static/js/pad.js b/static/js/pad.js
index bda6895..4d2e4e9 100644
--- a/static/js/pad.js
+++ b/static/js/pad.js
@@ -93,13 +93,13 @@ function getParams()
       settings.LineNumbersDisabled = true;
     }
   }
-  if(useMonospaceFont)
-  {
-    if(useMonospaceFont == "true")
-    {
+  //if(useMonospaceFont)
+  //{
+  //  if(useMonospaceFont == "true")
+  //  {
       settings.useMonospaceFontGlobal = true;
-    }
-  }
+  //  }
+  //}
   if(userName)
   {
     // If the username is set as a parameter we should set a global value that we can call once we have initiated the pad.
diff --git a/static/pad.html b/static/pad.html
index 4c6d4d8..1318257 100644
--- a/static/pad.html
+++ b/static/pad.html
@@ -1,7 +1,7 @@
 <!doctype html>
 <html>
 
-        <title>Etherpad Lite</title>
+        <title>FIXME Etherpad Lite</title>
 
         <meta charset="utf-8">
         <meta name="robots" content="noindex, nofollow">
@@ -276,4 +276,4 @@
             }());
         </script>
 
-</html>
\ No newline at end of file
+</html>