Convert from etherpad to ethercalc

This begins the conversion process. We keep the bulk of the nodejs and
apache configuration. Remove mysql and replace with redis and so on.

This is not a complete conversion, future work should include
authenticated redis configuration and systemd support. However, this
should be able to get the service running with a basic set of
features and functionality.

Change-Id: Id10247211d9643e81bb1b6e8fb67377ba6de873a
This commit is contained in:
Clark Boylan 2017-01-19 15:59:56 -08:00
parent f8d123d2ba
commit 521672bc35
16 changed files with 212 additions and 488 deletions

View File

@ -1,4 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack-infra/puppet-etherpad_lite.git
project=openstack-infra/puppet-ethercalc.git

View File

@ -1,3 +1,3 @@
# OpenStack Etherpad Lite Module
# OpenStack Ethercalc Module
This module installs and configures Etherpad Lite
This module installs and configures Ethercalc

View File

@ -9,9 +9,9 @@
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
#
# Etherpad Lite clients create a lot of connections. To be able to support
# Ethercalc clients create a lot of connections. To be able to support
# Several hundred concurrent users we need to make sure that we allow a few
# thousand concurrent connections. This should be ok as typical etherpad use
# thousand concurrent connections. This should be ok as typical ethercalc use
# involves a couple writers then a bunch of lurkers. The cost of lurkers
# is basically the TCP connection as they don't create DB writes and so on.
# In addition to allowing for connection growth, keep a healthy number of

View File

@ -1,7 +0,0 @@
function customStart()
{
//define your javascript here
//jquery is available - except index.js
//you can load extra scripts with $.getScript http://api.jquery.com/jQuery.getScript/
chat.stickToScreen(true);
}

View File

