Skip to content

Commit

Permalink
Included Etherpad Lite installation scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sem committed Dec 21, 2011
1 parent 1af94f7 commit 5c89c02
Show file tree
Hide file tree
Showing 8 changed files with 467 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ Requires:
etherpad lite 1.0 http://etherpad.org/download/


Install:
Install Etherpad Lite:
Run install/INSTALL.sh (as sudo) and follow its instructions.
It will install ep-lite dependences (node.js, npm...), install
and configure ep-lite and finally create a daemon to manage it.

Install Plugin:
Extract plugin.
Copy the etherpad folder and its contents into elgg's mod directory.
Enable plugin from admin settings.
Expand Down
7 changes: 6 additions & 1 deletion etherpad/README
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ Requires:
etherpad lite 1.0 http://etherpad.org/download/


Install:
Install Etherpad Lite:
Run install/INSTALL.sh (as sudo) and follow its instructions.
It will install ep-lite dependences (node.js, npm...), install
and configure ep-lite and finally create a daemon to manage it.

Install Plugin:
Extract plugin.
Copy the etherpad folder and its contents into elgg's mod directory.
Enable plugin from admin settings.
Expand Down
7 changes: 7 additions & 0 deletions etherpad/install/INSTALL.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#sh node.sh
#sh npm.sh
#sh etherpad-lite.sh
echo "Copy this API KEY:"
echo ""
cat /usr/share/etherpad-lite/APIKEY.txt
echo ""
77 changes: 77 additions & 0 deletions etherpad/install/ep-daemon
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/sh

### BEGIN INIT INFO
# Provides: etherpad-lite
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts etherpad lite
# Description: starts etherpad lite using start-stop-daemon
### END INIT INFO

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin"
LOGFILE="/var/log/etherpad-lite/etherpad-lite.log"
EPLITE_DIR="/usr/share/etherpad-lite"
EPLITE_BIN="bin/safeRun.sh"
USER="etherpad-lite"
GROUP="etherpad-lite"
DESC="Etherpad Lite"
NAME="etherpad-lite"

set -e

. /lib/lsb/init-functions

start() {
echo "Starting $DESC... "

start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec $EPLITE_DIR/$EPLITE_BIN -- $LOGFILE || true
echo "done"
}

#We need this function to ensure the whole process tree will be killed
killtree() {
local _pid=$1
local _sig=${2-TERM}
for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
killtree ${_child} ${_sig}
done
kill -${_sig} ${_pid}
}

stop() {
echo "Stopping $DESC... "
while test -d /proc/$(cat /var/run/$NAME.pid); do
killtree $(cat /var/run/$NAME.pid) 15
sleep 0.5
done
rm /var/run/$NAME.pid
echo "done"
}

status() {
status_of_proc -p /var/run/$NAME.pid "" "etherpad-lite" && exit 0 || exit $?
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $NAME {start|stop|restart|status}" >&2
exit 1
;;
esac

exit 0
27 changes: 27 additions & 0 deletions etherpad/install/etherpad-lite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

# Install etherpad-lite
git clone git://github.com/Pita/etherpad-lite.git /usr/share/etherpad-lite
sh /usr/share/etherpad-lite/bin/installDeps.sh

# Configure Etherpad settings
cp settings.json.template /usr/share/etherpad-lite/settings.json
nano /usr/share/etherpad-lite/settings.json

# Create a user called etherpad-lite
useradd -r -d /bin/false etherpad-lite

# Create a log folder for the service /var/log/etherpad-lite
mkdir /var/log/etherpad-lite

# Ensure the etherpad-lite user have full access to the log and the git folder
chown -R etherpad-lite /var/log/etherpad-lite

# Copy following script to /etc/init.d/ and configure the variables
cp ep-daemon /etc/init.d/etherpad-lite

# Make sure the script is marked as executable
chmod +x /etc/init.d/etherpad-lite

# Enable it with
update-rc.d etherpad-lite defaults
24 changes: 24 additions & 0 deletions etherpad/install/node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
##############################################################
#
# Author: Ruslan Khissamov, email: rrkhissamov@gmail.com
#
##############################################################
# Update System
echo 'System Update'
apt-get -y update
echo 'Update completed'
# Install help app
apt-get -y install libssl-dev git-core pkg-config build-essential curl gcc g++
# Download & Unpack Node.js - v. 0.6.2
echo 'Download Node.js - v. 0.6.2'
mkdir /tmp/node-install
cd /tmp/node-install
wget http://nodejs.org/dist/v0.6.2/node-v0.6.2.tar.gz
tar -zxf node-v0.6.2.tar.gz
echo 'Node.js download & unpack completed'
# Install Node.js
echo 'Install Node.js'
cd node-v0.6.2
./configure && make && make install
echo 'Node.js install completed'
Loading

0 comments on commit 5c89c02

Please sign in to comment.