Browse Source

Continuing mediagoblin

Bob Mottram 11 years ago
parent
commit
fcb3cc183a
1 changed files with 331 additions and 15 deletions
  1. 331
    15
      beaglebone.txt

+ 331
- 15
beaglebone.txt View File

2865
 /otr info
2865
 /otr info
2866
 #+END_SRC
2866
 #+END_SRC
2867
 
2867
 
2868
-And to trust or distrust some one else's fingerprint.
2868
+And to trust or distrust someone else's fingerprint.
2869
 
2869
 
2870
 #+BEGIN_SRC: bash
2870
 #+BEGIN_SRC: bash
2871
 /otr trust [fingerprint]
2871
 /otr trust [fingerprint]
6214
 git submodule update
6214
 git submodule update
6215
 virtualenv --system-site-packages .
6215
 virtualenv --system-site-packages .
6216
 ./bin/python setup.py develop
6216
 ./bin/python setup.py develop
6217
+./bin/easy_install flup
6218
+cp mediagoblin.ini mediagoblin_local.ini
6219
+emacs mediagoblin_local.ini
6217
 #+END_SRC
6220
 #+END_SRC
6218
 
6221
 
6219
-Fails here.  Currently not installable.
6222
+Change *email_sender_address* to your email address, then save and exit.
6220
 
6223
 
6221
 #+BEGIN_SRC: bash
6224
 #+BEGIN_SRC: bash
6222
-Installed /srv/goblin.uk.to/mediagoblin/lib/python2.7/site-packages/sqlalchemy_migrate-0.9-py2.7.egg
6223
-Searching for sqlalchemy>0.8.0,<0.9.0
6224
-Reading http://pypi.python.org/simple/sqlalchemy/
6225
-Best match: SQLAlchemy 0.8.6
6226
-Downloading https://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-0.8.6.tar.gz#md5=fe8766d913c1d0eb5c353650f11de624
6227
-Processing SQLAlchemy-0.8.6.tar.gz
6228
-Running SQLAlchemy-0.8.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-8HHH59/SQLAlchemy-0.8.6/egg-dist-tmp-Zy3CXP
6229
-/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_suite'
6230
-  warnings.warn(msg)
6231
-/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'features'
6232
-  warnings.warn(msg)
6233
-/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'tests_require'
6234
-  warnings.warn(msg)
6225
+./bin/gmg dbupdate
6226
+emacs /etc/init.d/mediagoblin-paster
6235
 #+END_SRC
6227
 #+END_SRC
6236
 
6228
 
