diff --git a/beaglebone.txt b/beaglebone.txt index 4e16953f..b3380aeb 100644 --- a/beaglebone.txt +++ b/beaglebone.txt @@ -5651,6 +5651,184 @@ So, you're now microblogging on the open web, with no companies in the middle. When following other GNU Social users enter the URL of your profile. For example, https://mygnusocialdomain/myusername +** Install Mediagoblin + +For a mediagoblin site it is recommended to use a separate domain/subdomain, so see [[Setting up a web site]] for details of how to create an Apache configuration for your microblog. If you're using freedns then you will need to create a new subdomain. + +Install some dependencies. + +#+BEGIN_SRC: bash +apt-get install git-core python python-dev python-lxml python-imaging python-virtualenv python-gst0.10 libjpeg8-dev sqlite3 libapache2-mod-fcgid +#+END_SRC + +Create a user, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site. + +#+BEGIN_SRC: bash +export HOSTNAME=mymediagoblindomain +adduser mediagoblin +#+END_SRC + +Give the user a long random password. + +#+BEGIN_SRC: bash +mkdir -p /srv/$HOSTNAME +chown -hR mediagoblin:mediagoblin /srv/$HOSTNAME +su - mediagoblin +export HOSTNAME=mymediagoblindomain +cd /srv/$HOSTNAME +git clone git://gitorious.org/mediagoblin/mediagoblin.git +cd mediagoblin +git submodule init +git submodule update +virtualenv --system-site-packages . +./bin/python setup.py develop +./bin/easy_install flup +cp mediagoblin.ini mediagoblin_local.ini +cp paste.ini paste_local.ini +emacs mediagoblin_local.ini +#+END_SRC + +Change *email_sender_address* to your email address and set *email_debug_mode* to false, then save and exit. + +#+BEGIN_SRC: bash +./bin/gmg dbupdate +exit # to go back to the root user +emacs /etc/init.d/mediagoblin +#+END_SRC + +Add the following, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site. + +#+BEGIN_SRC: bash +#!/bin/bash +# /etc/init.d/mediagoblin + +### BEGIN INIT INFO +# Provides: mediagoblin +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts mediagoblin +# Description: Other methods may work, but I found this the easiest +### END INIT INFO + +# Author: Bob Mottram + +#Settings +SERVICE='mediagoblin' +LOGFILE='/srv/mymediagoblindomain/mediagoblin.log' +COMMAND="./lazyserver.sh > $LOGFILE" +USERNAME='mediagoblin' +NICELEVEL=15 # from 0-19 the bigger the number, the less the impact on system resources +HISTORY=1024 +MG_LOCATION="/srv/mymediagoblindomain/mediagoblin" +INVOCATION="nice -n ${NICELEVEL} ${COMMAND}" +PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl:/sbin:/usr/sbin:/bin' + + + +mg_start() { +echo "Starting $SERVICE..." +cd ${MG_LOCATION} +su --command "screen -h ${HISTORY} -dmS ${SERVICE} ${INVOCATION}" $USERNAME +} + + +mg_stop() { +echo "Stopping $SERVICE" +su --command "screen -p 0 -S ${SERVICE} -X stuff "'^C'"" $USERNAME +} + + +#Start-Stop here +case "$1" in + start) + mg_start + ;; + stop) + mg_stop + ;; + restart) + mg_stop + sleep 10s + mg_start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + +exit 0 +#+END_SRC + +Save and exit. + +#+BEGIN_SRC: bash +chmod +x /etc/init.d/mediagoblin +update-rc.d mediagoblin defaults +service mediagoblin start +#+END_SRC + +Edit the Apache configuration for your mediagoblin site. + +#+BEGIN_SRC: bash +emacs /etc/apache2/sites-available/mymediagoblindomain +#+END_SRC + +Delete the existing configuration (in Emacs it's CTRL-x h then CTRL-w) and paste the following, replacing /mymediagoblindomain/ with your mediagoblin domain name and /myusername@mydomainname.com/ with your email address. + +#+BEGIN_SRC: bash + + ServerAdmin myusername@mydomainname.com + + DocumentRoot /srv/mymediagoblindomain/mediagoblin + ServerName mymediagoblindomain + + + Options FollowSymLinks + AllowOverride None + + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + allow from all + + + LogLevel warn + + ProxyVia On + + ProxyRequests off + ProxyPreserveHost on + + ProxyPass / http://localhost:6543/ + + ErrorLog "/var/log/apache2/error_log" + CustomLog "/var/log/apache2/access_log" combined + + RewriteEngine On + RewriteOptions Inherit + +#+END_SRC + +Save and exit. + +Now in a browser visit http://mymediagoblindomain and create a user. If you wish this to be a single user installation to prevent a lot of spammers signing up. + +#+BEGIN_SRC: bash +emacs /srv/mymediagoblindomain/mediagoblin/mediagoblin_local.ini +#+END_SRC + +Then set: + +#+BEGIN_SRC: bash +allow_registration = false +#+END_SRC + +Save and exit. + ** Install Tripwire #+BEGIN_VERSE @@ -6185,444 +6363,6 @@ Under security tab, set "Enable ZRTP/SRTP encryption" TODO CSipSimple? -** Install Mediagoblin - -For a mediagoblin site it is recommended to use a separate domain/subdomain, so see [[Setting up a web site]] for details of how to create an Apache configuration for your microblog. If you're using freedns then you will need to create a new subdomain. - -Install some dependencies. - -#+BEGIN_SRC: bash -apt-get install git-core python python-dev python-lxml python-imaging python-virtualenv python-gst0.10 libjpeg8-dev sqlite3 libapache2-mod-fcgid -#+END_SRC - -Create a user, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site. - -#+BEGIN_SRC: bash -export HOSTNAME=mymediagoblindomain -adduser mediagoblin -#+END_SRC - -Give the user a long random password. - -#+BEGIN_SRC: bash -mkdir -p /srv/$HOSTNAME -chown -hR mediagoblin:mediagoblin /srv/$HOSTNAME -su - mediagoblin -export HOSTNAME=mymediagoblindomain -cd /srv/$HOSTNAME -git clone git://gitorious.org/mediagoblin/mediagoblin.git -cd mediagoblin -git submodule init -git submodule update -virtualenv --system-site-packages . -./bin/python setup.py develop -./bin/easy_install flup -cp mediagoblin.ini mediagoblin_local.ini -cp paste.ini paste_local.ini -emacs mediagoblin_local.ini -#+END_SRC - -Change *email_sender_address* to your email address, then save and exit. - -#+BEGIN_SRC: bash -./bin/gmg dbupdate -exit # to go back to the root user -emacs /etc/init.d/mediagoblin-paster -#+END_SRC - -Add the following, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site. - -#+BEGIN_SRC: bash -#!/bin/sh -# /etc/init.d/mediagoblin-paster -# -## LICENSE: CC0 -# To the extent possible under law, Joar Wandborg has -# waived all copyright and related or neighboring rights to -# mediagoblin-paster. This work is published from Sweden. -# -## CREDIT -# Credit goes to jpope and -# chimo . From which' Arch init scripts this is -# based upon. -# -### BEGIN INIT INFO -# Provides: mediagoblin-paster -# Required-Start: $network $named $local_fs -# Required-Stop: $remote_fs $syslog $network $named $local_fs -# Should-Start: postgresql $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: MediaGoblin paster FCGI server init script -# Description: This script will initiate the GNU MediaGoblin paster -# fcgi server. -### END INIT INFO - -################################################################################ -# CHANGE THIS -# to suit your environment -################################################################################ -MG_ROOT=/srv/mymediagoblindomain/mediagoblin -MG_USER=mediagoblin -MG_GROUP=mediagoblin -################################################################################ -# NOW STOP -# You probably won't have to change anything else. -################################################################################ - -set -e - -DAEMON_NAME=mediagoblin-paster - -MG_BIN=$MG_ROOT/bin -MG_PASTER_BIN=$MG_BIN/paster -MG_PASTE_INI=$MG_ROOT/paste_local.ini -MG_FCGI_HOST=127.0.0.1 -MG_FCGI_PORT=26543 -MG_PASTER_PID_FILE=/var/run/mediagoblin/$DAEMON_NAME.pid -MG_PASTER_LOG_FILE=/var/log/mediagoblin/$DAEMON_NAME.log - -set_up_directories() { - install -o $MG_USER -g $MG_GROUP -d -m 755 /var/log/mediagoblin - install -o $MG_USER -g $MG_GROUP -d -m 755 /var/run/mediagoblin -} - -set_up_directories - -# Include LSB helper functions -. /lib/lsb/init-functions - -getPID () { - # Discard any errors from cat - cat $MG_PASTER_PID_FILE 2>/dev/null -} - -case "$1" in - start) - # Start the MediaGoblin paster process - log_daemon_msg "Starting GNU MediaGoblin paster fcgi server" "$DAEMON_NAME" - if [ ! -f $MG_PASTE_INI ]; then - MG_PASTE_INI=$MG_ROOT/paste.ini - fi - if [ -z "$(getPID)" ]; then - su -s /bin/sh -c "CELERY_ALWAYS_EAGER=False $MG_PASTER_BIN serve \ - $MG_PASTE_INI \ - --server-name=fcgi \ - fcgi_host=$MG_FCGI_HOST fcgi_port=$MG_FCGI_PORT \ - --pid-file=$MG_PASTER_PID_FILE \ - --log-file=$MG_PASTER_LOG_FILE \ - --daemon" - $MG_USER 2>&1 > /dev/null - - PASTER_RESULT=$? - - # Sleep for a while until we're kind of certain that paster has - # had it's time to initialize - TRIES=0 - while ! [ "X$PASTER_RESULT" != "X" ]; do - log_action_msg "Tried $TRIES time(s)" - sleep 0.1 - TRIES=$((TRIES+1)) - done - - log_end_msg $PASTER_RESULT - else - # Failed because the PID file indicates it's running - log_action_msg "PID file $MG_PASTER_BIN already exists" - log_end_msg 1 - fi - ;; - stop) - log_daemon_msg "Stopping GNU MediaGoblin paster fcgi server" "$DAEMON_NAME" - if [ -z "$(getPID)" ]; then - # Failed because the PID file indicates it's not running - RET=1 - else - kill $(getPID) - - if [ $? -gt 0 ]; then - RET=1 - else - RET=0 - fi - fi - log_end_msg $RET - ;; - restart) - $0 stop - $0 start - ;; - status) - if ! [ -z "$(getPID)" ]; then - echo "$DAEMON_NAME start/running, process $(getPID)" - else - echo "$DAEMON_NAME stopped." - fi - ;; - *) - echo "Usage: $0 {restart|start|stop|status}" - exit 1 - ;; -esac - -exit 0 -#+END_SRC - -Save and exit. - -#+BEGIN_SRC: bash -emacs /etc/init.d/mediagoblin-celeryd -#+END_SRC - -Add the following, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site. - -#+BEGIN_SRC: bash -#!/bin/bash -# /etc/init.d/mediagoblin-celeryd -# -## LICENSE: CC0 -# To the extent possible under law, Joar Wandborg has -# waived all copyright and related or neighboring rights to -# mediagoblin-celeryd. This work is published from Sweden. -# -## CREDIT -# Credit goes to jpope and -# chimo . From which' Arch init scripts this is -# based upon. -# -### BEGIN INIT INFO -# Provides: mediagoblin-celeryd -# Required-Start: $network $named $local_fs -# Required-Stop: $remote_fs $syslog $network $named $local_fs -# Should-Start: postgres $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: MediaGoblin Celery task processor init script -# Description: This script will initiate the GNU MediaGoblin Celery -# task processor -### END INIT INFO - -################################################################################ -# CHANGE THIS -# to suit your environment -################################################################################ -MG_ROOT=/srv/mymediagoblindomain/mediagoblin -MG_USER=mediagoblin -MG_GROUP=mediagoblin -################################################################################ -# NOW STOP -# You probably won't have to change anything else. -################################################################################ - -set -e - -DAEMON_NAME=mediagoblin-celeryd - -MG_BIN=$MG_ROOT/bin -MG_CELERYD_BIN=$MG_BIN/celeryd -MG_CONFIG=$MG_ROOT/mediagoblin_local.ini -MG_CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_celery -MG_CELERYD_PID_FILE=/var/run/mediagoblin/$DAEMON_NAME.pid -MG_CELERYD_LOG_FILE=/var/log/mediagoblin/$DAEMON_NAME.log - -set_up_directories() { - install -o $MG_USER -g $MG_GROUP -d -m 755 /var/log/mediagoblin - install -o $MG_USER -g $MG_GROUP -d -m 755 /var/run/mediagoblin -} - -set_up_directories - -# Include LSB helper functions -. /lib/lsb/init-functions - -wait_for_death() { - pid=$1 - seconds=1 - - if [ -z "$2" ]; then - kill_at=20 - else - kill_at=$2 - fi - - if [ -z "$pid" ]; then - log_action_msg "Could not get PID. Aborting" - log_end_msg 1 - exit 1 - fi - - while ps ax | grep -v grep | grep $pid > /dev/null; do - sleep 1 - seconds=$(expr $seconds + 1) - if [ $seconds -ge $kill_at ]; then - log_action_msg "Failed to shut down after $kill_at seconds. Aborting" - log_end_msg 1 - exit 1 - fi - done - log_end_msg 0 -} - -wait_for_pidfile() { - pidfile=$1 - kill_at=20 - seconds=1 - - while ! [[ -f $pidfile ]]; do - sleep 1 - seconds=$(expr $seconds + 1) - - if [ $seconds -ge $kill_at ]; then - log_action_msg "Can't find the PID file," \ - " the application must have crashed." - log_end_msg 1 - exit 1 - fi - done -} - -getPID() { - # Discard any errors from cat - cat $MG_CELERYD_PID_FILE 2>/dev/null -} - -case "$1" in - start) - # Start the MediaGoblin celeryd process - log_daemon_msg "Starting GNU MediaGoblin Celery task queue" "$DAEMON_NAME" - if [ -z "$(getPID)" ]; then - # TODO: Could we send things to log a little bit more beautiful? - su -s /bin/sh -c "cd $MG_ROOT && \ - MEDIAGOBLIN_CONFIG=$MG_CONFIG \ - CELERY_CONFIG_MODULE=$MG_CELERY_CONFIG_MODULE \ - $MG_CELERYD_BIN \ - --pidfile=$MG_CELERYD_PID_FILE \ - -f $MG_CELERYD_LOG_FILE 2>&1 >> $MG_CELERYD_PID_FILE" \ - - $MG_USER 2>&1 >> $MG_CELERYD_LOG_FILE & - - CELERYD_RESULT=$? - - wait_for_pidfile $MG_CELERYD_PID_FILE - - log_end_msg $CELERYD_RESULT - else - # Failed because the PID file indicates it's running - log_action_msg "PID file $MG_CELERYD_PID_FILE already exists" - log_end_msg 1 - fi - ;; - stop) - log_daemon_msg "Stopping GNU MediaGoblin Celery task queue" "$DAEMON_NAME" - if [ -z "$(getPID)" ]; then - # Failed because the PID file indicates it's not running - log_action_msg "Could not get PID" - log_end_msg 1 - exit 1 - else - kill $(getPID) - - wait_for_death $(getPID) - fi - ;; - restart) - $0 stop - $0 start - ;; - status) - if ! [ -z "$(getPID)" ]; then - echo "$DAEMON_NAME start/running, process $(getPID)" - else - echo "$DAEMON_NAME stopped." - fi - ;; - *) - echo "Usage: $0 {restart|start|stop|status}" - exit 1 - ;; -esac - -exit 0 -#+END_SRC - -Save and exit. - -#+BEGIN_SRC: bash -chmod +x /etc/init.d/mediagoblin-paster -chmod +x /etc/init.d/mediagoblin-celeryd -update-rc.d mediagoblin-paster defaults -update-rc.d mediagoblin-celeryd defaults -service mediagoblin-paster start -service mediagoblin-celeryd start -#+END_SRC - -Create a script as follows: - -#+BEGIN_SRC: bash -emacs /srv/mymediagoblindomain/mediagoblin/mg.fcgi -#+END_SRC - -Add the following, replacing /mymediagoblindomain/ with your mediagoblin domain name. - -#+BEGIN_SRC: bash -#!/srv/mymediagoblindomain/mediagoblin/bin/python - -# Written in 2011 by Christopher Allan Webber -# -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any -# warranty. -# -# You should have received a copy of the CC0 Public Domain Dedication along -# with this software. If not, see -# . - -from paste.deploy import loadapp -from flup.server.fcgi import WSGIServer - -CONFIG_PATH = '/srv/mymediagoblindomain/mediagoblin/paste_local.ini' - -## Uncomment this to run celery in "always eager" mode... ie, you don't have -## to run a separate process, but submissions wait till processing finishes -# import os -# os.environ['CELERY_ALWAYS_EAGER'] = 'true' - -def launch_fcgi(): - ccengine_wsgi_app = loadapp('config:' + CONFIG_PATH) - WSGIServer(ccengine_wsgi_app).run() - - -if __name__ == '__main__': - launch_fcgi() -#+END_SRC - -Save and exit, then edit the Apache configuration for your mediagoblin site. - -#+BEGIN_SRC: bash -chown -hR mediagoblin:mediagoblin /srv/$HOSTNAME -emacs /etc/apache2/sites-available/mymediagoblindomain -#+END_SRC - -Add the following to the section which begins with **, and remove the existing ScriptAlias sections. - -#+BEGIN_SRC: bash - Options +ExecCGI - - # Accept up to 16MB requests - FcgidMaxRequestLen 16777216 - - Alias /mgoblin_static/ /srv/mymediagoblindomain/mediagoblin/mediagoblin/static/ - Alias /mgoblin_media/ /srv/mymediagoblindomain/mediagoblin/user_dev/media/public/ - - ScriptAlias / /srv/mymediagoblindomain/mediagoblin/mg.fcgi/ -#+END_SRC - -Save and exit. - -http://mediagoblin.readthedocs.org/en/latest/siteadmin/deploying.html -https://wiki.mediagoblin.org/HackingHowto -https://github.com/joar/mediagoblin-init-scripts -https://wiki.mediagoblin.org/Deployment#Apache_2_Config_With_mod_wsgi - ** Kune Kune is a collaboration tool aimed at not just socialising but also getting stuff done within a community. It's based upon Apache Wave (formerly Google Wave).