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:
useradd -m -s /bin/bash ralph
Create a MySQL user:
CREATE DATABASE ralph; GRANT ALL PRIVILEGES ON ralph.* TO 'ralph'@'localhost' IDENTIFIED BY 'o-hai-ralph' WITH GRANT OPTION;
Update .bashrc
to source virtualenv settings:
source /opt/ralph/ralph-core/bin/activate
Set up migration and database:
ralph migrate ralph sitetree_resync_apps
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:
#!/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
init script:
#!/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
If using Ubuntu, add it to start on boot:
update-rc.d ralph defaults