Labs/Joey/ServerSetup

From MozillaWiki
< Labs‎ | Joey
Jump to: navigation, search
Draft-template-image.png THIS PAGE IS A WORKING DRAFT Pencil-emoji U270F-gray.png
The page may be difficult to navigate, and some information on its subject might be incomplete and/or evolving rapidly.
If you have any questions or ideas, please add them as a new topic on the discussion page.

WORKING ON THIS NOW. ;-)

This page is the How To on setting up a Joey Server.

I am using a Red Hat Enterprise Server using the rhel-i386-as-4-webapp-1-beta feed for php5.

up2date ImageMagick
up2date httpd
up2date mod_ssl
up2date mysql
up2date mysql-server
up2date php
up2date php-mysql
up2date php-domxml
up2date subversion

On CentOS 5:

yum install ImageMagick
yum install httpd
yum install mod_ssl
yum groupinstall mysql
yum install php
yum install php-mysql
yum install php-domxml
yum install subversion

(justdave tells me that I can way reduce this list because of dependencies).

Don't forget to make mysqld and httpd automatically start-up after a reboot:

chkconfig httpd on
chkconfig mysqld on

You will need to setup FFMPEG if you want to play with videos at all. Directions are here. We offer absolutely NO support, so don't send any emails to me about "how do I build ffmpeg". Heck, we barely know how to do it.

http://ffmpeg.mplayerhq.hu/download.html


sudo up2date cvs ncurses-devel autoconf automake libtool gcc-c++

Pull LAME:

cvs -d:pserver:anonymous@lame.cvs.sourceforge.net:/cvsroot/lame login
cvs -z3 -d:pserver:anonymous@lame.cvs.sourceforge.net:/cvsroot/lame co lame

Build it and install it

Pull AMRNB:


wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-6.1.0.4.tar.bz2

bzip2 --decompress amrnb-6.1.0.4.tar.bz2
tar -xvf amrnb-6.1.0.4.tar 

Build it and install it.


Pull FAAC

cvs -d:pserver:anonymous@faac.cvs.sourceforge.net:/cvsroot/faac login 
cvs -d:pserver:anonymous@faac.cvs.sourceforge.net:/cvsroot/faac co faac 

build faac

./bootstrap
./configure
make

./configure --enable-memalign-hack --enable-libmp3lame --extra-libs=/usr/local/lib/libmp3lame.a --extra-libs=/usr/local/lib/libfaac.a --extra-libs=/usr/local/lib/libamrnb.a --enable-libamr-nb --enable-libfaac --enable-gpl

Pull the Joey Server code:

For anonymous browsing and checkout, use http://svn.mozilla.org. This should be put somewhere where apache can see it.


After a checkout, we have something that looks like:

[dougt@sm-mobile02 joey.labs.mozilla.com]$ pwd
/data/joey.labs.mozilla.com
[dougt@sm-mobile02 joey.labs.mozilla.com]$ ls -al
total 36
drwxr-xr-x   7 dougt root  4096 Apr  6 10:28 .
drwxr-xr-x   4 dougt root  4096 Apr  6 10:20 ..
drwxr-xr-x  11 dougt users 4096 Apr  6 10:28 app
drwxr-xr-x   6 dougt users 4096 Apr  6 10:28 cake
drwxr-xr-x   3 dougt users 4096 Apr  6 10:28 docs
-rw-r--r--   1 dougt users  139 Apr  6 10:28 .htaccess
-rw-r--r--   1 dougt users 2666 Apr  6 10:28 index.php
drwxr-xr-x   7 dougt users 4096 Apr  6 10:28 .svn
drwxr-xr-x   3 dougt users 4096 Apr  6 10:28 vendors


Read over app/config/config.php-dist, and make your copy here:

app/config/config.php

This will contain some interesting and important settings.

Setup apache.

There are some changes you need to make to a standard apache install. In http.conf,

change:

DocumentRoot to /data/joey.labs.mozilla.com (or wherever you have checked out the Joey Server code)

Add these types:

AddType application/x-xpinstall .xpi AddType video/3gpp .3gp AddType text/xml .rdf

AddType text/vnd.sun.j2me.app-descriptor .jad AddType application/java-archive .jar

Also setup any virtual hosts that you might need:

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
  ServerName joey.labs.mozilla.com

  RewriteEngine On
  RewriteRule ^/joey\.xpi$ - [L]
  RewriteRule ^/update\.rdf$ - [L]
  RewriteRule ^/(.*)$ https://joey.labs.mozilla.com/$1 [R=301,L]
</VirtualHost>

<VirtualHost *:443>
  ServerName joey.labs.mozilla.com
  DocumentRoot /data/joey.labs.mozilla.com

  SSLEngine On
  php_value apc.enabled off

  <Directory /data/joey.labs.mozilla.com>
    AllowOverride All
  </Directory>

  RewriteEngine On

</VirtualHost>


Also, you want to make sure that your server speaks SSL. Without going into too much detail about this -- I justed added this to my Virtual Host.

SSLCertificateFile /etc/ssl/joey_labs_mozilla_com.cer
SSLCertificateKeyFile /etc/ssl/joey.labs.key
SSLCACertificateFile /etc/ssl/SSLBundle.crt
SSLCertificateChainFile /etc/ssl/SSLBundle.crt

You will need to setup the database (will get you the schema url)


Make sure that sqld is running:

sudo /sbin/service mysqld start


Then setup the user. It can be anything as long as it matches what you put in config.php above.

mysqladmin -u root password 'passwordyouwant'

cd app/config/sql

mysql -u root -p 'passwordyouset'

create database joey;
use joey;
source joey.sql;

php.ini changes:

PHP's default settings need to be tweak a bit for us:



-max_execution_time = 30     ; Maximum execution time of each script, in seconds
-max_input_time = 60    ; Maximum amount of time each script may spend parsing request data
-memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)
+max_execution_time = 300     ; Maximum execution time of each script, in seconds
+max_input_time = 600   ; Maximum amount of time each script may spend parsing request data
+memory_limit = 100M      ; Maximum amount of memory a script may consume (8MB)

 ; Maximum allowed size for uploaded files.
-upload_max_filesize = 2M
+upload_max_filesize = 200M
 

 ; Maximum size of POST data that PHP will accept.
-post_max_size = 8M
+post_max_size = 200M


If you plan to do email confirmation, and password reset, you are going to have to make sure that the emails don't get pick up as spam. To do this, you need to make sure that "reverse-dns matches the forward dns". If this doesn't make sense, do a web search for details.

Do something like:

Install the "sendmail-cf" package, then edit /etc/mail/sendmail.mc and uncomment the MASQUERADE_AS and FEATURE(masquerade_envelope) lines that already existed, then change the MASQUERADE_AS line to have the domain name I wanted used. Then restart sendmail with "service sendmail restart".


You will need to create your uploads directly and inside of that directory a "cache" directory.

Python update daemon

  • Dependencies

sudo up2date python-devel sudo up2date mysql-devel

wget http://downloads.sourceforge.net/mysql-python/MySQL-python-1.2.2.tar.gz?modtime=1172959928&big_mirror=0

tar -xvzf MySQL-python-1.2.2.tar.gz cd MySQL-python-1.2.2 python setup.py build

sudo python setup.py install


http://software.inl.fr/trac/trac.cgi/wiki/IPy

better http cacheing: http://code.google.com/p/httplib2/wiki/Install

For Microsummary: sudo up2date libxml2-devel libxslt-python libxslt-devel

easy_install lxml==1.3bugfix

You might have to use one of the EGGs to get lxml installed -- that is what I did.