From Sugar Labs
< Machine
Revision as of 15:24, 21 November 2009 by Dfarning (talk | contribs) (add mount points)
Jump to: navigation, search


ip address:

Set up

Below is the recipe that we used to set up the php server. Please see machine for up to date configuration details.

Install needed packages

sudo apt-get install apache2 php5 php5-gd php5-cli php-pear php5-mysql
sudo apt-get install git subversion
sudo apt-get install gettext

Install required php modules

pear config-set preferred_state beta 
pear install Archive_Zip

Create user to run scripts

sudo useradd -d /srv/activities activities

Make sure that all files in /srv/activities

  • has apache(web-data) user
  • activities group
  • group write access
  • umask is 002

Switch to activities user

sudo -i -u activities

Checkout ASLO sources

git clone git:// ~
git checkout production -b production

Fetch external dependencies

cd ~/site/vendors/
svn co
svn co fizzypop
svn co
svn co

Set up NFS mount points

add the following lines to the end of `/etc/fstab' /srv/activities/files nfs rsize=8192,wsize=8192,timeo=14,intr /srv/activities/staging nfs rsize=8192,wsize=8192,timeo=14,intr

Restart the nfs server

sudo /etc/init.d/nfs-kernel-server restart

Also aftter making changes to /etc/exports in a terminal you must type

sudo exportfs -a

First-time ASLO setup

Using ~/aslo/config.php as template, setup ASLO settings in file ~/site/app/config/config.php. Template file was configured for dev environment, switch it to production by setting SITE_STATE variable to production.

Setup other env defines in file ~/site/app/config/config-local.php

define('DEBUG', 0);
define('DEV', false);
define('QUERY_CACHE', true);

Create directories

mkdir -p ~/site/app/tmp/cache/persistent
mkdir -p ~/site/app/tmp/cache/models
mkdir -p ~/site/app/tmp/cache/views

Minify css/js stuff


Merge ASLO gettext strings


Crontab for activities user

@daily  $HOME/aslo/cron/daily
@hourly $HOME/aslo/cron/hourly

Create vhost

vim /etc/apache2/sites-available/

<VirtualHost *:80 *:443>
        ServerAlias # for test/install

        DocumentRoot /srv/activities/site/app/webroot

        LogFormat "%h %V %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{HTTP_COOKIE}i\"" addons
        CustomLog /srv/activities/data/access addons
        CustomLog /var/log/apache2/all-access.log vhost_combined
        #CustomLog /var/log/apache2/performance.log performance

Log rotate

Parse logs