BACKLINK: http://pad.constantvzw.org/p/2016-05-12-wtc-etherspace Goal: create an image for a stable etherpad/dump rpi setup for Constant/Events. Installation (building from scratch) ============================= Starting point ---------------------- Working with pi image debian_version=7.8 (wheezy) Did the usual: apt-get update apt-get upgrade For my particular LCD Rotation for Raspberry Pi Touch screen # /boot/config.txt lcd_rotate=2 Set hostname ---------------------------------- # /etc/hostname etherbox #/etc/hosts ... 127.0.1.1 etherbox Installing node ------------------------------ Node for arm-pi, Last version built is 0.10.28? https://nodejs.org/dist/v0.10.28/ Version of node in apt (nodejs) seems quite out of date (v 0.6.19) SO to install, following the wonderfully compact instructions given here (https://github.com/tvl83/RaspPaycoin): *wget https://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-arm-pi.tar.gz *cd /usr/local && sudo tar --strip-components 1 -xzf ~/node-v0.10.28-linux-arm-pi.tar.gz Installing etherpad ----------------------------- * *wget http://github.com/ether/etherpad-lite/zipball/master *sudo mv /opt/etherpad *sudo chown -R pi:pi /opt/etherpad and get it working (as pi user): * *cd /opt/etherpad *bin/installDeps.sh *bin/run.sh Install etherpad as a service ---------------------------------------- Following https://github.com/ether/etherpad-lite/wiki/How-to-deploy-Etherpad-Lite-as-a-service *adduser --system --home=/opt/etherpad --group etherpad *sudo chown -R etherpad /opt/etherpad Setup a log folder for the service *sudo mkdir /var/log/etherpad *chown -R etherpad /var/log/etherpad * Ensure app has full access to its source folder: *chown -R etherpad-lite /path/to/install/dir * Make the init script executable: *chmod +x /etc/init.d/etherpad Enable it with: *sudo update-rc.d etherpad defaults /etc/init.d/etherpad ================================== #!/bin/sh ### BEGIN INIT INFO # Provides: etherpad # 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 # Description: starts etherpad 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/etherpad.log" EPLITE_DIR="/opt/etherpad" EPLITE_BIN="bin/safeRun.sh" USER="etherpad" GROUP="etherpad" DESC="Etherpad" NAME="etherpad" 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... " if test -f /var/run/$NAME.pid; then 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 fi echo "done" } status() { status_of_proc -p /var/run/$NAME.pid "" "etherpad" && 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 ================================== systemd (not used) --------------------------- sudo nano /etc/systemd/system/etherpad.service [Unit] Description=etherpad (real-time collaborative document editing) After=syslog.target network.target [Service] Type=simple User=etherpad Group=etherpad ExecStart=/opt/etherpad/bin/run.sh [Install] WantedBy=multi-user.target THEN *sysctl enable etherpad * to enable the service on boot. * *sysctl start etherpad Shrinking the image to make a snapshot ---------------------------------------------------------- resize2fs? Apache ------------- *sudo apt-get install apache2 Moving the webserver to use a USB stick --------------------------------------------------------- It's handy that files are stored/served from removable USB sticks. https://wiki.debian.org/usbmount sudo apt-get install usbmount ( main script is at: /usr/share/usbmount/usbmount ) Edit the conf file to not use sync (slower), and add webserver as owner/group of mounted devices. # /etc/usbmount/usbmount.conf #MOUNTOPTIONS="sync,noexec,nodev,noatime,nodiratime" MOUNTOPTIONS="noexec,nodev,noatime,nodiratime" # ... FS_MOUNTOPTIONS="uid=www-data,gid=www-data" MAKE THE PI'S ROOT THE DOCUMENT ROOT! Change /var/www to / in "default" # /etc/apache2/sites-available/default DocumentRoot / Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all Still TO DO * create etherbox project (to contain the various scripts) ??!! * drag and drop file upload... tweak existing script * editable descriptions ?!... tweak existing script... * FRAMING LINK(s) TO PAD * etherdump * customize usbmount to use label (this would just be very cool, PLUS give the possibility to stabilize the mount point / link) * unmount button... * Make a nice .htacess / descriptions for root incorporating this blog post ?! https://peter.upfold.org.uk/blog/2006/07/18/a-guide-to-files-and-folders-on-linux/ * OR.... HOW COULD .htaccess files be synced to PAD content ?!?!? * if in fact EVERY file could be opened in etherpad... AHA ether BOX becomes a reality... (BUT.... this is maybe more meta than the etherbox needs to be ?!) Speaking of meta... If the instructions to setup the box are on the box itself, it can also link directly to (pads) of changed files themselves... with changes SHOWN using etherpad :!!! NEED to test limits of slashes in URLs for etherpad. IDEALLY... this could work to reveal only as much / little of the system as a given usage requires (more locked down -- just a specific USB stick, or even FOLDER)... MORE OPEN... the entire system from root downward. HOW COULD VIEW IN ETHERPAD be implemented as an etherpad plugin (ie when the page is missing... PULL from actual file contents) https://github.com/ether/etherpad-lite/wiki/Creating-a-plugin the hooks: http://etherpad.org/doc/v1.5.7/#index_hooks padCreate http://etherpad.org/doc/v1.5.7/#index_padcreate padCreate, Load, Update padInitToolbar post lunch sprint... Install etherdump ---------------------------- git clone https://gitlab.com/activearchives/etherdump.git sudo apt-get install python-pip sudo pip install python-dateutil html5lib jinja2 cd etherdump sudo python setup.py install directory listing ------------------------ http://howto.unixdev.net/dirlist.html wed 2 mar 2016 * changed docroot to /media/usb (single stick simplicity!) * etherpad via proxy (port 80!) * index css + javascript (versions) * etherdump button just for /etherdump folder * etherdump index build * Install / test / improve droptodownload.cgi * Install / text editable descriptions * file clicker to show in iframe (if not directory) *snapshots (dump files + image) Creating a proxy for etherpad (serving from port 80) Add to end of /etc/apache2/sites-available/default * * # ETHERPAD PROXY * Redirect /pad /pad/ * LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so * LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so * LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so * LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so * ProxyVia On * ProxyRequests Off * ProxyPass /pad/ http://localhost:9001/ * ProxyPassReverse /pad/ http://localhost:9001/ * ProxyPreserveHost on * * Options FollowSymLinks MultiViews * AllowOverride All * Order allow,deny * allow from all *