@ -1,7 +1,7 @@
# == Class: etherpad_lite::apache
# == Class: ethercalc::apache
#
class etherpad_lite::apache (
$docroot = '/srv/etherpad-lite',
class ethercalc::apache (
$docroot = '/srv/ethercalc',
$serveradmin = "webmaster@${::fqdn}",
$ssl_cert_file = '',
$ssl_cert_file_contents = '', # If left empty puppet will not create file.
@ -36,7 +36,7 @@ class etherpad_lite::apache (
port => 443,
docroot => $docroot,
priority => '50',
template => 'etherpad_lite/etherpadlite.vhost.erb',
template => 'ethercalc/ethercalc.vhost.erb',
ssl => true,
}
@ -55,6 +55,11 @@ class etherpad_lite::apache (
ensure => present,
}
}
if !defined(Mod['proxy_wstunnel']) {
httpd::mod { 'proxy_wstunnel':
ensure => present,
}
}
if ($auth_openid != undef) {
if !defined(Package['libapache2-mod-auth-openid']) {
package { 'libapache2-mod-auth-openid':
@ -88,7 +93,7 @@ class etherpad_lite::apache (
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/etherpad_lite/apache-connection-tuning',
source => 'puppet:///modules/ethercalc/apache-connection-tuning',
notify => Service['httpd'],
require => File['/etc/apache2/conf.d'],
}
@ -105,7 +110,7 @@ class etherpad_lite::apache (
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/etherpad_lite/apache-connection-tuning',
source => 'puppet:///modules/ethercalc/apache-connection-tuning',
require => File['/etc/apache2/conf-available'],
}
@ -133,7 +138,7 @@ class etherpad_lite::apache (
file { "${docroot}/robots.txt":
ensure => present,
source => 'puppet:///modules/etherpad_lite/robots.txt',
source => 'puppet:///modules/ethercalc/robots.txt',
owner => 'root',
group => 'root',
mode => '0444',

View File

@ -1,38 +0,0 @@
# == Define: buildsource
#
# define to build from source using ./configure && make && make install.
#
define etherpad_lite::buildsource(
$creates = '/nonexistant/file',
$dir = $title,
$timeout = 300,
$user = 'root',
) {
exec { "./configure in ${dir}":
command => './configure',
path => "/usr/bin:/bin:/usr/local/bin:${dir}",
user => $user,
cwd => $dir,
creates => $creates,
before => Exec["make in ${dir}"],
}
exec { "make in ${dir}":
command => 'make',
path => '/usr/bin:/bin',
user => $user,
cwd => $dir,
timeout => $timeout,
creates => $creates,
before => Exec["make install in ${dir}"],
}
exec { "make install in ${dir}":
command => 'make install',
path => '/usr/bin:/bin',
user => $user,
cwd => $dir,
creates => $creates,
}
}

View File

@ -1,54 +1,45 @@
# == Class: etherpad_lite
# == Class: ethercalc
#
# Class to install etherpad lite. Puppet acts a lot like a package manager
# through this class.
# Class to install ethercalc.
#
# To use etherpad lite you will want the following includes:
# include etherpad_lite
# include etherpad_lite::mysql # necessary to use mysql as the backend
# include etherpad_lite::site # configures etherpad lite instance
# include etherpad_lite::apache # will add reverse proxy on localhost
# To use ethercalc you will want the following includes:
# include ethercalc
# include ethercalc::redis # necessary to use mysql as the backend
# include ethercalc::site # configures ethercalc instance
# include ethercalc::apache # will add reverse proxy on localhost
# The defaults for all the classes should just work (tm)
#
#
class etherpad_lite (
$base_install_dir = '/opt/etherpad-lite',
class ethercalc (
$base_install_dir = '/opt/ethercalc',
$base_log_dir = '/var/log',
$ep_ensure = 'present',
$ep_user = 'eplite',
$eplite_version = 'develop',
$ethercalc_user = 'ethercalc',
$ethercalc_version= '0.20161220.1',
# If set to system will install system package.
$nodejs_version = 'node_0.10',
$nodejs_version = 'node_4.x',
) {
# where the modules are, needed to easily install modules later
$modules_dir = "${base_install_dir}/etherpad-lite/node_modules"
$path = "/usr/local/bin:/usr/bin:/bin:${base_install_dir}/etherpad-lite"
$path = '/usr/local/bin:/usr/bin:/bin'
user { $ep_user:
shell => '/usr/sbin/nologin',
home => "${base_log_dir}/${ep_user}",
system => true,
gid => $ep_user,
require => Group[$ep_user],
}
group { $ep_user:
group { $ethercalc_user:
ensure => present,
}
# Below is what happens when you treat puppet as a package manager.
# This is probably bad, but it works and you don't need to roll .debs.
user { $ethercalc_user:
shell => '/usr/sbin/nologin',
home => $base_install_dir,
system => true,
gid => $ethercalc_user,
require => Group[$ethercalc_user],
}
file { $base_install_dir:
ensure => directory,
group => $ep_user,
owner => $ethercalc_user,
group => $ethercalc_user,
mode => '0664',
}
package { 'abiword':
ensure => present,
}
package { 'curl':
ensure => present,
}
@ -76,48 +67,61 @@ class etherpad_lite (
anchor { 'nodejs-anchor': }
vcsrepo { "${base_install_dir}/etherpad-lite":
ensure => $ep_ensure,
provider => git,
source => 'https://github.com/ether/etherpad-lite.git',
owner => $ep_user,
revision => $eplite_version,
require => [
Package['git'],
User[$ep_user],
],
exec { 'install-ethercalc':
command => "npm install ethercalc@${ethercalc_version}",
unless => "npm ls --parseable | grep ethercalc@${ethercalc_version}",
path => $path,
cwd => $base_install_dir,
require => Anchor['nodejs-anchor'],
}
exec { 'install_etherpad_dependencies':
command => './bin/installDeps.sh',
path => $path,
user => $ep_user,
cwd => "${base_install_dir}/etherpad-lite",
environment => "HOME=${base_log_dir}/${ep_user}",
require => [
Package['curl'],
Vcsrepo["${base_install_dir}/etherpad-lite"],
Anchor['nodejs-anchor'],
],
before => File["${base_install_dir}/etherpad-lite/settings.json"],
creates => "${base_install_dir}/etherpad-lite/node_modules",
}
file { '/etc/init/etherpad-lite.conf':
file { '/etc/init/ethercalc.conf':
ensure => present,
content => template('etherpad_lite/upstart.erb'),
content => template('ethercalc/upstart.erb'),
replace => true,
owner => 'root',
}
file { '/etc/init.d/etherpad-lite':
file { '/etc/init.d/ethercalc':
ensure => link,
target => '/lib/init/upstart-job',
}
file { "${base_log_dir}/${ep_user}":
file { "${base_log_dir}/${ethercalc_user}":
ensure => directory,
owner => $ep_user,
owner => $ethercalc_user,
}
service { 'ethercalc':
ensure => running,
enable => true,
require => File['/etc/init/ethercalc.conf'],
}
include ::logrotate
logrotate::file { 'ethercalc_error':
log => "${base_log_dir}/${ethercalc_user}/error.log",
options => [
'compress',
'copytruncate',
'missingok',
'rotate 7',
'daily',
'notifempty',
],
require => Service['ethercalc'],
}
logrotate::file { 'ethercalc_access':
log => "${base_log_dir}/${ethercalc_user}/access.log",
options => [
'compress',
'copytruncate',
'missingok',
'rotate 7',
'daily',
'notifempty',
],
require => Service['ethercalc'],
}
# end package management ugliness
}

View File

@ -1,32 +0,0 @@
# == Class: puppet-etherpad_lite::mysql
#
class etherpad_lite::mysql(
$database_password,
$mysql_root_password,
$database_name = 'etherpad-lite',
$database_user = 'eplite',
) {
class { '::mysql::server':
root_password => $mysql_root_password,
override_options => {
'mysqld' => {
'default-storage-engine' => 'InnoDB',
}
}
}
include ::mysql::server::account_security
mysql::db { $database_name:
user => $database_user,
password => $database_password,
host => 'localhost',
grant => ['all'],
charset => 'utf8mb4',
collate => 'utf8mb4_unicode_ci',
require => [
Class['mysql::server'],
Class['mysql::server::account_security'],
],
}
}

View File

@ -1,13 +0,0 @@
# Define to install etherpad lite plugins
#
define etherpad_lite::plugin {
$plugin_name = $name
exec { "npm install ${plugin_name}":
cwd => $etherpad_lite::modules_dir,
path => $etherpad_lite::path,
user => $etherpad_lite::ep_user,
environment => "HOME=${etherpad_lite::base_log_dir}/${etherpad_lite::ep_user}",
creates => "${etherpad_lite::modules_dir}/${plugin_name}",
require => Class['etherpad_lite']
}
}

17
manifests/redis.pp Normal file
View File

@ -0,0 +1,17 @@
# == Class: ethercalc::redis
#
class ethercalc::redis(
$redis_port = '6379',
$redis_max_memory = '1gb',
$redis_bind = '127.0.0.1',
$redis_password = undef,
$redis_version = '2.8.4',
) {
class { '::redis':
redis_port => $redis_port,
redis_max_memory => $redis_max_memory,
redis_bind => $redis_bind,
redis_password => $redis_password,
version => $redis_version ,
}
}

View File

@ -1,68 +0,0 @@
# == Class: etherpad_lite::site
#
class etherpad_lite::site (
$database_password,
$etherpad_title,
$database_host = 'localhost',
$database_name = 'etherpad-lite',
$database_user = 'eplite',
$db_type = 'mysql',
$session_key = '',
) {
include ::etherpad_lite
$base = $etherpad_lite::base_install_dir
service { 'etherpad-lite':
ensure => running,
enable => true,
subscribe => File["${base}/etherpad-lite/settings.json"],
}
file { "${base}/etherpad-lite/settings.json":
ensure => present,
content => template('etherpad_lite/etherpad-lite_settings.json.erb'),
replace => true,
owner => $etherpad_lite::ep_user,
group => $etherpad_lite::ep_user,
mode => '0600',
require => Class['etherpad_lite'],
}
file { "${base}/etherpad-lite/src/static/custom/pad.js":
ensure => present,
source => 'puppet:///modules/etherpad_lite/pad.js',
owner => $etherpad_lite::ep_user,
group => $etherpad_lite::ep_user,
mode => '0644',
require => Class['etherpad_lite'],
}
include ::logrotate
logrotate::file { 'epliteerror':
log => "${base}/${etherpad_lite::ep_user}/error.log",
options => [
'compress',
'copytruncate',
'missingok',
'rotate 7',
'daily',
'notifempty',
],
require => Service['etherpad-lite'],
}
logrotate::file { 'epliteaccess':
log => "${base}/${etherpad_lite::ep_user}/access.log",
options => [
'compress',
'copytruncate',
'missingok',
'rotate 7',
'daily',
'notifempty',
],
require => Service['etherpad-lite'],
}
}

View File

@ -1,11 +1,15 @@
{
"name": "openstackinfra-etherpad_lite",
"name": "openstackinfra-ethercalc",
"version": "0.0.1",
"author": "Openstack CI",
"summary": "Puppet module for Etherpad Lite",
"summary": "Puppet module for Ethercalc",
"license": "Apache 2.0",
"source": "git://git.openstack.org/openstack-infra/puppet-etherpad_lite.git",
"source": "git://git.openstack.org/openstack-infra/puppet-ethercalc.git",
"project_page": "http://docs.openstack.org/infra/system-config/",
"issues_url": "https://storyboard.openstack.org/#!/project/800",
"dependencies": []
"issues_url": "https://storyboard.openstack.org/#!/project/858",
"dependencies": [
{"name":"openstackinfra/httpd"},
{"name":"openstackinfra/redis"},
{"name":"voxpupuli/nodejs"}
]
}

View File

@ -0,0 +1,86 @@
<VirtualHost *:80>
ServerName <%= scope.lookupvar("ethercalc::apache::vhost_name") %>
ServerAdmin <%= scope.lookupvar("ethercalc::apache::serveradmin") %>
ErrorLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("ethercalc::apache::vhost_name") %>-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("ethercalc::apache::vhost_name") %>-access.log combined
Redirect / https://<%= scope.lookupvar("ethercalc::apache::vhost_name") %>/
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName <%= scope.lookupvar("ethercalc::apache::vhost_name") %>
ServerAdmin <%= scope.lookupvar("ethercalc::apache::serveradmin") %>
ErrorLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("ethercalc::apache::vhost_name") %>-ssl-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("ethercalc::apache::vhost_name") %>-ssl-access.log combined
SSLEngine on
SSLProtocol All -SSLv2 -SSLv3
SSLCertificateFile <%= scope.lookupvar("ethercalc::apache::ssl_cert_file") %>
SSLCertificateKeyFile <%= scope.lookupvar("ethercalc::apache::ssl_key_file") %>
<% if scope.lookupvar("ethercalc::apache::ssl_chain_file") != "" %>
SSLCertificateChainFile <%= scope.lookupvar("ethercalc::apache::ssl_chain_file") %>
<% end %>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
<% if @auth_openid != nil %>
<Location />
AuthType OpenID
AuthName "<%= @auth_openid['banner'] %>"
AuthOpenIDSecureCookie On
AuthOpenIDCookieLifespan 3600
AuthOpenIDTrustRoot https://<%= scope.lookupvar("ethercalc::apache::vhost_name") %>
AuthOpenIDServerName https://<%= scope.lookupvar("ethercalc::apache::vhost_name") %>
AuthOpenIDSingleIdP <%= @auth_openid['singleIdp'] %>
AuthOpenIDTrusted <%= @auth_openid['trusted'] %>
<% if @auth_openid['any_valid_user'] %>
Require valid-user
<% elsif !@auth_openid['users'].empty? %>
<% @auth_openid['users'].each do |user| -%>
Require user <%= user %>
<% end -%>
<% end %>
</Location>
<% end %>
# Proxy pass to the node.js server (port 8000)
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
RewriteEngine On
# Do not rewrite the /server-status URL (though by default, this
# is only accessible from localhost). Connect to it with:
# ssh -L 8443:localhost:443 $HOSTNAME
# https://localhost:8443/server-status
RewriteRule ^/server-status$ /server-status [L]
# Set up websockets to work through the proxy
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:8000/$1 [P,L]
# Set up an alias for static files. Saves having to serve them from node.js
Alias /robots.txt <%= scope.lookupvar("ethercalc::apache::docroot") %>/robots.txt
Alias /static <%= scope.lookupvar("ethercalc::base_install_dir") %>/node_modules/ethercalc/static
Alias /l10n <%= scope.lookupvar("ethercalc::base_install_dir") %>/node_modules/ethercalc/l10n
Alias /images <%= scope.lookupvar("ethercalc::base_install_dir") %>/node_modules/ethercalc/images
</VirtualHost>
</IfModule>

View File

@ -1,120 +0,0 @@
/*
This file must be valid JSON. But comments are allowed
Please edit settings.json, not settings.json.template
*/
{
// Name your instance!
"title": "<%= @etherpad_title %>",
//Ip and port which etherpad should bind at
"ip": "127.0.0.1",
"port" : 9001,
// favicon default name
"favicon": "favicon.ico",
// Session Key, used for reconnecting user sessions
// Set this to a secure string at least 10 characters long. Do not share this value.
"sessionKey" : "<%= @session_key %>",
//The Type of the database. You can choose between dirty, sqlite and mysql
//You should use mysql or sqlite for anything else than testing or development
"dbType" : "<%= @db_type %>",
//the database specific settings
"dbSettings" : {
"user" : "<%= @database_user %>",
"host" : "<%= @database_host %>",
"password": "<%= @database_password %>",
"database": "<%= @database_name %>"
},
//the default text of a pad
"defaultPadText" : "Welcome to Etherpad Lite!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nEtherpad Lite on Github: http:\/\/j.mp/ep-lite\n",
/* Users must have a session to access pads. This effectively allows only group pads to be accessed. */
"requireSession" : false,
/* Users may edit pads but not create new ones. Pad creation is only via the API. This applies both to group pads and regular pads. */
"editOnly" : false,
/* if true, all css & js will be minified before sending to the client. This will improve the loading performance massivly,
but makes it impossible to debug the javascript/css */
"minify" : true,
/* How long may clients use served javascript code? Without versioning this
is may cause problems during deployment. */
"maxAge" : 21600000, // 6 hours
/* This is the path to the Abiword executable. Setting it to null, disables abiword.
Abiword is needed to enable the import/export of pads*/
"abiword" : "/usr/bin/abiword",
/* This setting is used if you require authentication of all users.
Note: /admin always requires authentication. */
"requireAuthentication": false,
/* Require authorization by a module, or a user with is_admin set, see below. */
"requireAuthorization": false,
/* Users for basic authentication. is_admin = true gives access to /admin.
If you do not uncomment this, /admin will not be available! */
/*
"users": {
"admin": {
"password": "changeme1",
"is_admin": true
},
"user": {
"password": "changeme1",
"is_admin": false
}
},
*/
// restrict socket.io transport methods
"socketTransportProtocols" : ["websocket", "xhr-polling", "jsonp-polling", "htmlfile"],
/* The log level we are using, can be: DEBUG, INFO, WARN, ERROR */
"loglevel": "INFO",
//Logging configuration. See log4js documentation for further information
// https://github.com/nomiddlename/log4js-node
// You can add as many appenders as you want here:
"logconfig" :
{ "appenders": [
{ "type": "console"
//, "category": "access"// only logs pad access
}
/*
, { "type": "file"
, "filename": "/var/log/eplite/etherpad-lite.log"
, "maxLogSize": 1024
, "backups": 30 // how many log files there're gonna be at max
//, "category": "test" // only log a specific category
}*/
/*
, { "type": "logLevelFilter"
, "level": "warn" // filters out all log messages that have a lower level than "error"
, "appender":
{ Use whatever appender you want here }
}*/
/*
, { "type": "logLevelFilter"
, "level": "error" // filters out all log messages that have a lower level than "error"
, "appender":
{ "type": "smtp"
, "subject": "An error occured in your EPL instance!"
, "recipients": "bar@blurdybloop.com, baz@blurdybloop.com"
, "sendInterval": 60*5 // in secs -- will buffer log messages; set to 0 to send a mail for every message
, "transport": "SMTP", "SMTP": { // see https://github.com/andris9/Nodemailer#possible-transport-methods
"host": "smtp.example.com", "port": 465,
"secureConnection": true,
"auth": {
"user": "foo@example.com",
"pass": "bar_foo"
}
}
}
}*/
] }
}

View File

@ -1,113 +0,0 @@
<VirtualHost *:80>
ServerName <%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>
ServerAdmin <%= scope.lookupvar("etherpad_lite::apache::serveradmin") %>
ErrorLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>-access.log combined
Redirect / https://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>/
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName <%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>
ServerAdmin <%= scope.lookupvar("etherpad_lite::apache::serveradmin") %>
ErrorLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>-ssl-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>-ssl-access.log combined
SSLEngine on
SSLProtocol All -SSLv2 -SSLv3
SSLCertificateFile <%= scope.lookupvar("etherpad_lite::apache::ssl_cert_file") %>
SSLCertificateKeyFile <%= scope.lookupvar("etherpad_lite::apache::ssl_key_file") %>
<% if scope.lookupvar("etherpad_lite::apache::ssl_chain_file") != "" %>
SSLCertificateChainFile <%= scope.lookupvar("etherpad_lite::apache::ssl_chain_file") %>
<% end %>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
<% if @auth_openid != nil %>
<Location /p/>
AuthType OpenID
AuthName "<%= @auth_openid['banner'] %>"
AuthOpenIDSecureCookie On
AuthOpenIDCookieLifespan 3600
AuthOpenIDTrustRoot https://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>
AuthOpenIDServerName https://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>
AuthOpenIDSingleIdP <%= @auth_openid['singleIdp'] %>
AuthOpenIDTrusted <%= @auth_openid['trusted'] %>
<% if @auth_openid['any_valid_user'] %>
Require valid-user
<% elsif !@auth_openid['users'].empty? %>
<% @auth_openid['users'].each do |user| -%>
Require user <%= user %>
<% end -%>
<% end %>
</Location>
<% end %>
<IfModule mod_proxy.c>
# The following redirects "nice" urls such as https://etherpad.example.org/padname
# to https://etherpad.example.org/p/padname. It was problematic directly
# supporting "nice" urls as etherpad hardcodes /p/ in many places.
# Adapted from https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy
RewriteEngine on
# Do not rewrite the /server-status URL (though by default, this
# is only accessible from localhost). Connect to it with:
# ssh -L 8443:localhost:443 $HOSTNAME
# https://localhost:8443/server-status
RewriteRule ^/server-status$ /server-status [L]
RewriteCond %{HTTP_HOST} !<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>
RewriteRule ^.*$ https://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> [L,R=301]
# Server robots.txt directly so that it does not affect
# etherpad-lite installation.
RewriteRule ^/robots.txt$ <%= scope.lookupvar("etherpad_lite::apache::docroot") %>/robots.txt [L]
RewriteCond %{REQUEST_URI} !^/p/
RewriteCond %{REQUEST_URI} !^/locales/
RewriteCond %{REQUEST_URI} !^/locales.json
RewriteCond %{REQUEST_URI} !^/admin
RewriteCond %{REQUEST_URI} !^/p/
RewriteCond %{REQUEST_URI} !^/static/
RewriteCond %{REQUEST_URI} !^/pluginfw/
RewriteCond %{REQUEST_URI} !^/javascripts/
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://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>/p/$1 [NC,L,R=301]
<IfModule mod_proxy_wstunnel.c>
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:9001/$1 [P,L]
ProxyPass /socket.io http://localhost:9001/socket.io retry=0
ProxyPassReverse /socket.io http://localhost:9001/socket.io
</IfModule>
ProxyPass / http://localhost:9001/ retry=0
ProxyPassReverse / http://localhost:9001/
</IfModule>
</VirtualHost>
</IfModule>

View File

@ -1,29 +1,28 @@
description "etherpad-lite"
description "ethercalc"
start on started networking
stop on runlevel [!2345]
env EPHOME=<%= @base_install_dir %>/etherpad-lite
env EPLOGS=<%= @base_log_dir %>/<%= @ep_user %>
env EPUSER=<%= @ep_user %>
env ETHERCALC_HOME=<%= @base_install_dir %>
env ETHERCALC_LOGS=<%= @base_log_dir %>/<%= @ethercalc_user %>
env ETHERCALC_USER=<%= @ethercalc_user %>
respawn
pre-start script
chdir $EPHOME
mkdir $EPLOGS ||true
chown -R $EPUSER:admin $EPLOGS ||true
chmod 0755 $EPLOGS ||true
chown -R $EPUSER:admin $EPHOME/var ||true
bin/installDeps.sh >> $EPLOGS/error.log || { stop; exit 1; }
chdir $ETHERCALC_HOME
mkdir $ETHERCALC_LOGS ||true
chown -R $ETHERCALC_USER:admin $ETHERCALC_LOGS ||true
chmod 0755 $ETHERCALC_LOGS ||true
chown -R $ETHERCALC_USER:admin $ETHERCALC_HOME/var ||true
end script
setuid <%= @ep_user %>
setgid <%= @ep_user %>
setuid <%= @ethercalc_user %>
setgid <%= @ethercalc_user %>
limit nofile 8192 16384
script
cd $EPHOME
/usr/local/bin/node --stack_size=1968 node_modules/ep_etherpad-lite/node/server.js \
>> $EPLOGS/access.log \
2>> $EPLOGS/error.log
cd $ETHERCALC_HOME
/bin/bash node_modules/ethercalc/bin/run.sh \
>> $ETHERCALC_LOGS/access.log \
2>> $ETHERCALC_LOGS/error.log
end script