PyGoWave-Server

Note: It's probably best to check GoogleCode. This page is intended for ubuntu/debian installations, but may not be as up to date: https://code.google.com/p/pygowave-server/wiki/PyGoWaveServerInstallation

To install PyGoWave, you'll need the following (version listing may be incomplete):

  • Python >= 2.6.1

  • Django >= 1.0.2

  • Orbited >= 0.7.7

  • RabbitMQ >= 1.6.0

Python libraries:

  • lxml >= 2.2

  • PIL >= 1.1.6

  • carrot >= 0.5.0, <=0.5.1

Optional:

Installing

Prepare to install

sudo apt-get install python python-pip python-dev subversion mercurial

Django

sudo apt-get install python-django python-django-registration

OR

svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk
ln -s $(pwd)/django-trunk/django SITE-PACKAGES-DIR/django
ln -s $(pwd)/django-trunk/django/bin/django-admin.py /usr/local/bin

Dependencies

sudo apt-get install mysql-server python-mysqldb python-lxml python-simplejson
sudo easy_install carrot==0.5.1
sudo easy_install pil

Orbited

sudo apt-get install python-twisted
hg clone https://bitbucket.org/desmaj/orbited
cd orbited/daemon
python setup.py install

RabbitMQ

Add the repository to the end of /etc/apt/sources.list

echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee -a /etc/apt/sources.list

Get the keys

wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
sudo apt-key add rabbitmq-signing-key-public.asc

Update and install

sudo apt-get update
sudo apt-get install rabbitmq-server

OR

hg clone -r rabbitmq_v1_6_0 http://hg.rabbitmq.com/rabbitmq-stomp
cd rabbitmq-stomp
make RABBIT_SERVER_INCLUDE_DIR=/usr/lib/erlang/lib/rabbitmq_server-1.6.0/include
mkdir -p /usr/lib/erlang/lib/rabbitmq-stomp
cp -R * /usr/lib/erlang/lib/rabbitmq-stomp

Install Apache2 and mod_python

sudo apt-get install apache2 libapache2-mod-python libapache2-mod-proxy-html
sudo /etc/init.d/apache2 restart

PWG

sudo mkdir -p /srv/http/
cd /srv/http
svn checkout http://pygowave-server.googlecode.com/svn/tags/alpha_0.3 pygowave_project

Configuring

Mysql

install instrunctions: http://www.zolved.com/synapse/view_content/27986/How_to_install_MySQL_On_Ubuntu

mysql -u root -p
CREATE DATABASE `pygowave`;
CREATE USER 'pygowave'@'localhost' IDENTIFIED BY 'pygowave';
GRANT ALL PRIVILEGES ON `pygowave`.* TO 'pygowave'@'localhost' WITH GRANT OPTION;

Apache2

Sample file settings is be described below as per the GoogCode

The file you need to edit is apache2.conf

sudoedit /etc/apache2/sites-available/pygowave

Add these details. Be sure to update the PythonPath with the path to your pygowave_project folder. Perhaps move the code to /var/www ?

<Location /pygowave>
  SetHandler python-program
  PythonHandler django.core.handlers.modpython
  SetEnv DJANGO_SETTINGS_MODULE settings
  PythonOption django.root /pygowave
  PythonDebug On
  PythonInterpreter pygowave_django
  PythonPath "['/srv/http/pygowave_project'] + sys.path"
</Location>

Alias /pygowave/media /srv/http/pygowave_project/media
<Location "/pygowave/media">
  SetHandler None
  Options Indexes FollowSymLinks
  Order allow,deny
  Allow from all
</Location>

ProxyRequests Off
ProxyPass /static http://localhost:9000/static
ProxyPass /tcp http://localhost:9000/tcp


# To enable images and styles in Django's admin interface you might also need the following lines:

Alias /admin/media /usr/lib/python2.6/site-packages/django/contrib/admin/media
<Directory /usr/lib/python2.6/site-packages/django/contrib/admin/media>
  Order allow,deny
  Allow from all
</Directory>
<Location "/admin/media">
  SetHandler None
</Location>

Then link the site to enable it:

cd /etc/apache2/sites-enabled
ln -s ../sites-available/pygowave

Enable the proxy mods:

cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/proxy.conf .
sudo ln -s ../mods-available/proxy.load .

And restart apache2. Make sure there's no errors:

sudo /etc/init.d/apache2 restart

Perhaps browse to it, just to be sure.

Orbit

Need to edit:

sudoedit /etc/orbited.cfg

Add the lines below:

[global]
reactor=epoll
pid.location=/var/run/orbited.pid
user=www-data
group=www-data
proxy.enabled=1

[listen]
http://localhost:9000

[access]
* -> localhost:61613

[logging]
debug=SCREEN,/var/orbited/debug.log
info=SCREEN,/var/orbited/info.log
access=SCREEN,/var/orbited/info.log
warn=SCREEN,/var/orbited/error.log
error=SCREEN,/var/orbited/error.log

enabled.default=info,access,warn,error

[loggers]
Daemon=info,access,warn,error
TCPConnection=info,access,warn,error

Change "user=" and "group=" to your Apache's user and group. This is "www-data" on some systems. Check in the /etc/apache2/envvars file.

RabbitMQ

sudoedit /etc/rabbitmq/rabbitmq-env.conf

Add the lines below

NODENAME=rabbit
NODE_IP_ADDRESS=0.0.0.0
NODE_PORT=5672

LOG_BASE=/var/log/rabbitmq
MNESIA_BASE=/var/lib/rabbitmq/mnesia

SERVER_START_ARGS='
  -pa /usr/lib/erlang/lib/rabbitmq-stomp/ebin
  -rabbit
    stomp_listeners [{"0.0.0.0",61613}]
    extra_startup_steps [{"STOMP-listeners",rabbit_stomp,kickstart,[]}]'

Double check your configuration with sudo rabbitmq-server and if there's no errors (your configuration is fine) go ahead and restart it.

sudo /etc/init.d/rabbitmq-server restart

Set persimossions, add user and change password

sudo rabbitmqctl change_password guest $RANDOM$RANDOM$RANDOM
sudo rabbitmqctl add_user pygowave_client pygowave_client
sudo rabbitmqctl add_user pygowave_server pygowave_server
sudo rabbitmqctl set_permissions pygowave_client '^[^.]+\.[^.]+\.waveop$|^wavelet.direct$' '^[^.]+\.[^.]+\.(waveop|clientop)$|^wavelet.topic$' '^[^.]+\.[^.]+\.(clientop|waveop)$|^wavelet.direct$'
sudo rabbitmqctl set_permissions pygowave_server '^[^.]+\.[^.]+\.waveop$|^wavelet_rpc_singlethread$|^wavelet\.(topic|direct)$' '^[^.]+\.[^.]+\.waveop$|^wavelet_rpc_singlethread$|^wavelet\.direct$' '^[^.]+\.[^.]+\.waveop$|^wavelet_rpc_singlethread$|^wavelet\.(topic|direct)$'

PGW

Change the settings as per your DB

sudoedit settings.py
python manage.py syncdb
chown www-data media/gadgets media/avatars pygowave_client/cache locale pygowave_client/locale

Make sure to chown the files as whatever apache is running as. Check in /etc/apache2/envvars

Start up Orbited, RabbitMQ and Apache.

./launch-pygowave-rpc

That's it !! PyGoWave Server at http://localhost/pygowave.

CategoryNeedsExpansion

PyGoWave-Server (last edited 2012-09-15 17:17:51 by cong06)