summaryrefslogtreecommitdiff
path: root/stories/projects/etherpad.rst
blob: cc75def52712db7ff9d4b70cef45ce2a27a74254 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
.. link:
.. description: is a documentation project on how to setup the classic etherpad software in a FreeBSD jail.
.. tags: project
.. date: 2015/02/01 19:10:08
.. title: etherpad
.. slug: ../arts/software/etherpad/index

.. contents::
  :depth: 1
  :class: ezjail-toc

----

Overview
========

This is how to install the etherpad from http://etherpad.org/ in a FreeBSD-8.2 jail. (N.B: Things are reported not to work with newer versions.)

This guide assumes, you have sudo, bash and an editor of your choice installed. Reserve around 2GB space for the jail. If you're using a different shell, use ``setenv`` to configure the environment variables set by ``export`` in this guide. Send feedback to `erdgeist <mailto:erdgeist-etherpad@erdgeist.org>`_. Many regards to `this guide <http://pauleira.com/13/installing-etherpad/>`_, it helped me a lot.

----

Install Scala + Java
====================

Since etherpad does not build under the version of scala that is shipped with FreeBSD-8.2 (i.e. scala-2.8.0), we have to manually install scala-2.7.7. However, scala brings nice dependencies that help with the manual installation of the jdk. So we install scala-2.8.0 to get the dependencies, then deinstall it and install java and scala.

* Fetch jdk here: `<jdk-1.6.0.3p4_15.tbz>`_
* Fetch scala-2.7.7 here: `<scala-2.7.7.tbz>`_

Then type::

  pkg_add -r scala
  pkg_delete -f scala\*
  pkg_add jdk-1.6.0.3p4_15.tbz scala-2.7.7.tbz

----

Install mysql, fastjar and java connector
=========================================

Type::

  pkg_add -r mysql55-server mysql-connector-java fastjar
  echo mysql_enable=YES >> /etc/rc.conf
  /usr/local/etc/rc.d/mysql-server start

----

Prepare mysql
=============

Connection in a jail comes from the jail IP, not from 127.0.0.1, so enter IPADDRESS accordingly

``mysql -u root``

and in the mysql shell::

  create database etherpad;
  grant all privileges on etherpad.* to 'etherpad'@'IPADDRESS' identified by 'MYSQLPASS_CHANGEME';

----

Checkout etherpad
=================

Type::

  pkg_add -r git
  cd /usr/local
  git clone git://github.com/ether/pad.git

known good commit 94d5b2dfd65abbee5a06d80d94cdb00a7947d9b1, otoh: you might want to check `my issue about this commit <https://github.com/ether/pad/issues/293>`_, overlay windows are broken atm.

----

Configure etherpad
==================

Type::

  cd /usr/local/pad/etherpad
  cp etc/etherpad.localdev-default.properties etc/etherpad.local.properties

and in your ``etc/etherpad.local.properties`` do:

* Change: devMode = false
* Change: etherpad.isProduction = true
* Change: etherpad.proAccounts = true
* Change: etherpad.adminPass = ADMINPASS_CHANGEME
* Change: etherpad.isProduction = true
* Change: etherpad.SQL_PASSWORD = MYSQLPASS_CHANGEME
* Change: listen = 0.0.0.0:9000
* Change: topdomains = pads.domain.tld,localhost
* Change: customEmailAddress = admin@pads.domain.tld
* Change: transportUseWildcardSubdomains = false
* Change: useHttpsUrls = true

Remember the passwords well, take special care about trailing spaces! Now setup your domain in the following files:

* src/main.js
* src/static/crossdomain.xml
* src/etherpad/pro/pro_utils.js
* src/etherpad/control/pad/pad_control.js
* src/etherpad/control/global_pro_account_control.js

To disable a per-pad quota, comment out the call to _checkPadQuota in src/etherpad/control/pad/pad_control.js

----

Rebuild the JAR
===============

Type::

  export JAVA_HOME="/usr/local/jdk1.6.0/"
  export JAVA="/usr/local/jdk1.6.0/bin/java"
  export SCALA="/usr/local/share/scala-2.7.7/bin/scala"
  export SCALA_HOME="/usr/local/share/scala-2.7.7/"
  export SCALA_LIBRARY_JAR="/usr/local/share/scala-2.7.7/lib/scala-library.jar"
  export PATH=/usr/local/share/scala-2.7.7/bin/:$PATH
  export MYSQL_CONNECTOR_JAR="/usr/local/share/java/classes/mysql-connector-java.jar"
  export mysql=mysql

Rebuild the ace dependency
--------------------------

This is especially important if you see this (google hint): ``net.appjet.bodylock.JSRuntimeException: Error: Neither module exists: etherpad.collab.ace.easysync2, etherpad.collab.ace.easysync2.``::

  cd /usr/local/pad/infrastructure/ace
  bin/make normal etherpad

