From 504b9df0c1d625d3d0383d2e9039aee3335f6125 Mon Sep 17 00:00:00 2001 From: Jonathan Harker Date: Wed, 28 Jan 2015 14:53:11 -0500 Subject: [PATCH] Split out etherpad_lite module Change-Id: Ie8f2f9fd2f02c3a26576705f19dee012d8ce01c0 Depends-On: Ie0238c091eb16bfb7afa82c3079193f21f7fc1da --- modules.env | 1 + .../files/apache-connection-tuning | 29 ---- modules/etherpad_lite/files/pad.js | 7 - modules/etherpad_lite/files/robots.txt | 2 - modules/etherpad_lite/manifests/apache.pp | 86 ------------ .../etherpad_lite/manifests/buildsource.pp | 38 ----- modules/etherpad_lite/manifests/init.pp | 130 ------------------ modules/etherpad_lite/manifests/plugin.pp | 13 -- modules/etherpad_lite/manifests/site.pp | 77 ----------- .../templates/etherpad-lite_settings.json.erb | 120 ---------------- .../templates/etherpadlite.vhost.erb | 74 ---------- modules/etherpad_lite/templates/upstart.erb | 26 ---- 12 files changed, 1 insertion(+), 602 deletions(-) delete mode 100644 modules/etherpad_lite/files/apache-connection-tuning delete mode 100644 modules/etherpad_lite/files/pad.js delete mode 100644 modules/etherpad_lite/files/robots.txt delete mode 100644 modules/etherpad_lite/manifests/apache.pp delete mode 100644 modules/etherpad_lite/manifests/buildsource.pp delete mode 100644 modules/etherpad_lite/manifests/init.pp delete mode 100644 modules/etherpad_lite/manifests/plugin.pp delete mode 100644 modules/etherpad_lite/manifests/site.pp delete mode 100644 modules/etherpad_lite/templates/etherpad-lite_settings.json.erb delete mode 100644 modules/etherpad_lite/templates/etherpadlite.vhost.erb delete mode 100644 modules/etherpad_lite/templates/upstart.erb diff --git a/modules.env b/modules.env index 0136e02595..b73281318e 100644 --- a/modules.env +++ b/modules.env @@ -57,6 +57,7 @@ SOURCE_MODULES["https://github.com/puppet-community/puppet-module-puppetboard"]= # Add modules that should be part of the openstack-infra integration test here INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-elasticsearch"]="origin/master" +INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-etherpad_lite"]="origin/master" INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-gerrit"]="origin/master" INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-storyboard"]="origin/master" INTEGRATION_MODULES["https://git.openstack.org/openstack-infra/puppet-kibana"]="origin/master" diff --git a/modules/etherpad_lite/files/apache-connection-tuning b/modules/etherpad_lite/files/apache-connection-tuning deleted file mode 100644 index f3a2400cdc..0000000000 --- a/modules/etherpad_lite/files/apache-connection-tuning +++ /dev/null @@ -1,29 +0,0 @@ -# worker MPM -# StartServers: initial number of server processes to start -# MinSpareThreads: minimum number of worker threads which are kept spare -# MaxSpareThreads: maximum number of worker threads which are kept spare -# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a -# graceful restart. ThreadLimit can only be changed by stopping -# and starting Apache. -# ThreadsPerChild: constant number of worker threads in each server process -# 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 -# 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 -# 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 -# spare threads around to better handle thundering herds of users (eg at the -# start of summit sessions). - - ServerLimit 64 - StartServers 3 - MinSpareThreads 96 - MaxSpareThreads 192 - ThreadLimit 64 - ThreadsPerChild 32 - MaxClients 2048 - MaxRequestsPerChild 0 - diff --git a/modules/etherpad_lite/files/pad.js b/modules/etherpad_lite/files/pad.js deleted file mode 100644 index 1fe0210987..0000000000 --- a/modules/etherpad_lite/files/pad.js +++ /dev/null @@ -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); -} diff --git a/modules/etherpad_lite/files/robots.txt b/modules/etherpad_lite/files/robots.txt deleted file mode 100644 index 1f53798bb4..0000000000 --- a/modules/etherpad_lite/files/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: / diff --git a/modules/etherpad_lite/manifests/apache.pp b/modules/etherpad_lite/manifests/apache.pp deleted file mode 100644 index 95558ab9ea..0000000000 --- a/modules/etherpad_lite/manifests/apache.pp +++ /dev/null @@ -1,86 +0,0 @@ -# == Class: etherpad_lite::apache -# -class etherpad_lite::apache ( - $vhost_name = $::fqdn, - $serveradmin = "webmaster@${::fqdn}", - $ssl_cert_file = '', - $ssl_key_file = '', - $ssl_chain_file = '', - $ssl_cert_file_contents = '', # If left empty puppet will not create file. - $ssl_key_file_contents = '', # If left empty puppet will not create file. - $ssl_chain_file_contents = '' # If left empty puppet will not create file. -) { - - package { 'ssl-cert': - ensure => present, - } - - include apache - apache::vhost { $vhost_name: - port => 443, - docroot => 'MEANINGLESS ARGUMENT', - priority => '50', - template => 'etherpad_lite/etherpadlite.vhost.erb', - ssl => true, - } - a2mod { 'rewrite': - ensure => present, - } - a2mod { 'proxy': - ensure => present, - } - a2mod { 'proxy_http': - ensure => present, - } - file { '/etc/apache2/conf.d/connection-tuning': - ensure => present, - owner => 'root', - group => 'root', - mode => '0644', - source => 'puppet:///modules/etherpad_lite/apache-connection-tuning', - notify => Service['httpd'], - } - - file { '/etc/ssl/certs': - ensure => directory, - owner => 'root', - mode => '0755', - } - - file { '/etc/ssl/private': - ensure => directory, - owner => 'root', - mode => '0700', - } - - if $ssl_cert_file_contents != '' { - file { $ssl_cert_file: - owner => 'root', - group => 'root', - mode => '0640', - content => $ssl_cert_file_contents, - before => Apache::Vhost[$vhost_name], - } - } - - if $ssl_key_file_contents != '' { - file { $ssl_key_file: - owner => 'root', - group => 'ssl-cert', - mode => '0640', - content => $ssl_key_file_contents, - require => Package['ssl-cert'], - before => Apache::Vhost[$vhost_name], - } - } - - if $ssl_chain_file_contents != '' { - file { $ssl_chain_file: - owner => 'root', - group => 'root', - mode => '0640', - content => $ssl_chain_file_contents, - before => Apache::Vhost[$vhost_name], - } - } -} diff --git a/modules/etherpad_lite/manifests/buildsource.pp b/modules/etherpad_lite/manifests/buildsource.pp deleted file mode 100644 index a2ebbd056b..0000000000 --- a/modules/etherpad_lite/manifests/buildsource.pp +++ /dev/null @@ -1,38 +0,0 @@ -# == Define: buildsource -# -# define to build from source using ./configure && make && make install. -# -define etherpad_lite::buildsource( - $dir = $title, - $user = 'root', - $timeout = 300, - $creates = '/nonexistant/file' -) { - - 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, - } -} diff --git a/modules/etherpad_lite/manifests/init.pp b/modules/etherpad_lite/manifests/init.pp deleted file mode 100644 index f154daf9f5..0000000000 --- a/modules/etherpad_lite/manifests/init.pp +++ /dev/null @@ -1,130 +0,0 @@ -# == Class: etherpad_lite -# -# Class to install etherpad lite. Puppet acts a lot like a package manager -# through this class. -# -# 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 -# The defaults for all the classes should just work (tm) -# -# -class etherpad_lite ( - $ep_user = 'eplite', - $base_log_dir = '/var/log', - $base_install_dir = '/opt/etherpad-lite', - $nodejs_version = 'v0.10.21', - $eplite_version = 'develop' -) { - - # where the modules are, needed to easily install modules later - $modules_dir = "${base_install_dir}/etherpad-lite/node_modules" - $path = "/usr/bin:/bin:/usr/local/bin:${base_install_dir}/etherpad-lite" - - user { $ep_user: - shell => '/sbin/nologin', - home => "${base_log_dir}/${ep_user}", - system => true, - gid => $ep_user, - require => Group[$ep_user], - } - - group { $ep_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. - file { $base_install_dir: - ensure => directory, - group => $ep_user, - mode => '0664', - } - - vcsrepo { "${base_install_dir}/nodejs": - ensure => present, - provider => git, - source => 'https://github.com/joyent/node.git', - revision => $nodejs_version, - require => [ - Package['git'], - File[$base_install_dir], - ], - } - - package { [ - 'gzip', - 'curl', - 'python', - 'libssl-dev', - 'pkg-config', - 'abiword', - 'build-essential', - ]: - ensure => present, - } - - package { ['nodejs', 'npm']: - ensure => purged, - } - - buildsource { "${base_install_dir}/nodejs": - timeout => 900, # 15 minutes - creates => '/usr/local/bin/node', - require => [ - Package['gzip'], - Package['curl'], - Package['python'], - Package['libssl-dev'], - Package['pkg-config'], - Package['build-essential'], - Vcsrepo["${base_install_dir}/nodejs"], - ], - } - - vcsrepo { "${base_install_dir}/etherpad-lite": - ensure => present, - provider => git, - source => 'https://github.com/ether/etherpad-lite.git', - owner => $ep_user, - revision => $eplite_version, - require => [ - Package['git'], - User[$ep_user], - ], - } - - 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 => [ - Vcsrepo["${base_install_dir}/etherpad-lite"], - Buildsource["${base_install_dir}/nodejs"], - ], - before => File["${base_install_dir}/etherpad-lite/settings.json"], - creates => "${base_install_dir}/etherpad-lite/node_modules", - } - - file { '/etc/init/etherpad-lite.conf': - ensure => present, - content => template('etherpad_lite/upstart.erb'), - replace => true, - owner => 'root', - } - - file { '/etc/init.d/etherpad-lite': - ensure => link, - target => '/lib/init/upstart-job', - } - - file { "${base_log_dir}/${ep_user}": - ensure => directory, - owner => $ep_user, - } - # end package management ugliness -} diff --git a/modules/etherpad_lite/manifests/plugin.pp b/modules/etherpad_lite/manifests/plugin.pp deleted file mode 100644 index f319a71915..0000000000 --- a/modules/etherpad_lite/manifests/plugin.pp +++ /dev/null @@ -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'] - } -} diff --git a/modules/etherpad_lite/manifests/site.pp b/modules/etherpad_lite/manifests/site.pp deleted file mode 100644 index 6dc3e11fce..0000000000 --- a/modules/etherpad_lite/manifests/site.pp +++ /dev/null @@ -1,77 +0,0 @@ -# == Class: etherpad_lite::site -# -class etherpad_lite::site ( - $database_password, - $etherpad_title, - $sessionKey = '', - $dbType = 'mysql', - $database_user = 'eplite', - $database_name = 'etherpad-lite', - $database_host = 'localhost' -) { - - 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'], - } - - file { "${base}/etherpad-lite/src/static/robots.txt": - ensure => present, - source => 'puppet:///modules/etherpad_lite/robots.txt', - 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'], - } -} diff --git a/modules/etherpad_lite/templates/etherpad-lite_settings.json.erb b/modules/etherpad_lite/templates/etherpad-lite_settings.json.erb deleted file mode 100644 index 74f3522839..0000000000 --- a/modules/etherpad_lite/templates/etherpad-lite_settings.json.erb +++ /dev/null @@ -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" : "<%= sessionKey %>", - - //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" : "<%= dbType %>", - //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" : ["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" - } - } - } - }*/ - ] } -} diff --git a/modules/etherpad_lite/templates/etherpadlite.vhost.erb b/modules/etherpad_lite/templates/etherpadlite.vhost.erb deleted file mode 100644 index e6711bb950..0000000000 --- a/modules/etherpad_lite/templates/etherpadlite.vhost.erb +++ /dev/null @@ -1,74 +0,0 @@ - - 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") %>/ - - - - - - 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 - - - # 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 - RewriteCond %{HTTP_HOST} !<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> - RewriteRule ^.*$ https://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> [L,R=301] - - 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] - - RewriteRule ^/(.*)$ http://localhost:9001/$1 [P] - ProxyPassReverse / http://localhost:9001/ - - - - diff --git a/modules/etherpad_lite/templates/upstart.erb b/modules/etherpad_lite/templates/upstart.erb deleted file mode 100644 index f50cd911d2..0000000000 --- a/modules/etherpad_lite/templates/upstart.erb +++ /dev/null @@ -1,26 +0,0 @@ -description "etherpad-lite" - -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 %> - -respawn - -pre-start script - chdir $EPHOME - mkdir $EPLOGS ||true - chown $EPUSER:admin $EPLOGS ||true - chmod 0755 $EPLOGS ||true - chown -R $EPUSER:admin $EPHOME/var ||true - bin/installDeps.sh >> $EPLOGS/error.log || { stop; exit 1; } -end script - -script - cd $EPHOME - exec su -s /bin/sh -c 'exec "$0" "$@"' $EPUSER -- /usr/local/bin/node --stack_size=1968 node_modules/ep_etherpad-lite/node/server.js \ - >> $EPLOGS/access.log \ - 2>> $EPLOGS/error.log -end script