Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add sane install process, documentation, and centralized config options

setup.sh assumes one superdomain.  The superdomain is set in the
site preferences file generated by setup.sh.
The SUPERDOMAINS object is generated on-demand to remove the need to
edit additional files by hand.
crossdomain.xml is auto-generated by setup.sh.
etherpad pro expiration date attributes are commented out.  nobody expires.
install docs => INSTALL
general commentary => README

email from addresses aren't hardcoded anymore.

The ugly, unnecessary, overly complicated (but required for mysql) db
setup script is gone now too.  We just need 'createdb' by default.

--HG--
rename : env.sh => env.sh.template
rename : etherpad/etc/etherpad.localdev-default.properties => etherpad/etc/etherpad.localdev-default.properties.in
rename : etherpad/src/static/crossdomain.xml => etherpad/src/static/crossdomain.xml.in
  • Loading branch information...
commit dd3c6172f34681c7bada0b1adb759d9c745acff3 1 parent 15f7170
Matt Stancliff authored
12 .hgignore
View
@@ -1,7 +1,17 @@
syntax: glob
*.class
-buildcache
+*.swp
+buildcache/
build/
+data/
+local/
etherpad/data/
+
postgresql*.jar
appjet-eth-dev.jar
+etherpad-pne-*.jar
+
+env.sh
+crossdomain.xml
+*.properties
+.config
101 INSTALL
View
@@ -0,0 +1,101 @@
+%%%----------------------------------------------------------------------
+%%% Installing Etherpad
+%%%----------------------------------------------------------------------
+
+etherpad-postgres is easy to install.
+
+You'll need:
+ * PostgreSQL: http://www.postgresql.org/download/
+ * PostgreSQL JDBC Driver: http://jdbc.postgresql.org/download.html
+ * Scala: http://www.scala-lang.org/downloads
+ * Java 1.6+: http://www.java.com/en/download/manual.jsp
+
+Assumptions:
+ * PostgreSQL is running on localhost and listening on port 5432
+ * You have properly set up PostgreSQL authentication
+ * You're allocating an entire domain name to Etherpad
+ * You have a SMTP server at localhost:25
+
+ If any of these assumptions are not valid, you will need to manually
+ edit the config file after you run setup.sh. The config file is at:
+ etherpad/etc/etherpad.localdev-default.properties.
+
+Quick Steps:
+ useradd -u 1020 etherpad
+ createuser etherpad
+ createdb etherpad
+ ./setup.sh
+ ./run.sh
+
+Detailed Steps:
+ 0. Make an etherpad user on your system:
+ - useradd -u 1020 etherpad
+ 1. Make an etherpad postgres user with normal permissions:
+ - createuser etherpad
+ 2. As your etherpad user, make your etherpad db:
+ - createdb etherpad
+ 3. Copy env.sh.template to env.sh and fix paths to reflect
+ where things are installed on your system.
+ 4. Run ./setup.sh and answer a few questions.
+ - a.) What domain name will you be running as?
+ - b.) On this machine, what IP:port do you want to bind to?
+ - c.) What admin password do you want to use?
+ * NB: Your settings file is at:
+ - etherpad/etc/etherpad.localdev-default.properties
+ Feel free to play around with other values there.
+ If you re-run setup, your config will be overridden.
+ If you want to re-run setup and forget your previous
+ answers, run ./setup.sh clean
+ * setup.sh does an initial run of ./etherpad/bin/rebuildjar.sh
+ If you modify any non-JavaScript files, you need to re-run
+ rebuildjar.sh.
+ 5. At this point, with postgres working, env.sh edited, and
+ after running setup.sh, run ./run.sh to start etherpad.
+ You'll see a bunch of DB migrations run and if all goes
+ well, you'lll be greeted with:
+ HTTP server listening on http://[your ip:port binding]/
+
+
+%%%----------------------------------------------------------------------
+%%% Configuration Notes
+%%%----------------------------------------------------------------------
+
+nginx setup
+===========
+If you want to run behind nginx, the only config you need in your virtual
+server is:
+ location / {
+ proxy_pass http://localhost:9000/ # <-- point to your etherpad listening URL
+ proxy_set_header Host $host;
+ }
+
+It's important you force the re-writing of the Host header or else all of
+the redirects Etherpad generates will be incorrect.
+
+multiple superdomains
+=====================
+The install process assumes *one* superdomain. The single default superdomain
+is defined by fromDomain in etherpad/etc/etherpad.localdev-default.properties.
+
+If you want to use multiple superdomains, you need to manually add the domain
+to each of:
+ etherpad/src/static/crossdomain.xml
+ etherpad/src/etherpad/globals.js
+
+setup.sh will always override any changes to those files with fresh copies.
+Make sure to copy them out of the way if you have local changes and need
+to re-run setup.sh.
+
+DNS notes
+=========
+To get around browser limits of two to six connections per server, Etherpad
+likes to use made up subdomains that all resolve to the same host. If your
+site doesn't have wildcard DNS under your Etherpad hostname, change this
+to false in etherpad/etc/etherpad.localdev-default.properties:
+transportUseWildcardSubdomains = true
+
+
+
+%%%----------------------------------------------------------------------
+%%% End of INSTALL (love, matt)
+%%%----------------------------------------------------------------------
37 README
View
@@ -1,3 +1,40 @@
+%%%----------------------------------------------------------------------
+%%% Matt's README
+%%%----------------------------------------------------------------------
+
+This repository is EtherPad with a few goals:
+ * Add PostgreSQL support. Remove all MySQL and Derby support.
+ * Make EtherPad easy to install and setup without having to modify
+ a dozen files by hand each time.
+ * Rip out all etherpad.com specific mentions (URLs, email addresses,
+ support links) and cleanup unused parts (like .gitignore files being put
+ in a mercurial repo).
+
+The original EtherPad repository on Google Code had a crappy directory layout
+so I fixed it in the initial commit of this repository. As a consequence,
+you can't push or pull between the "official" EtherPad repository. I don't
+see this as a major problem because the Google Code EtherPad repository is
+most likely dead.
+
+Potential future goals after learning the code further:
+ * Add git hooks to create a branchy revisioned live-editable pasteboard.
+
+%%%----------------------------------------------------------------------
+%%% Current Status: 2009/12/25
+%%%----------------------------------------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Project | Status | When
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Remove MySQL Support | Complete | 2009/12/19-24
+PostgreSQL Support | Complete | 2009/12/24
+Simplify install procedure | Complete | 2009/12/24
+Remove etherpad.com specific parts | In-progress |
+Find missing parts of blog infrastructure | Not Started |
+
+%%%----------------------------------------------------------------------
+%%% The Original EtherPad README is below
+%%%----------------------------------------------------------------------
+
EtherPad is a web-based realtime collaborative document editor.
EtherPad currently lives at http://code.google.com/p/etherpad
2  env.sh → env.sh.template
View
@@ -1,5 +1,7 @@
#!/bin/sh
+# Copy this file to env-local.sh and make changes there
+
export JAVA_HOME="/usr/java/jdk1.6.0_14"
export SCALA_HOME="/sw/scala"
export JAVA="$JAVA_HOME/bin/java"
8 etherpad/.hgignore
View
@@ -1,8 +0,0 @@
-syntax: glob
-data/
-build
-derby.log
-local
-*.swp
-appjet-eth*.jar
-etherpad-pne-*.jar
30 etherpad/bin/setup-mysql-db.sh
View
@@ -1,30 +0,0 @@
-#!/bin/bash -e
-
-# Copyright 2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-if [ `whoami` != "root" ]; then
- echo "Must run as root, i.e., sudo $0"
- exit 1
-fi
-
-db="etherpad"
-
-echo "Creating etherpad ${db}..."
-echo "create database ${db};" | ${mysql} -u root
-
-echo "Granting priviliges..."
-echo "grant all privileges on ${db}.* to 'etherpad'@'localhost' identified by 'password';" | ${mysql} -u root
-
-echo "Success"
16 etherpad/etc/etherpad.localdev-default.properties
View
@@ -1,16 +0,0 @@
-ajstdlibHome = ../infrastructure/framework-src/modules
-appjetHome = ./data/appjet
-devMode = true
-etherpad.adminPass = password
-etherpad.fakeProduction = false
-etherpad.isProduction = false
-etherpad.SQL_JDBC_DRIVER = org.postgresql.Driver
-etherpad.SQL_JDBC_URL = jdbc:postgresql://localhost:5432/etherpad
-etherpad.SQL_PASSWORD = password
-etherpad.SQL_USERNAME = etherpad
-listen = 9000
-logDir = ./data/logs
-modulePath = ./src
-transportPrefix = /comet
-transportUseWildcardSubdomains = true
-useVirtualFileRoot = ./src
25 etherpad/etc/etherpad.localdev-default.properties.in
View
@@ -0,0 +1,25 @@
+ajstdlibHome = ../infrastructure/framework-src/modules
+appjetHome = ./data/appjet
+# devMode = true means show detailed output (live hits, errors) when running
+devMode = false
+smtpServer = localhost:25
+etherpad.adminPass = ADMIN_PASS
+etherpad.fakeProduction = false
+# isProduction = true means don't show stack traces when errors happen
+etherpad.isProduction = true
+etherpad.SQL_JDBC_DRIVER = org.postgresql.Driver
+etherpad.SQL_JDBC_URL = jdbc:postgresql://localhost:5432/etherpad
+etherpad.SQL_USERNAME = etherpad
+etherpad.SQL_PASSWORD = password
+etherpad.skipHostnameCheck = true
+etherpad.email.fromAddr = EMAIL_FROM_ADDR
+#etherpad.soffice=/opt/openoffice.org3/program/soffice.bin
+#etherpad.sofficeConversionServer=localhost:8100
+debugSQL = false
+listen = LISTEN_AT
+fromDomain = FROM_DOMAIN
+logDir = ./data/logs
+modulePath = ./src
+transportPrefix = /comet
+transportUseWildcardSubdomains = true
+useVirtualFileRoot = ./src
2  etherpad/src/etherpad/control/global_pro_account_control.js
View
@@ -125,7 +125,7 @@ function render_recover_post() {
response.redirect(_recoverLink(accountList[0], domainList[0]));
}
if (accountList.length > 1) {
- var fromAddr = '"EtherPad Support" <support@etherpad.com>';
+ var fromAddr = pro_utils.getEmailFromAddr();
var subj = "EtherPad: account information";
var body = renderTemplateAsString(
'pro/account/global-multi-domain-recover-email.ejs', {
2  etherpad/src/etherpad/control/pad/pad_control.js
View
@@ -661,7 +661,7 @@ function render_emailinvite_post() {
{toEmails: toEmails, padId: padId, username: username,
subject: subject, message: message});
- var fromAddr = '"EtherPad" <noreply@etherpad.com>';
+ var fromAddr = pro_utils.getEmailFromAddr();
// client enforces non-empty subject and message
var subj = '[EtherPad] '+subject;
var body = renderTemplateAsString('email/padinvite.ejs',
2  etherpad/src/etherpad/control/pro/pro_main_control.js
View
@@ -70,7 +70,7 @@ function render_main() {
renderFramed('pro/pro_home.ejs', {
isEvaluation: licensing.isEvaluation(),
- evalExpDate: licensing.getLicense().expiresDate,
+// evalExpDate: licensing.getLicense().expiresDate,
account: getSessionProAccount(),
isPNE: pne_utils.isPNE(),
pneVersion: pne_utils.getVersionString(),
14 etherpad/src/etherpad/globals.js
View
@@ -26,15 +26,17 @@ function isProduction() {
return (appjet.config['etherpad.isProduction'] == "true");
}
-var SUPERDOMAINS = {
- 'localbox.info': true,
- 'localhost': true,
- 'etherpad.com': true
-};
+var global_fromDomain = function() { return appjet.config['fromDomain'].toString() }
+var get_superdomains = function() {
+ var fromDomain = global_fromDomain();
+ var superdomains = {};
+ superdomains['localhost'] = true;
+ superdomains[fromDomain] = true;
+ return superdomains;
+}
var PNE_RELEASE_VERSION = "1.1.3";
var PNE_RELEASE_DATE = "June 15, 2009";
var PRO_FREE_ACCOUNTS = 1e9;
-
3  etherpad/src/etherpad/pro/pro_utils.js
View
@@ -69,6 +69,7 @@ function _computeIsProDomainRequest() {
var domain = _stripComet(request.domain);
+ var SUPERDOMAINS = get_superdomains();
if (SUPERDOMAINS[domain]) {
return false;
}
@@ -145,7 +146,7 @@ function getFullSuperdomainHost() {
}
function getEmailFromAddr() {
- var fromDomain = 'etherpad.com';
+ var fromDomain = appjet.config['fromDomain'];
if (pne_utils.isPNE()) {
fromDomain = getFullProDomain();
}
1  etherpad/src/etherpad/sessions.js
View
@@ -156,6 +156,7 @@ function preRequestCookieCheck() {
}
// Only superdomains can set cookies.
+ var SUPERDOMAINS = get_superdomains();
var isSuperdomain = SUPERDOMAINS[request.domain];
if (isSuperdomain) {
5 etherpad/src/main.js
View
@@ -252,6 +252,8 @@ function checkRequestIsWellFormed() {
// checkHost()
//----------------------------------------------------------------
function checkHost() {
+ var fromDomain = appjet.config['fromDomain'];
+
if (appjet.config['etherpad.skipHostnameCheck'] == "true") {
return;
}
@@ -261,6 +263,7 @@ function checkHost() {
}
// we require the domain to either be <superdomain> or a pro domain request.
+ var SUPERDOMAINS = GET_SUPERDOMAINS();
if (SUPERDOMAINS[request.domain]) {
return;
}
@@ -269,7 +272,7 @@ function checkHost() {
}
// redirect to etherpad.com
- var newurl = "http://etherpad.com"+request.path;
+ var newurl = fromDomain+request.path;
if (request.query) { newurl += "?"+request.query; }
response.redirect(newurl);
}
6 etherpad/src/static/crossdomain.xml → etherpad/src/static/crossdomain.xml.in
View
@@ -3,8 +3,6 @@
xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFile.xsd">
<site-control permitted-cross-domain-policies="all"/>
<allow-http-request-headers-from domain="*" headers="*"/>
-<allow-access-from domain="*.tokbox.com" to-ports="*"/>
-<allow-access-from domain="tokbox.com" to-ports="*"/>
-<allow-access-from domain="*.etherpad.com" to-ports="*"/>
-<allow-access-from domain="etherpad.com" to-ports="*"/>
+<allow-access-from domain="*.FROM_DOMAIN" to-ports="*"/>
+<allow-access-from domain="FROM_DOMAIN" to-ports="*"/>
</cross-domain-policy>
17 run.sh
View
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+base=`dirname $0`
+env=$base/env.sh
+
+if [[ ! -f $env ]]; then
+ echo "You need to copy $base/env.sh.template to $env and set proper values."
+ exit 2
+fi
+
+. $env
+
+pushd $base/etherpad >& /dev/null
+# Since values in the properties file are relative, we have
+# to start everything from the base etherpad directory.
+./bin/run-local.sh
+popd >& /dev/null
54 setup.sh
View
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+base=`dirname $0`
+ebase=$base/etherpad
+config=$base/.config
+config_version=7
+
+if [[ $1 == clean ]]; then
+ rm -f .config
+fi
+
+if [[ -f $config ]]; then
+ . $config
+ if [[ $saved_config_version != $config_version ]]; then
+ echo "Your saved config is too old. You need to setup again."
+ rm -f $config && exec $0
+ fi
+else
+ echo -n "Domain for your etherpad install (e.g. etherpad.com): "
+ read domain
+
+ echo -n "IP (or hostname) and port to bind to (e.g. 127.0.0.1:9000): "
+ read listen_at
+
+ echo -n "Password to use for admin access (stored as plain text): "
+ read admin_pass
+fi
+
+echo "Using domain $domain binding to $listen_at with admin pass $admin_pass"
+
+REPLACE_ME="$ebase/src/static/crossdomain.xml.in
+ $ebase/etc/etherpad.localdev-default.properties.in"
+
+for in_file in $REPLACE_ME; do
+ in_file_out=${in_file%.in}
+ echo "Applying settings to $in_file_out"
+ sed "s/FROM_DOMAIN/$domain/g;
+ s/LISTEN_AT/$listen_at/g;
+ s/EMAIL_FROM_ADDR/etherpad@$domain/g;
+ s/ADMIN_PASS/$admin_pass/g;" $in_file > $in_file_out
+done
+
+echo "Saving your config settings for later."
+echo "
+domain=$domain
+listen_at=$listen_at
+admin_pass=$admin_pass
+saved_config_version=$config_version
+" > $base/.config
+
+./etherpad/bin/rebuildjar.sh
+
+echo "Now use $base/run.sh to get things started."
+
Please sign in to comment.
Something went wrong with that request. Please try again.