6229
+Add the following, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site.
6230
+
6231
+#+BEGIN_SRC: bash
6232
+#!/bin/sh
6233
+# /etc/init.d/mediagoblin-paster
6234
+#
6235
+## LICENSE: CC0 <http://creativecommons.org/publicdomain/zero/1.0/>
6236
+# To the extent possible under law, Joar Wandborg <http://wandborg.se> has
6237
+# waived all copyright and related or neighboring rights to
6238
+# mediagoblin-paster. This work is published from Sweden.
6239
+#
6240
+## CREDIT
6241
+# Credit goes to jpope <http://jpope.org/> and
6242
+# chimo <http://chimo.chromic.org/>. From which' Arch init scripts this is
6243
+# based upon.
6244
+#
6245
+### BEGIN INIT INFO
6246
+# Provides:          mediagoblin-paster
6247
+# Required-Start:    $network $named $local_fs
6248
+# Required-Stop:     $remote_fs $syslog $network $named $local_fs
6249
+# Should-Start:      postgresql $syslog
6250
+# Default-Start:     2 3 4 5
6251
+# Default-Stop:      0 1 6
6252
+# Short-Description: MediaGoblin paster FCGI server init script
6253
+# Description:       This script will initiate the GNU MediaGoblin paster
6254
+#                    fcgi server.
6255
+### END INIT INFO
6256
+
6257
+################################################################################
6258
+# CHANGE THIS
6259
+# to suit your environment
6260
+################################################################################
6261
+MG_ROOT=/srv/mymediagoblindomain/mediagoblin
6262
+MG_USER=mediagoblin
6263
+################################################################################
6264
+# NOW STOP
6265
+# You probably won't have to change anything else.
6266
+################################################################################
6267
+
6268
+set -e
6269
+
6270
+DAEMON_NAME=mediagoblin-paster
6271
+
6272
+MG_BIN=$MG_ROOT/bin
6273
+MG_PASTER_BIN=$MG_BIN/paster
6274
+MG_PASTE_INI=$MG_ROOT/paste_local.ini
6275
+MG_FCGI_HOST=127.0.0.1
6276
+MG_FCGI_PORT=26543
6277
+MG_PASTER_PID_FILE=/var/run/mediagoblin/$DAEMON_NAME.pid
6278
+MG_PASTER_LOG_FILE=/var/log/mediagoblin/$DAEMON_NAME.log
6279
+
6280
+set_up_directories() {
6281
+    install -o $MG_USER -g users -d -m 755 /var/log/mediagoblin
6282
+    install -o $MG_USER -g users -d -m 755 /var/run/mediagoblin
6283
+}
6284
+
6285
+set_up_directories
6286
+
6287
+# Include LSB helper functions
6288
+. /lib/lsb/init-functions
6289
+
6290
+getPID () {
6291
+    # Discard any errors from cat
6292
+    cat $MG_PASTER_PID_FILE 2>/dev/null
6293
+}
6294
+
6295
+case "$1" in
6296
+    start)
6297
+        # Start the MediaGoblin paster process
6298
+        log_daemon_msg "Starting GNU MediaGoblin paster fcgi server" "$DAEMON_NAME"
6299
+		if [ ! -f $MG_PASTE_INI ]; then
6300
+            MG_PASTE_INI=$MG_ROOT/paste.ini
6301
+			fi
6302
+        if [ -z "$(getPID)" ]; then
6303
+            su -s /bin/sh -c "CELERY_ALWAYS_EAGER=False $MG_PASTER_BIN serve \
6304
+                $MG_PASTE_INI \
6305
+                --server-name=fcgi \
6306
+                fcgi_host=$MG_FCGI_HOST fcgi_port=$MG_FCGI_PORT \
6307
+                --pid-file=$MG_PASTER_PID_FILE \
6308
+                --log-file=$MG_PASTER_LOG_FILE \
6309
+                --daemon" - $MG_USER 2>&1 > /dev/null
6310
+
6311
+            PASTER_RESULT=$?
6312
+
6313
+            # Sleep for a while until we're kind of certain that paster has
6314
+            # had it's time to initialize
6315
+            TRIES=0
6316
+            while ! [ "X$PASTER_RESULT" != "X" ]; do
6317
+                log_action_msg "Tried $TRIES time(s)"
6318
+                sleep 0.1
6319
+                TRIES=$((TRIES+1))
6320
+            done
6321
+
6322
+            log_end_msg $PASTER_RESULT
6323
+        else
6324
+            # Failed because the PID file indicates it's running
6325
+            log_action_msg "PID file $MG_PASTER_BIN already exists"
6326
+            log_end_msg 1
6327
+        fi
6328
+        ;;
6329
+    stop)
6330
+        log_daemon_msg "Stopping GNU MediaGoblin paster fcgi server" "$DAEMON_NAME"
6331
+        if [ -z "$(getPID)" ]; then
6332
+            # Failed because the PID file indicates it's not running
6333
+            RET=1
6334
+        else
6335
+            kill $(getPID)
6336
+
6337
+            if [ $? -gt 0 ]; then
6338
+                RET=1
6339
+            else
6340
+                RET=0
6341
+            fi
6342
+        fi
6343
+        log_end_msg $RET
6344
+        ;;
6345
+    restart)
6346
+        $0 stop
6347
+        $0 start
6348
+        ;;
6349
+    status)
6350
+        if ! [ -z "$(getPID)" ]; then
6351
+            echo "$DAEMON_NAME start/running, process $(getPID)"
6352
+        else
6353
+            echo "$DAEMON_NAME stopped."
6354
+        fi
6355
+        ;;
6356
+    *)
6357
+        echo "Usage: $0 {restart|start|stop|status}"
6358
+        exit 1
6359
+        ;;
6360
+esac
6361
+
6362
+exit 0
6363
+#+END_SRC
6364
+
6365
+Save and exit.
6366
+
6367
+#+BEGIN_SRC: bash
6368
+emacs /etc/init.d/mediagoblin-celeryd
6369
+#+END_SRC
6370
+
6371
+Add the following, replacing /mymediagoblindomain/ with the domain name for your mediagoblin site.
6372
+
6373
+#+BEGIN_SRC: bash
6374
+#!/bin/bash
6375
+# /etc/init.d/mediagoblin-celeryd
6376
+#
6377
+## LICENSE: CC0 <http://creativecommons.org/publicdomain/zero/1.0/>
6378
+# To the extent possible under law, Joar Wandborg <http://wandborg.se> has
6379
+# waived all copyright and related or neighboring rights to
6380
+# mediagoblin-celeryd. This work is published from Sweden.
6381
+#
6382
+## CREDIT
6383
+# Credit goes to jpope <http://jpope.org/> and
6384
+# chimo <http://chimo.chromic.org/>. From which' Arch init scripts this is
6385
+# based upon.
6386
+#
6387
+### BEGIN INIT INFO
6388
+# Provides:          mediagoblin-celeryd
6389
+# Required-Start:    $network $named $local_fs
6390
+# Required-Stop:     $remote_fs $syslog $network $named $local_fs
6391
+# Should-Start:      postgres $syslog
6392
+# Default-Start:     2 3 4 5
6393
+# Default-Stop:      0 1 6
6394
+# Short-Description: MediaGoblin Celery task processor init script
6395
+# Description:       This script will initiate the GNU MediaGoblin Celery
6396
+#                    task processor
6397
+### END INIT INFO
6398
+
6399
+################################################################################
6400
+# CHANGE THIS
6401
+# to suit your environment
6402
+################################################################################
6403
+MG_ROOT=/var/www/mymediagoblindomain/htdocs
6404
+MG_USER=mediagoblin
6405
+################################################################################
6406
+# NOW STOP
6407
+# You probably won't have to change anything else.
6408
+################################################################################
6409
+
6410
+set -e
6411
+
6412
+DAEMON_NAME=mediagoblin-celeryd
6413
+
6414
+MG_BIN=$MG_ROOT/bin
6415
+MG_CELERYD_BIN=$MG_BIN/celeryd
6416
+MG_CONFIG=$MG_ROOT/mediagoblin_local.ini
6417
+MG_CELERY_CONFIG_MODULE=mediagoblin.init.celery.from_celery
6418
+MG_CELERYD_PID_FILE=/var/run/mediagoblin/$DAEMON_NAME.pid
6419
+MG_CELERYD_LOG_FILE=/var/log/mediagoblin/$DAEMON_NAME.log
6420
+
6421
+set_up_directories() {
6422
+    install -o $MG_USER -g users -d -m 755 /var/log/mediagoblin
6423
+    install -o $MG_USER -g users -d -m 755 /var/run/mediagoblin
6424
+}
6425
+
6426
+set_up_directories
6427
+
6428
+# Include LSB helper functions
6429
+. /lib/lsb/init-functions
6430
+
6431
+wait_for_death() {
6432
+    pid=$1
6433
+    seconds=1
6434
+
6435
+    if [ -z "$2" ]; then
6436
+        kill_at=20
6437
+    else
6438
+        kill_at=$2
6439
+    fi
6440
+
6441
+    if [ -z "$pid" ]; then
6442
+        log_action_msg "Could not get PID. Aborting"
6443
+        log_end_msg 1
6444
+        exit 1
6445
+    fi
6446
+
6447
+    while ps ax | grep -v grep | grep $pid > /dev/null; do
6448
+        sleep 1
6449
+        seconds=$(expr $seconds + 1)
6450
+        if [ $seconds -ge $kill_at ]; then
6451
+            log_action_msg "Failed to shut down after $kill_at seconds. Aborting"
6452
+            log_end_msg 1
6453
+            exit 1
6454
+        fi
6455
+    done
6456
+    log_end_msg 0
6457
+}
6458
+
6459
+wait_for_pidfile() {
6460
+    pidfile=$1
6461
+    kill_at=20
6462
+    seconds=1
6463
+
6464
+    while ! [[ -f $pidfile ]]; do
6465
+        sleep 1
6466
+        seconds=$(expr $seconds + 1)
6467
+
6468
+        if [ $seconds -ge $kill_at ]; then
6469
+            log_action_msg "Can't find the PID file," \
6470
+                " the application must have crashed."
6471
+            log_end_msg 1
6472
+            exit 1
6473
+        fi
6474
+    done
6475
+}
6476
+
6477
+getPID() {
6478
+    # Discard any errors from cat
6479
+    cat $MG_CELERYD_PID_FILE 2>/dev/null
6480
+}
6481
+
6482
+case "$1" in
6483
+    start)
6484
+        # Start the MediaGoblin celeryd process
6485
+        log_daemon_msg "Starting GNU MediaGoblin Celery task queue" "$DAEMON_NAME"
6486
+        if [ -z "$(getPID)" ]; then
6487
+            # TODO: Could we send things to log a little bit more beautiful?
6488
+            su -s /bin/sh -c "cd $MG_ROOT && \
6489
+                MEDIAGOBLIN_CONFIG=$MG_CONFIG \
6490
+                CELERY_CONFIG_MODULE=$MG_CELERY_CONFIG_MODULE \
6491
+                $MG_CELERYD_BIN \
6492
+                --pidfile=$MG_CELERYD_PID_FILE \
6493
+                -f $MG_CELERYD_LOG_FILE 2>&1 >> $MG_CELERYD_PID_FILE" \
6494
+                - $MG_USER 2>&1 >> $MG_CELERYD_LOG_FILE &
6495
+
6496
+            CELERYD_RESULT=$?
6497
+
6498
+            wait_for_pidfile $MG_CELERYD_PID_FILE
6499
+
6500
+            log_end_msg $CELERYD_RESULT
6501
+        else
6502
+            # Failed because the PID file indicates it's running
6503
+            log_action_msg "PID file $MG_CELERYD_PID_FILE already exists"
6504
+            log_end_msg 1
6505
+        fi
6506
+        ;;
6507
+    stop)
6508
+        log_daemon_msg "Stopping GNU MediaGoblin Celery task queue" "$DAEMON_NAME"
6509
+        if [ -z "$(getPID)" ]; then
6510
+            # Failed because the PID file indicates it's not running
6511
+            log_action_msg "Could not get PID"
6512
+            log_end_msg 1
6513
+            exit 1
6514
+        else
6515
+            kill $(getPID)
6516
+
6517
+            wait_for_death $(getPID)
6518
+        fi
6519
+        ;;
6520
+    restart)
6521
+        $0 stop
6522
+        $0 start
6523
+        ;;
6524
+    status)
6525
+        if ! [ -z "$(getPID)" ]; then
6526
+            echo "$DAEMON_NAME start/running, process $(getPID)"
6527
+        else
6528
+            echo "$DAEMON_NAME stopped."
6529
+        fi
6530
+        ;;
6531
+    *)
6532
+        echo "Usage: $0 {restart|start|stop|status}"
6533
+        exit 1
6534
+        ;;
6535
+esac
6536
+
6537
+exit 0
6538
+#+END_SRC
6539
+
6540
+Save and exit.
6541
+
6542
+#+BEGIN_SRC: bash
6543
+chmod +x /etc/init.d/mediagoblin-paster
6544
+chmod +x /etc/init.d/mediagoblin-celeryd
6545
+update-rc.d mediagoblin-paster defaults
6546
+update-rc.d mediagoblin-celeryd defaults
6547
+service mediagoblin-paster start
6548
+service mediagoblin-celeryd start
6549
+#+END_SRC
6550
+
6551
+TODO: apache configuration
6552
+
6237
 http://mediagoblin.readthedocs.org/en/latest/siteadmin/deploying.html
6553
 http://mediagoblin.readthedocs.org/en/latest/siteadmin/deploying.html
6238
 https://wiki.mediagoblin.org/HackingHowto
6554
 https://wiki.mediagoblin.org/HackingHowto
6239
 https://github.com/joar/mediagoblin-init-scripts
6555
 https://github.com/joar/mediagoblin-init-scripts