|
@@ -5651,6 +5651,184 @@ So, you're now microblogging on the open web, with no companies in the middle.
|
5651
|
5651
|
|
5652
|
5652
|
When following other GNU Social users enter the URL of your profile. For example, https://mygnusocialdomain/myusername
|
5653
|
5653
|
|
|
5654
|
+** Install Mediagoblin
|
|
5655
|
+
|
|
5656
|
+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.
|
|
5657
|
+
|
|
5658
|
+Install some dependencies.
|
|
5659
|
+
|
|
5660
|
+#+BEGIN_SRC: bash
|
|
5661
|
+apt-get install git-core python python-dev python-lxml python-imaging python-virtualenv python-gst0.10 libjpeg8-dev sqlite3 libapache2-mod-fcgid
|
|
5662
|
+#+END_SRC
|
|
5663
|
+
|
|
5664
|
+Create a user, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site.
|
|
5665
|
+
|
|
5666
|
+#+BEGIN_SRC: bash
|
|
5667
|
+export HOSTNAME=mymediagoblindomain
|
|
5668
|
+adduser mediagoblin
|
|
5669
|
+#+END_SRC
|
|
5670
|
+
|
|
5671
|
+Give the user a long random password.
|
|
5672
|
+
|
|
5673
|
+#+BEGIN_SRC: bash
|
|
5674
|
+mkdir -p /srv/$HOSTNAME
|
|
5675
|
+chown -hR mediagoblin:mediagoblin /srv/$HOSTNAME
|
|
5676
|
+su - mediagoblin
|
|
5677
|
+export HOSTNAME=mymediagoblindomain
|
|
5678
|
+cd /srv/$HOSTNAME
|
|
5679
|
+git clone git://gitorious.org/mediagoblin/mediagoblin.git
|
|
5680
|
+cd mediagoblin
|
|
5681
|
+git submodule init
|
|
5682
|
+git submodule update
|
|
5683
|
+virtualenv --system-site-packages .
|
|
5684
|
+./bin/python setup.py develop
|
|
5685
|
+./bin/easy_install flup
|
|
5686
|
+cp mediagoblin.ini mediagoblin_local.ini
|
|
5687
|
+cp paste.ini paste_local.ini
|
|
5688
|
+emacs mediagoblin_local.ini
|
|
5689
|
+#+END_SRC
|
|
5690
|
+
|
|
5691
|
+Change *email_sender_address* to your email address and set *email_debug_mode* to false, then save and exit.
|
|
5692
|
+
|
|
5693
|
+#+BEGIN_SRC: bash
|
|
5694
|
+./bin/gmg dbupdate
|
|
5695
|
+exit # to go back to the root user
|
|
5696
|
+emacs /etc/init.d/mediagoblin
|
|
5697
|
+#+END_SRC
|
|
5698
|
+
|
|
5699
|
+Add the following, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site.
|
|
5700
|
+
|
|
5701
|
+#+BEGIN_SRC: bash
|
|
5702
|
+#!/bin/bash
|
|
5703
|
+# /etc/init.d/mediagoblin
|
|
5704
|
+
|
|
5705
|
+### BEGIN INIT INFO
|
|
5706
|
+# Provides: mediagoblin
|
|
5707
|
+# Required-Start: $remote_fs $syslog
|
|
5708
|
+# Required-Stop: $remote_fs $syslog
|
|
5709
|
+# Default-Start: 2 3 4 5
|
|
5710
|
+# Default-Stop: 0 1 6
|
|
5711
|
+# Short-Description: starts mediagoblin
|
|
5712
|
+# Description: Other methods may work, but I found this the easiest
|
|
5713
|
+### END INIT INFO
|
|
5714
|
+
|
|
5715
|
+# Author: Bob Mottram <bob@robotics.uk.to>
|
|
5716
|
+
|
|
5717
|
+#Settings
|
|
5718
|
+SERVICE='mediagoblin'
|
|
5719
|
+LOGFILE='/srv/mymediagoblindomain/mediagoblin.log'
|
|
5720
|
+COMMAND="./lazyserver.sh > $LOGFILE"
|
|
5721
|
+USERNAME='mediagoblin'
|
|
5722
|
+NICELEVEL=15 # from 0-19 the bigger the number, the less the impact on system resources
|
|
5723
|
+HISTORY=1024
|
|
5724
|
+MG_LOCATION="/srv/mymediagoblindomain/mediagoblin"
|
|
5725
|
+INVOCATION="nice -n ${NICELEVEL} ${COMMAND}"
|
|
5726
|
+PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl:/sbin:/usr/sbin:/bin'
|
|
5727
|
+
|
|
5728
|
+
|
|
5729
|
+
|
|
5730
|
+mg_start() {
|
|
5731
|
+echo "Starting $SERVICE..."
|
|
5732
|
+cd ${MG_LOCATION}
|
|
5733
|
+su --command "screen -h ${HISTORY} -dmS ${SERVICE} ${INVOCATION}" $USERNAME
|
|
5734
|
+}
|
|
5735
|
+
|
|
5736
|
+
|
|
5737
|
+mg_stop() {
|
|
5738
|
+echo "Stopping $SERVICE"
|
|
5739
|
+su --command "screen -p 0 -S ${SERVICE} -X stuff "'^C'"" $USERNAME
|
|
5740
|
+}
|
|
5741
|
+
|
|
5742
|
+
|
|
5743
|
+#Start-Stop here
|
|
5744
|
+case "$1" in
|
|
5745
|
+ start)
|
|
5746
|
+ mg_start
|
|
5747
|
+ ;;
|
|
5748
|
+ stop)
|
|
5749
|
+ mg_stop
|
|
5750
|
+ ;;
|
|
5751
|
+ restart)
|
|
5752
|
+ mg_stop
|
|
5753
|
+ sleep 10s
|
|
5754
|
+ mg_start
|
|
5755
|
+ ;;
|
|
5756
|
+ *)
|
|
5757
|
+ echo "Usage: $0 {start|stop|restart}"
|
|
5758
|
+ exit 1
|
|
5759
|
+ ;;
|
|
5760
|
+esac
|
|
5761
|
+
|
|
5762
|
+exit 0
|
|
5763
|
+#+END_SRC
|
|
5764
|
+
|
|
5765
|
+Save and exit.
|
|
5766
|
+
|
|
5767
|
+#+BEGIN_SRC: bash
|
|
5768
|
+chmod +x /etc/init.d/mediagoblin
|
|
5769
|
+update-rc.d mediagoblin defaults
|
|
5770
|
+service mediagoblin start
|
|
5771
|
+#+END_SRC
|
|
5772
|
+
|
|
5773
|
+Edit the Apache configuration for your mediagoblin site.
|
|
5774
|
+
|
|
5775
|
+#+BEGIN_SRC: bash
|
|
5776
|
+emacs /etc/apache2/sites-available/mymediagoblindomain
|
|
5777
|
+#+END_SRC
|
|
5778
|
+
|
|
5779
|
+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.
|
|
5780
|
+
|
|
5781
|
+#+BEGIN_SRC: bash
|
|
5782
|
+<VirtualHost *:80>
|
|
5783
|
+ ServerAdmin myusername@mydomainname.com
|
|
5784
|
+
|
|
5785
|
+ DocumentRoot /srv/mymediagoblindomain/mediagoblin
|
|
5786
|
+ ServerName mymediagoblindomain
|
|
5787
|
+
|
|
5788
|
+ <Directory />
|
|
5789
|
+ Options FollowSymLinks
|
|
5790
|
+ AllowOverride None
|
|
5791
|
+ </Directory>
|
|
5792
|
+ <Directory /srv/mymediagoblindomain/mediagoblin/>
|
|
5793
|
+ Options Indexes FollowSymLinks MultiViews
|
|
5794
|
+ AllowOverride All
|
|
5795
|
+ Order allow,deny
|
|
5796
|
+ allow from all
|
|
5797
|
+ </Directory>
|
|
5798
|
+
|
|
5799
|
+ LogLevel warn
|
|
5800
|
+
|
|
5801
|
+ ProxyVia On
|
|
5802
|
+
|
|
5803
|
+ ProxyRequests off
|
|
5804
|
+ ProxyPreserveHost on
|
|
5805
|
+
|
|
5806
|
+ ProxyPass / http://localhost:6543/
|
|
5807
|
+
|
|
5808
|
+ ErrorLog "/var/log/apache2/error_log"
|
|
5809
|
+ CustomLog "/var/log/apache2/access_log" combined
|
|
5810
|
+
|
|
5811
|
+ RewriteEngine On
|
|
5812
|
+ RewriteOptions Inherit
|
|
5813
|
+</VirtualHost>
|
|
5814
|
+#+END_SRC
|
|
5815
|
+
|
|
5816
|
+Save and exit.
|
|
5817
|
+
|
|
5818
|
+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.
|
|
5819
|
+
|
|
5820
|
+#+BEGIN_SRC: bash
|
|
5821
|
+emacs /srv/mymediagoblindomain/mediagoblin/mediagoblin_local.ini
|
|
5822
|
+#+END_SRC
|
|
5823
|
+
|
|
5824
|
+Then set:
|
|
5825
|
+
|
|
5826
|
+#+BEGIN_SRC: bash
|
|
5827
|
+allow_registration = false
|
|
5828
|
+#+END_SRC
|
|
5829
|
+
|
|
5830
|
+Save and exit.
|
|
5831
|
+
|
5654
|
5832
|
** Install Tripwire
|
5655
|
5833
|
|
5656
|
5834
|
#+BEGIN_VERSE
|
|
@@ -6185,444 +6363,6 @@ Under security tab, set "Enable ZRTP/SRTP encryption"
|
6185
|
6363
|
TODO
|
6186
|
6364
|
|
6187
|
6365
|
CSipSimple?
|
6188
|
|
-** Install Mediagoblin
|
6189
|
|
-
|
6190
|
|
-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.
|
6191
|
|
-
|
6192
|
|
-Install some dependencies.
|
6193
|
|
-
|
6194
|
|
-#+BEGIN_SRC: bash
|
6195
|
|
-apt-get install git-core python python-dev python-lxml python-imaging python-virtualenv python-gst0.10 libjpeg8-dev sqlite3 libapache2-mod-fcgid
|
6196
|
|
-#+END_SRC
|
6197
|
|
-
|
6198
|
|
-Create a user, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site.
|
6199
|
|
-
|
6200
|
|
-#+BEGIN_SRC: bash
|
6201
|
|
-export HOSTNAME=mymediagoblindomain
|
6202
|
|
-adduser mediagoblin
|
6203
|
|
-#+END_SRC
|
6204
|
|
-
|
6205
|
|
-Give the user a long random password.
|
6206
|
|
-
|
6207
|
|
-#+BEGIN_SRC: bash
|
6208
|
|
-mkdir -p /srv/$HOSTNAME
|
6209
|
|
-chown -hR mediagoblin:mediagoblin /srv/$HOSTNAME
|
6210
|
|
-su - mediagoblin
|
6211
|
|
-export HOSTNAME=mymediagoblindomain
|
6212
|
|
-cd /srv/$HOSTNAME
|
6213
|
|
-git clone git://gitorious.org/mediagoblin/mediagoblin.git
|
6214
|
|
-cd mediagoblin
|
6215
|
|
-git submodule init
|
6216
|
|
-git submodule update
|
6217
|
|
-virtualenv --system-site-packages .
|
6218
|
|
-./bin/python setup.py develop
|
6219
|
|
-./bin/easy_install flup
|
6220
|
|
-cp mediagoblin.ini mediagoblin_local.ini
|
6221
|
|
-cp paste.ini paste_local.ini
|
6222
|
|
-emacs mediagoblin_local.ini
|
6223
|
|
-#+END_SRC
|
6224
|
|
-
|
6225
|
|
-Change *email_sender_address* to your email address, then save and exit.
|
6226
|
|
-
|
6227
|
|
-#+BEGIN_SRC: bash
|
6228
|
|
-./bin/gmg dbupdate
|
6229
|
|
-exit # to go back to the root user
|
6230
|
|
-emacs /etc/init.d/mediagoblin-paster
|
6231
|
|
-#+END_SRC
|
6232
|
|
-
|
6233
|
|
-Add the following, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site.
|
6234
|
|
-
|
6235
|
|
-#+BEGIN_SRC: bash
|
6236
|
|
-#!/bin/sh
|
6237
|
|
-# /etc/init.d/mediagoblin-paster
|
6238
|
|
-#
|
6239
|
|
-## LICENSE: CC0 <http://creativecommons.org/publicdomain/zero/1.0/>
|
6240
|
|
-# To the extent possible under law, Joar Wandborg <http://wandborg.se> has
|
6241
|
|
-# waived all copyright and related or neighboring rights to
|
6242
|
|
-# mediagoblin-paster. This work is published from Sweden.
|
6243
|
|
-#
|
6244
|
|
-## CREDIT
|
6245
|
|
-# Credit goes to jpope <http://jpope.org/> and
|
6246
|
|
-# chimo <http://chimo.chromic.org/>. From which' Arch init scripts this is
|
6247
|
|
-# based upon.
|
6248
|
|
-#
|
6249
|
|
-### BEGIN INIT INFO
|
6250
|
|
-# Provides: mediagoblin-paster
|
6251
|
|
-# Required-Start: $network $named $local_fs
|
6252
|
|
-# Required-Stop: $remote_fs $syslog $network $named $local_fs
|
6253
|
|
-# Should-Start: postgresql $syslog
|
6254
|
|
-# Default-Start: 2 3 4 5
|
6255
|
|
-# Default-Stop: 0 1 6
|
6256
|
|
-# Short-Description: MediaGoblin paster FCGI server init script
|
6257
|
|
-# Description: This script will initiate the GNU MediaGoblin paster
|
6258
|
|
-# fcgi server.
|
6259
|
|
-### END INIT INFO
|
6260
|
|
-
|
6261
|
|
-################################################################################
|
6262
|
|
-# CHANGE THIS
|
6263
|
|
-# to suit your environment
|
6264
|
|
-################################################################################
|
6265
|
|
-MG_ROOT=/srv/mymediagoblindomain/mediagoblin
|
6266
|
|
-MG_USER=mediagoblin
|
6267
|
|
-MG_GROUP=mediagoblin
|
6268
|
|
-################################################################################
|
6269
|
|
-# NOW STOP
|
6270
|
|
-# You probably won't have to change anything else.
|
6271
|
|
-################################################################################
|
6272
|
|
-
|
6273
|
|
-set -e
|
6274
|
|
-
|
6275
|
|
-DAEMON_NAME=mediagoblin-paster
|
6276
|
|
-
|
6277
|
|
-MG_BIN=$MG_ROOT/bin
|
6278
|
|
-MG_PASTER_BIN=$MG_BIN/paster
|
6279
|
|
-MG_PASTE_INI=$MG_ROOT/paste_local.ini
|
6280
|
|
-MG_FCGI_HOST=127.0.0.1
|
6281
|
|
-MG_FCGI_PORT=26543
|
6282
|
|
-MG_PASTER_PID_FILE=/var/run/mediagoblin/$DAEMON_NAME.pid
|
6283
|
|
-MG_PASTER_LOG_FILE=/var/log/mediagoblin/$DAEMON_NAME.log
|
6284
|
|
-
|
6285
|
|
-set_up_directories() {
|
6286
|
|
- install -o $MG_USER -g $MG_GROUP -d -m 755 /var/log/mediagoblin
|
6287
|
|
- install -o $MG_USER -g $MG_GROUP -d -m 755 /var/run/mediagoblin
|
6288
|
|
-}
|
6289
|
|
-
|
6290
|
|
-set_up_directories
|
6291
|
|
-
|
6292
|
|
-# Include LSB helper functions
|
6293
|
|
-. /lib/lsb/init-functions
|
6294
|
|
-
|
6295
|
|
-getPID () {
|
6296
|
|
- # Discard any errors from cat
|
6297
|
|
- cat $MG_PASTER_PID_FILE 2>/dev/null
|
6298
|
|
-}
|
6299
|
|
-
|
6300
|
|
-case "$1" in
|
6301
|
|
- start)
|
6302
|
|
- # Start the MediaGoblin paster process
|
6303
|
|
- log_daemon_msg "Starting GNU MediaGoblin paster fcgi server" "$DAEMON_NAME"
|
6304
|
|
- if [ ! -f $MG_PASTE_INI ]; then
|
6305
|
|
- MG_PASTE_INI=$MG_ROOT/paste.ini
|
6306
|
|
- fi
|
6307
|
|
- if [ -z "$(getPID)" ]; then
|
6308
|
|
- su -s /bin/sh -c "CELERY_ALWAYS_EAGER=False $MG_PASTER_BIN serve \
|
6309
|
|
- $MG_PASTE_INI \
|
6310
|
|
- --server-name=fcgi \
|
6311
|
|
- fcgi_host=$MG_FCGI_HOST fcgi_port=$MG_FCGI_PORT \
|
6312
|
|
- --pid-file=$MG_PASTER_PID_FILE \
|
6313
|
|
- --log-file=$MG_PASTER_LOG_FILE \
|
6314
|
|
- --daemon" - $MG_USER 2>&1 > /dev/null
|
6315
|
|
-
|
6316
|
|
- PASTER_RESULT=$?
|
6317
|
|
-
|
6318
|
|
- # Sleep for a while until we're kind of certain that paster has
|
6319
|
|
- # had it's time to initialize
|
6320
|
|
- TRIES=0
|
6321
|
|
- while ! [ "X$PASTER_RESULT" != "X" ]; do
|
6322
|
|
- log_action_msg "Tried $TRIES time(s)"
|
6323
|
|
- sleep 0.1
|
6324
|
|
- TRIES=$((TRIES+1))
|
6325
|
|
- done
|
6326
|
|
-
|
6327
|
|
- log_end_msg $PASTER_RESULT
|
6328
|
|
- else
|
6329
|
|
- # Failed because the PID file indicates it's running
|
6330
|
|
- log_action_msg "PID file $MG_PASTER_BIN already exists"
|
6331
|
|
- log_end_msg 1
|
6332
|
|
- fi
|
6333
|
|
- ;;
|
6334
|
|
- stop)
|
6335
|
|
- log_daemon_msg "Stopping GNU MediaGoblin paster fcgi server" "$DAEMON_NAME"
|
6336
|
|
- if [ -z "$(getPID)" ]; then
|
6337
|
|
- # Failed because the PID file indicates it's not running
|
6338
|
|
- RET=1
|
6339
|
|
- else
|
6340
|
|
- kill $(getPID)
|
6341
|
|
-
|
6342
|
|
- if [ $? -gt 0 ]; then
|
6343
|
|
- RET=1
|
6344
|
|
- else
|
6345
|
|
- RET=0
|
6346
|
|
- fi
|
6347
|
|
- fi
|
6348
|
|
- log_end_msg $RET
|
6349
|
|
- ;;
|
6350
|
|
- restart)
|
6351
|
|
- $0 stop
|
6352
|
|
- $0 start
|
6353
|
|
- ;;
|
6354
|
|
- status)
|
6355
|
|
- if ! [ -z "$(getPID)" ]; then
|
6356
|
|
- echo "$DAEMON_NAME start/running, process $(getPID)"
|
6357
|
|
- else
|
6358
|
|
- echo "$DAEMON_NAME stopped."
|
6359
|
|
- fi
|
6360
|
|
- ;;
|
6361
|
|
- *)
|
6362
|
|
- echo "Usage: $0 {restart|start|stop|status}"
|
6363
|
|
- exit 1
|
6364
|
|
- ;;
|
6365
|
|
-esac
|
6366
|
|
-
|
6367
|
|
-exit 0
|
6368
|
|
-#+END_SRC
|
6369
|
|
-
|
6370
|
|
-Save and exit.
|
6371
|
|
-
|
6372
|
|
-#+BEGIN_SRC: bash
|
6373
|
|
-emacs /etc/init.d/mediagoblin-celeryd
|
6374
|
|
-#+END_SRC
|
6375
|
|
-
|
6376
|
|
-Add the following, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site.
|
6377
|
|
-
|
6378
|
|
-#+BEGIN_SRC: bash
|
6379
|
|
-#!/bin/bash
|
6380
|
|
-# /etc/init.d/mediagoblin-celeryd
|
6381
|
|
-#
|
6382
|
|
-## LICENSE: CC0 <http://creativecommons.org/publicdomain/zero/1.0/>
|
6383
|
|
-# To the extent possible under law, Joar Wandborg <http://wandborg.se> has
|
6384
|
|
-# waived all copyright and related or neighboring rights to
|
6385
|
|
-# mediagoblin-celeryd. This work is published from Sweden.
|
6386
|
|
-#
|
6387
|
|
-## CREDIT
|
6388
|
|
-# Credit goes to jpope <http://jpope.org/> and
|
6389
|
|
-# chimo <http://chimo.chromic.org/>. From which' Arch init scripts this is
|
6390
|
|
-# based upon.
|
6391
|
|
-#
|
6392
|
|
-### BEGIN INIT INFO
|
6393
|
|
-# Provides: mediagoblin-celeryd
|
6394
|
|
-# Required-Start: $network $named $local_fs
|
6395
|
|
-# Required-Stop: $remote_fs $syslog $network $named $local_fs
|
6396
|
|
-# Should-Start: postgres $syslog
|
6397
|
|
-# Default-Start: 2 3 4 5
|
6398
|
|
-# Default-Stop: 0 1 6
|
6399
|
|
-# Short-Description: MediaGoblin Celery task processor init script
|
6400
|
|
-# Description: This script will initiate the GNU MediaGoblin Celery
|
6401
|
|
-# task processor
|
6402
|
|
-### END INIT INFO
|
6403
|
|
-
|
6404
|
|
-################################################################################
|
6405
|
|
-# CHANGE THIS
|
6406
|
|
-# to suit your environment
|
6407
|
|
-################################################################################
|
6408
|
|
-MG_ROOT=/srv/mymediagoblindomain/mediagoblin
|
6409
|
|
-MG_USER=mediagoblin
|
6410
|
|
-MG_GROUP=mediagoblin
|
6411
|
|
-################################################################################
|
6412
|
|
-# NOW STOP
|
6413
|
|
-# You probably won't have to change anything else.
|
6414
|
|
-################################################################################
|
6415
|
|
-
|
6416
|
|
-set -e
|
6417
|
|
-
|
6418
|
|
-DAEMON_NAME=mediagoblin-celeryd
|
6419
|
|
-
|
6420
|
|
-MG_BIN=$MG_ROOT/bin
|
6421
|
|
-MG_CELERYD_BIN=$MG_BIN/celeryd
|
6422
|
|
-MG_CONFIG=$MG_ROOT/mediagoblin_local.ini
|
6423
|
|
-MG_CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_celery
|
6424
|
|
-MG_CELERYD_PID_FILE=/var/run/mediagoblin/$DAEMON_NAME.pid
|
6425
|
|
-MG_CELERYD_LOG_FILE=/var/log/mediagoblin/$DAEMON_NAME.log
|
6426
|
|
-
|
6427
|
|
-set_up_directories() {
|
6428
|
|
- install -o $MG_USER -g $MG_GROUP -d -m 755 /var/log/mediagoblin
|
6429
|
|
- install -o $MG_USER -g $MG_GROUP -d -m 755 /var/run/mediagoblin
|
6430
|
|
-}
|
6431
|
|
-
|
6432
|
|
-set_up_directories
|
6433
|
|
-
|
6434
|
|
-# Include LSB helper functions
|
6435
|
|
-. /lib/lsb/init-functions
|
6436
|
|
-
|
6437
|
|
-wait_for_death() {
|
6438
|
|
- pid=$1
|
6439
|
|
- seconds=1
|
6440
|
|
-
|
6441
|
|
- if [ -z "$2" ]; then
|
6442
|
|
- kill_at=20
|
6443
|
|
- else
|
6444
|
|
- kill_at=$2
|
6445
|
|
- fi
|
6446
|
|
-
|
6447
|
|
- if [ -z "$pid" ]; then
|
6448
|
|
- log_action_msg "Could not get PID. Aborting"
|
6449
|
|
- log_end_msg 1
|
6450
|
|
- exit 1
|
6451
|
|
- fi
|
6452
|
|
-
|
6453
|
|
- while ps ax | grep -v grep | grep $pid > /dev/null; do
|
6454
|
|
- sleep 1
|
6455
|
|
- seconds=$(expr $seconds + 1)
|
6456
|
|
- if [ $seconds -ge $kill_at ]; then
|
6457
|
|
- log_action_msg "Failed to shut down after $kill_at seconds. Aborting"
|
6458
|
|
- log_end_msg 1
|
6459
|
|
- exit 1
|
6460
|
|
- fi
|
6461
|
|
- done
|
6462
|
|
- log_end_msg 0
|
6463
|
|
-}
|
6464
|
|
-
|
6465
|
|
-wait_for_pidfile() {
|
6466
|
|
- pidfile=$1
|
6467
|
|
- kill_at=20
|
6468
|
|
- seconds=1
|
6469
|
|
-
|
6470
|
|
- while ! [[ -f $pidfile ]]; do
|
6471
|
|
- sleep 1
|
6472
|
|
- seconds=$(expr $seconds + 1)
|
6473
|
|
-
|
6474
|
|
- if [ $seconds -ge $kill_at ]; then
|
6475
|
|
- log_action_msg "Can't find the PID file," \
|
6476
|
|
- " the application must have crashed."
|
6477
|
|
- log_end_msg 1
|
6478
|
|
- exit 1
|
6479
|
|
- fi
|
6480
|
|
- done
|
6481
|
|
-}
|
6482
|
|
-
|
6483
|
|
-getPID() {
|
6484
|
|
- # Discard any errors from cat
|
6485
|
|
- cat $MG_CELERYD_PID_FILE 2>/dev/null
|
6486
|
|
-}
|
6487
|
|
-
|
6488
|
|
-case "$1" in
|
6489
|
|
- start)
|
6490
|
|
- # Start the MediaGoblin celeryd process
|
6491
|
|
- log_daemon_msg "Starting GNU MediaGoblin Celery task queue" "$DAEMON_NAME"
|
6492
|
|
- if [ -z "$(getPID)" ]; then
|
6493
|
|
- # TODO: Could we send things to log a little bit more beautiful?
|
6494
|
|
- su -s /bin/sh -c "cd $MG_ROOT && \
|
6495
|
|
- MEDIAGOBLIN_CONFIG=$MG_CONFIG \
|
6496
|
|
- CELERY_CONFIG_MODULE=$MG_CELERY_CONFIG_MODULE \
|
6497
|
|
- $MG_CELERYD_BIN \
|
6498
|
|
- --pidfile=$MG_CELERYD_PID_FILE \
|
6499
|
|
- -f $MG_CELERYD_LOG_FILE 2>&1 >> $MG_CELERYD_PID_FILE" \
|
6500
|
|
- - $MG_USER 2>&1 >> $MG_CELERYD_LOG_FILE &
|
6501
|
|
-
|
6502
|
|
- CELERYD_RESULT=$?
|
6503
|
|
-
|
6504
|
|
- wait_for_pidfile $MG_CELERYD_PID_FILE
|
6505
|
|
-
|
6506
|
|
- log_end_msg $CELERYD_RESULT
|
6507
|
|
- else
|
6508
|
|
- # Failed because the PID file indicates it's running
|
6509
|
|
- log_action_msg "PID file $MG_CELERYD_PID_FILE already exists"
|
6510
|
|
- log_end_msg 1
|
6511
|
|
- fi
|
6512
|
|
- ;;
|
6513
|
|
- stop)
|
6514
|
|
- log_daemon_msg "Stopping GNU MediaGoblin Celery task queue" "$DAEMON_NAME"
|
6515
|
|
- if [ -z "$(getPID)" ]; then
|
6516
|
|
- # Failed because the PID file indicates it's not running
|
6517
|
|
- log_action_msg "Could not get PID"
|
6518
|
|
- log_end_msg 1
|
6519
|
|
- exit 1
|
6520
|
|
- else
|
6521
|
|
- kill $(getPID)
|
6522
|
|
-
|
6523
|
|
- wait_for_death $(getPID)
|
6524
|
|
- fi
|
6525
|
|
- ;;
|
6526
|
|
- restart)
|
6527
|
|
- $0 stop
|
6528
|
|
- $0 start
|
6529
|
|
- ;;
|
6530
|
|
- status)
|
6531
|
|
- if ! [ -z "$(getPID)" ]; then
|
6532
|
|
- echo "$DAEMON_NAME start/running, process $(getPID)"
|
6533
|
|
- else
|
6534
|
|
- echo "$DAEMON_NAME stopped."
|
6535
|
|
- fi
|
6536
|
|
- ;;
|
6537
|
|
- *)
|
6538
|
|
- echo "Usage: $0 {restart|start|stop|status}"
|
6539
|
|
- exit 1
|
6540
|
|
- ;;
|
6541
|
|
-esac
|
6542
|
|
-
|
6543
|
|
-exit 0
|
6544
|
|
-#+END_SRC
|
6545
|
|
-
|
6546
|
|
-Save and exit.
|
6547
|
|
-
|
6548
|
|
-#+BEGIN_SRC: bash
|
6549
|
|
-chmod +x /etc/init.d/mediagoblin-paster
|
6550
|
|
-chmod +x /etc/init.d/mediagoblin-celeryd
|
6551
|
|
-update-rc.d mediagoblin-paster defaults
|
6552
|
|
-update-rc.d mediagoblin-celeryd defaults
|
6553
|
|
-service mediagoblin-paster start
|
6554
|
|
-service mediagoblin-celeryd start
|
6555
|
|
-#+END_SRC
|
6556
|
|
-
|
6557
|
|
-Create a script as follows:
|
6558
|
|
-
|
6559
|
|
-#+BEGIN_SRC: bash
|
6560
|
|
-emacs /srv/mymediagoblindomain/mediagoblin/mg.fcgi
|
6561
|
|
-#+END_SRC
|
6562
|
|
-
|
6563
|
|
-Add the following, replacing /mymediagoblindomain/ with your mediagoblin domain name.
|
6564
|
|
-
|
6565
|
|
-#+BEGIN_SRC: bash
|
6566
|
|
-#!/srv/mymediagoblindomain/mediagoblin/bin/python
|
6567
|
|
-
|
6568
|
|
-# Written in 2011 by Christopher Allan Webber
|
6569
|
|
-#
|
6570
|
|
-# To the extent possible under law, the author(s) have dedicated all
|
6571
|
|
-# copyright and related and neighboring rights to this software to the
|
6572
|
|
-# public domain worldwide. This software is distributed without any
|
6573
|
|
-# warranty.
|
6574
|
|
-#
|
6575
|
|
-# You should have received a copy of the CC0 Public Domain Dedication along
|
6576
|
|
-# with this software. If not, see
|
6577
|
|
-# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
6578
|
|
-
|
6579
|
|
-from paste.deploy import loadapp
|
6580
|
|
-from flup.server.fcgi import WSGIServer
|
6581
|
|
-
|
6582
|
|
-CONFIG_PATH = '/srv/mymediagoblindomain/mediagoblin/paste_local.ini'
|
6583
|
|
-
|
6584
|
|
-## Uncomment this to run celery in "always eager" mode... ie, you don't have
|
6585
|
|
-## to run a separate process, but submissions wait till processing finishes
|
6586
|
|
-# import os
|
6587
|
|
-# os.environ['CELERY_ALWAYS_EAGER'] = 'true'
|
6588
|
|
-
|
6589
|
|
-def launch_fcgi():
|
6590
|
|
- ccengine_wsgi_app = loadapp('config:' + CONFIG_PATH)
|
6591
|
|
- WSGIServer(ccengine_wsgi_app).run()
|
6592
|
|
-
|
6593
|
|
-
|
6594
|
|
-if __name__ == '__main__':
|
6595
|
|
- launch_fcgi()
|
6596
|
|
-#+END_SRC
|
6597
|
|
-
|
6598
|
|
-Save and exit, then edit the Apache configuration for your mediagoblin site.
|
6599
|
|
-
|
6600
|
|
-#+BEGIN_SRC: bash
|
6601
|
|
-chown -hR mediagoblin:mediagoblin /srv/$HOSTNAME
|
6602
|
|
-emacs /etc/apache2/sites-available/mymediagoblindomain
|
6603
|
|
-#+END_SRC
|
6604
|
|
-
|
6605
|
|
-Add the following to the section which begins with *<VirtualHost *:80>*, and remove the existing ScriptAlias sections.
|
6606
|
|
-
|
6607
|
|
-#+BEGIN_SRC: bash
|
6608
|
|
- Options +ExecCGI
|
6609
|
|
-
|
6610
|
|
- # Accept up to 16MB requests
|
6611
|
|
- FcgidMaxRequestLen 16777216
|
6612
|
|
-
|
6613
|
|
- Alias /mgoblin_static/ /srv/mymediagoblindomain/mediagoblin/mediagoblin/static/
|
6614
|
|
- Alias /mgoblin_media/ /srv/mymediagoblindomain/mediagoblin/user_dev/media/public/
|
6615
|
|
-
|
6616
|
|
- ScriptAlias / /srv/mymediagoblindomain/mediagoblin/mg.fcgi/
|
6617
|
|
-#+END_SRC
|
6618
|
|
-
|
6619
|
|
-Save and exit.
|
6620
|
|
-
|
6621
|
|
-http://mediagoblin.readthedocs.org/en/latest/siteadmin/deploying.html
|
6622
|
|
-https://wiki.mediagoblin.org/HackingHowto
|
6623
|
|
-https://github.com/joar/mediagoblin-init-scripts
|
6624
|
|
-https://wiki.mediagoblin.org/Deployment#Apache_2_Config_With_mod_wsgi
|
6625
|
|
-
|
6626
|
6366
|
** Kune
|
6627
|
6367
|
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).
|
6628
|
6368
|
|