Rebuild the JAR with correct settings
-------------------------------------

Type::

  cd /usr/local/pad/etherpad
  bin/rebuildjar.sh

----

Install nginx
=============

Type::

  cd /usr/ports/www/nginx
  make install clean

and be sure to select HTTPS.

----

Create Self Signed Certificates
===============================

For whatever your domain is, substitute it in the following commands::

  openssl genrsa -out pads.domain.tld.key 1024
  openssl req -new -key pads.domain.tld.key -out pads.domain.tld.csr
  echo "subjectAltName=DNS:pads.domain.tld,DNS:*.pads.domain.tld" >pads.domain.tld.conf
  openssl x509 -req -days 365 -in pads.domain.tld.csr -signkey pads.domain.tld.key -text -extfile pads.domain.tld.conf -out pads.domain.tld.crt
  cat pads.domain.tld.crt pads.domain.tld.key >/usr/local/etc/nginx/pads.domain.tld.pem

----

Configure nginx
===============

Nginx configs were provided by cryx. Thank you. Fetch ``nginx.conf`` here: `<nginx.conf>`_ and put it to ``/usr/local/etc/nginx/``. Then in your local ``nginx.conf`` do:

* Change: server_name pads.domain.tld \*.pads.domain.tld; take special care to include the wildcard subdomains
* Change: ssl_certificate pads.domain.tld.pem; as created above

Fetch ``nginx-etherpad.conf`` here: `<nginx-etherpad.conf>`_ and put it to ``/usr/local/etc/nginx/``. Then in your local ``nginx-etherpad.conf`` do:

* Change: server_name pads.domain.tld \*.pads.domain.tld; take special care to include the wildcard subdomains
* Change: proxy_pass http://pads.domain.tld:9000/;

Type::

  mkdir /var/log/www/; chown www:www /var/log/www
  echo nginx_enable=YES >> /etc/rc.conf

----

Install start script
====================

Fetch rc script here: `<etherpad>`_ and put it to ``/usr/local/etc/rc.d/``.

Type::

  chmod +x /usr/local/etc/rc.d/etherpad
  echo etherpad_enable=YES >> /etc/rc.conf
  mkdir /var/run/etherpad; chown etherpad /var/run/etherpad
  chown -R etherpad:etherpad /usr/local/pad

----

Install openoffice
==================

If you want to export word and pdf documents, you need to install openoffice and run it as a headless service.

Fetch the libreoffice package here: http://wiki.bsdforen.de/anwendungen/libreoffice_aus_inoffiziellen_paketen#freebsd_amd64i386_87-stable_kamikaze or, a know working mirror for `<libreoffice-3.3.3.tbz>`_, MD5 (libreoffice-3.3.3.tbz) = 028d259735b361e46af8a9e253f168a8.

Install dependencies, ignore warnings about already installed older versions::

  pkg_add -r xineramaproto xf86vidmodeproto xextproto videoproto renderproto randrproto printproto kbproto inputproto fixesproto dri2proto damageproto compositeproto font-util encodings libtextcat expat gnome_subr ca_root_nss hicolor-icon-theme gnomehier lp_solve python27 xcb-proto perl hu-hunspell poppler-data png lcms jpeg jbigkit tiff openjpeg jasper curl pkg-config xproto pixman libtasn1 libfontenc libXdmcp libXau libICE libSM freetype2 mkfontscale mkfontdir fontconfig font-misc-meltho font-misc-ethiopic font-bh-ttf bitstream-vera xorg-fonts-truetype pcre orc m4 libpthread-stubs libxcb xcb-util libdrm libX11 libXt libXrender libXft libXfixes libXext libXxf86vm libXv libXrandr libXpm libXp libXmu libXinerama libXi libXdamage libXcursor libXcomposite libXaw libGL libGLU libltdl libffi libcheck icu db41 libiconv libxml2 raptor rasqal redland gettext libgpg-error libgcrypt glib gamin gio-fam-backend shared-mime-info libIDL gdk-pixbuf desktop-file-utils dbus libgee dbus-glib eggdbus cairo poppler bison gobject-introspection gstreamer gstreamer-plugins polkit pango ORBit2 lzo2 gnutls cups-client atk gtk dconf gconf2 libgsf libwpd libwps libwpg libxslt

Install the local package::

  pkg_add -f libreoffice-3.3.3.tbz

Fetch rc script here: `<soffice>`_ and put it to ``/usr/local/etc/rc.d/``. Then type::

  chmod +x /usr/local/etc/rc.d/soffice
  echo soffice_enable=YES >> /etc/rc.conf

----

Configure name server
=====================

Add records for the pads and wildcard subdomains, for tinydns this is::

  +pads.domain.tld:192.168.0.23:43200
  +*.pads.domain.tld:192.168.0.23:43200

----

Filter local services
=====================

Add rules to filter ports 9000 and 3306 to pf.