no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


ralph [2017/06/30 20:59] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== ralph ======
  
 +  * [[Python]]
 +  * [[Ubuntu]]
 +
 +Note that installing the ''.deb'' file for Ralph will take a long time (15+ mins on my dual-core VirtualBox image).
 +
 +Create a ''ralph'' user on the system:
 +
 +<code>
 +useradd -m -s /bin/bash ralph
 +</code>
 +
 +Create a MySQL user:
 +
 +<code>
 +CREATE DATABASE ralph;
 +GRANT ALL PRIVILEGES ON ralph.* TO 'ralph'@'localhost' IDENTIFIED BY 'o-hai-ralph' WITH GRANT OPTION;
 +</code>
 +
 +Update ''.bashrc'' to source virtualenv settings:
 +
 +<code>
 +source /opt/ralph/ralph-core/bin/activate
 +</code>
 +
 +Set up migration and database:
 +
 +<code>
 +ralph migrate
 +ralph sitetree_resync_apps
 +</code>
 +
 +Changes to runtime site can go in ''/opt/ralph/ralph-core/lib/python3.4/site-packages/ralph/settings/prod.py''
 +
 +By default, ''prod.py'' will import settings from ''ralph.settings''.
 +
 +runserver script:
 +
 +<code>
 +#!/bin/bash
 +export PATH="/opt/ralph/ralph-core/bin:$PATH"
 +/opt/ralph/ralph-core/bin/ralph runserver 127.0.0.1:8000 >> /var/log/ralph/ralph.log 2>&1
 +</code>
 +
 +init script:
 +
 +<code>
 +#!/bin/bash
 +export PATH="/opt/ralph/ralph-core/bin:/usr/local/bin:/usr/bin:/bin"
 +
 +case "$1" in
 +        start)
 +                pgrep -f "/opt/ralph/ralph-core/bin/python /opt/ralph/ralph-core/bin/ralph" &> /dev/null
 +                if [ $? -eq 0 ]; then echo "ralph already running"; exit 1; fi
 +                su - ralph -c "/home/ralph/runserver &" &> /dev/null
 +                ;;
 +        stop)
 +                pkill -9 -u ralph -f "/opt/ralph/ralph-core/bin/python /opt/ralph/ralph-core/bin/ralph" &> /dev/null
 +                ;;
 +        restart)
 +                pkill -9 -u ralph -f "/opt/ralph/ralph-core/bin/python /opt/ralph/ralph-core/bin/ralph" &> /dev/null
 +                sleep 2
 +                su - ralph -c "/home/ralph/runserver" &> /dev/null
 +                ;;
 +        *)
 +                echo "Usage: ralph {start|stop|restart}"
 +                ;;
 +esac
 +</code>
 +
 +If using Ubuntu, add it to start on boot:
 +
 +<code>
 +update-rc.d ralph defaults
 +</code>

Navigation
QR Code
QR Code ralph (generated for current page)