|
|
| (21 intermediate revisions by 2 users not shown) |
| Line 1: |
Line 1: |
| | <noinclude>{{TOCright}}</noinclude> |
| | |
| =Activities.sugarlabs.org= | | =Activities.sugarlabs.org= |
| Over the last several months, there have been on and off discussions about how to adapt the addons.mozilla.org server software to manage Sugar activities. | | Over the last several months, there have been on and off discussions about how to adapt the addons.mozilla.org server software to manage Sugar activities. |
|
| |
| == Surely ADDONS.sugarlabs.org ? ==
| |
| As of February 2009, http://addons.sugarlabs.org exists (and rocks)! , while http://activities.sugarlabs.org only presents some user directories. -- [[User:Skierpage|Skierpage]] 02:14, 22 February 2009 (UTC)
| |
|
| |
|
| ==Background== | | ==Background== |
| Line 16: |
Line 15: |
| * A.m.o is written in cake-php (yet another web framework) | | * A.m.o is written in cake-php (yet another web framework) |
|
| |
|
| == Installing activities.sugarlabs.org == | | == Sources == |
| | |
| Mozilla.org runs a.m.o on CentOS5.0. For capability reasons these instructions will also use CentOS5.2.
| |
| | |
| ===Install centOS5.2 as server===
| |
| It is handy to set up a development system as a server-gui in a virtual machine.
| |
| | |
| ===Set up Apache===
| |
| Apache is pre-installed on CentOS.
| |
| | |
| Configure Apache to start on system boot.
| |
| | |
| <code>
| |
| chkconfig --levels 235 httpd on
| |
| </code>
| |
| | |
| ===Create Apache test page===
| |
|
| |
| <code>
| |
| vim /var/www/html/index.php
| |
| | |
| <?php phpinfo(); ?>
| |
| </code>
| |
| | |
| ===Start Apache===
| |
| | |
| <code>
| |
| service httpd start
| |
| </code>
| |
| | |
| ===Install Firefox===
| |
| | |
| <code>
| |
| yum install firefox
| |
| </code>
| |
| | |
| ===Test 127.0.0.1===
| |
|
| |
|
| verify mod_rewrite and mod_expires are loaded
| | http://git.sugarlabs.org/projects/slo-activities |
| | |
| ===Set up php===
| |
| | |
| look for PHP5.1.6
| |
| | |
| <code>
| |
| rpm -q php
| |
| </code>
| |
|
| |
|
| look for php-gettext ( in php-common)
| | Branches structure: |
| | * ''master'' branch, last ASLO codebase |
| | * ''master-theme'' rebased to ''master'' branch, last ASLO codebase with sugar theme |
| | * ''v<version>'' branch, released ASLO version |
| | * ''v<version>-theme'' rebased to ''v<version>'' branch, released ASLO version with sugar theme |
| | * ''production'' tag to last stable branch |
|
| |
|
| <code>
| | == Install server == |
| rpm -q php-common
| |
| </code>
| |
|
| |
|
| install required php modules
| | '''NOTE''' The followed instructions tested on Ubuntu 9.04(Jaunty). |
|
| |
|
| <code>
| | Install apache, php and mysql. |
| yum install php-pear php-gd php-mbstring | | sudo apt-get install apache2 mysql-server |
| | sudo apt-get install php5 php5-dev php5-gd php5-cli php-pear php5-mysql |
|
| |
|
| | Install required php modules. |
| pear config-set preferred_state beta | | pear config-set preferred_state beta |
| pear install Archive_Zip | | pear install Archive_Zip |
| </code>
| |
|
| |
| ===Install git===
| |
|
| |
| <code>yum install git</code>
| |
|
| |
| ===Checkout our fork===
| |
| The repo with the latest sources is http://git.sugarlabs.org/git/activities-sugarlabs-org/mainline.git
| |
|
| |
| <pre>
| |
| git-clone git://git.sugarlabs.org/activities-sugarlabs-org/mainline.git /var/www
| |
| </pre>
| |
|
| |
| Add these lines to /var/www/.git/info/exclude:
| |
|
| |
| <pre>
| |
| /site/vendors/product-details
| |
| /site/app/config/config-local.php
| |
| /site/app/config/config.php
| |
| /site/app/tmp
| |
| </pre>
| |
|
| |
| Create some empty dirs needed at runtime:
| |
|
| |
| <pre>
| |
| mkdir /var/www/site/app/tmp/
| |
| mkdir /var/www/site/app/tmp/cache
| |
| mkdir /var/www/site/app/tmp/cache/persistent
| |
| mkdir /var/www/site/app/tmp/cache/models
| |
| mkdir /var/www/site/app/tmp/cache/views
| |
| </pre>
| |
|
| |
| Fetch one external dependency:
| |
|
| |
| <pre>
| |
| cd /var/www/site/vendors/
| |
| svn co http://svn.mozilla.org/libs/product-details product-details
| |
| </pre>
| |
|
| |
| ==Set up server==
| |
|
| |
| ===Set permissions===
| |
|
| |
| <code>
| |
| chown -R apache:apache /var/www/site
| |
| </code>
| |
|
| |
| ===Edit DocumentRoot===
| |
|
| |
| <code>
| |
| vim /etc/httpd/conf/httpd.conf
| |
|
| |
| Edit DocumentRoot /var/www/site/app/webroot
| |
| Edit AllowOverride All
| |
| </code>
| |
|
| |
| ===Add to hosts===
| |
|
| |
| <code>
| |
| vim /etc/hosts
| |
| 127.0.0.1 activities.sugarlabs.org
| |
| </code>
| |
|
| |
| ==Test server==
| |
|
| |
| <code>
| |
| service httpd restart
| |
| </code>
| |
|
| |
| <code>
| |
| mv /var/www/site/app/webroot/index.php /var/www/site/app/webroot/index.php.old
| |
| mv /var/www/html/index.php /var/www/site/app/webroot/index.php
| |
| </code>
| |
|
| |
| ===Open===
| |
|
| |
| Open activities.sugarlabs.org in firefox
| |
|
| |
| ===Install mysql===
| |
| <code>
| |
| yum install mysql-server php-mysql
| |
| </code>
| |
|
| |
| ===start mysql on system boot===
| |
|
| |
|
| <code>
| | To check out sources you need git and subversion. |
| chkconfig --levels 235 mysqld on | | sudo apt-get install git subversion |
| </code>
| |
|
| |
|
| ===Start mysqld===
| | Checkout our fork. |
| | git-clone git://git.sugarlabs.org/slo-activities/mainline.git /var/www |
|
| |
|
| <code>
| | Fetch external dependencies: |
| service mysqld start | | cd /var/www/site/vendors/ |
| </code>
| | svn co http://svn.mozilla.org/libs/product-details |
| | svn co http://svn.mozilla.org/libs/fizzypop.mozdev fizzypop |
| | svn co http://svn.mozilla.org/libs/phorms |
| | svn co http://svn.mozilla.org/libs/zxtm-api |
|
| |
|
| ===Test server=== | | == Set up server == |
| | |
| <code>
| |
| service httpd restart
| |
| </code>
| |
|
| |
|
| open activities.sugarlabs.org in firefox. Make sure mysql is enabled
| | Setup apache. Add followed lines to the end of VirtualHost section in /etc/apache2/sites-enabled file: |
| | DocumentRoot /var/www/site/app/webroot |
| | <Directory /var/www/>AllowOverride All</Directory> |
|
| |
|
| ==Setup mysql==
| | Enable all apache mods. |
| | cd /etc/apache2/mods-enabled |
| | ln -s ../mods-available/* . |
|
| |
|
| <code>
| | Setup mysql(you need to enter mysql root password for these commands). |
| mysqladmin -u root password remora | | mysqladmin -u root password remora |
| mysqladmin -u root -p create remora | | mysqladmin -u root -p create remora |
| mysql -u root -p | | mysql -u root -p |
| | | |
| GRANT ALL ON *.* TO 'remora'@'localhost' IDENTIFIED BY 'remora'; | | GRANT ALL ON *.* TO 'remora'@'localhost' IDENTIFIED BY 'remora'; |
| exit; | | exit; |
| </code>
| |
|
| |
|
| ==Configure aso==
| | Add our server to /etc/hosts file. |
| | 127.0.0.1 a.sl.o |
| | |
| | To test server create /var/www/site/app/webroot/php.php: |
| | <?php phpinfo(); ?> |
| | Open http://a.sl.o/php in browser and make sure mysql is enabled. |
|
| |
|
| ===Auto mode=== | | == Configure ASLO == |
|
| |
|
| cd /var/www | | cd /var/www |
| cp aslo/config.php site/app/config/
| |
| aslo/db-create-stub.sh | | aslo/db-create-stub.sh |
|
| |
|
| ===Manual mode=== | | Open a.sl.o in browser. To login use: |
| | ''login'' admin@sugarlabs.org |
| | ''password'' test |
| | |
| | == Optional steps == |
| | |
| | ====Install php-memcache==== |
|
| |
|
| ====Populate tables====
| |
| <code> | | <code> |
| mysql -u remora --password=remora -D remora </var/www/site/app/config/sql/remora.sql | | yum install php-devel gcc zlib-devel |
| mysql -u remora --password=remora -D remora </var/www/site/app/tests/data/remora-test-data.sql | | |
| mysql -u remora --password=remora -D remora </var/www/site/app/tests/data/sugar-test-data.sql | | pecl install memcache |
| | vim /etc/php.ini |
| </code> | | </code> |
|
| |
|
| | | You should add "extension=memcache.so" to php.ini |
| ====Edit config.php==== | |
|
| |
|
| <code> | | <code> |
| cp /var/www/site/app/config/config.php.default /var/www/site/app/config/config.php | | service httpd restart |
| vim /var/www/site/app/config/config.php
| |
| </code> | | </code> |
|
| |
|
| '''NOTE''' Make sugar that /var/www/site/app/config/config.php is ended by "?>" not by "?>\n"
| | ====Install memcached==== |
| | |
| <pre><nowiki>
| |
| <?php
| |
| /* ***** BEGIN LICENSE BLOCK *****
| |
| * Version: MPL 1.1/GPL 2.0/LGPL 2.1
| |
| *
| |
| * The contents of this file are subject to the Mozilla Public License Version
| |
| * 1.1 (the "License"); you may not use this file except in compliance with
| |
| * the License. You may obtain a copy of the License at
| |
| * http://www.mozilla.org/MPL/
| |
| *
| |
| * Software distributed under the License is distributed on an "AS IS" basis,
| |
| * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
| |
| * for the specific language governing rights and limitations under the
| |
| * License.
| |
| *
| |
| * The Original Code is addons.mozilla.org site.
| |
| *
| |
| * The Initial Developer of the Original Code is
| |
| * The Mozilla Foundation.
| |
| * Portions created by the Initial Developer are Copyright (C) 2006
| |
| * the Initial Developer. All Rights Reserved.
| |
| *
| |
| * Contributor(s):
| |
| * Wil Clouser <wclouser@mozilla.com> (Original Author)
| |
| * Mike Morgan <morgamic@mozilla.com>
| |
| * Justin Scott <fligtar@gmail.com>
| |
| * Frederic Wenzel <fwenzel@mozilla.com>
| |
| *
| |
| * Alternatively, the contents of this file may be used under the terms of
| |
| * either the GNU General Public License Version 2 or later (the "GPL"), or
| |
| * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
| |
| * in which case the provisions of the GPL or the LGPL are applicable instead
| |
| * of those above. If you wish to allow use of your version of this file only
| |
| * under the terms of either the GPL or the LGPL, and not to allow others to
| |
| * use your version of this file under the terms of the MPL, indicate your
| |
| * decision by deleting the provisions above and replace them with the notice
| |
| * and other provisions required by the GPL or the LGPL. If you do not delete
| |
| * the provisions above, a recipient may use your version of this file under
| |
| * the terms of any one of the MPL, the GPL or the LGPL.
| |
| *
| |
| * ***** END LICENSE BLOCK ***** */
| |
| | |
| | |
| | |
| /**
| |
| * Global configuration document.
| |
| *
| |
| * This document covers both the CakePHP based site (/site) and its service scripts.
| |
| * Unless otherwise noted, trailing slashes should not be used.
| |
| * @package amo
| |
| */
| |
| | |
| /**
| |
| * Site URL
| |
| * Example: http://addons.mozilla.org
| |
| * Example: http://khan-vm.mozilla.org (dev)
| |
| * Example of getting a full controller url:
| |
| * echo SITE_URL.$html->url('/users/register');
| |
| * Will default to http://addons.mozilla.org unless defined below
| |
| */
| |
| // define('SITE_URL', '');
| |
| | |
| /**
| |
| * Services URL.
| |
| * Example: http://addons.mozilla.org/services
| |
| * Example: http://khan-vm.mozilla.org/amo/services (dev)
| |
| */
| |
| define('SERVICE_URL','http://activities.sugarlabs.org');
| |
| | |
| /**
| |
| * Site State
| |
| * Example: production
| |
| * Example: staging
| |
| * Example: dev
| |
| * All uses should default to dev
| |
| */
| |
| define('SITE_STATE', 'dev');
| |
|
| |
| /**
| |
| * Files
| |
| * The application uses these paths to piece together the URL for files.
| |
| *
| |
| * HOST and URL are separated because CakePHP has $html->webroot, and only appends
| |
| * FILES_URL while the services need both since it doesn't have
| |
| * Cake's context.
| |
| *
| |
| * No trailing slashes.
| |
| */
| |
| | |
| /**
| |
| * Host, including http://. Should be everything leading up to addon ids.
| |
| * Example: http://releases.mozilla.org/addons
| |
| */
| |
| define('FILES_HOST', 'http://activities.sugarlabs.org');
| |
| | |
| /**
| |
| * Relative web path of the files directory. Tacking this on to FILES_HOST should get you
| |
| * the complete URL where your files are. This is the location of the downloads controller
| |
| * and it should not normally need to be changed, the default is set in constants.php,
| |
| * and shown commented out here.
| |
| *
| |
| * Example: downloads/file
| |
| */
| |
| define('FILES_URL', 'downloads');
| |
| | |
| /**
| |
| * File path for storing XPI/JAR files (or any files associated with an add-on).
| |
| * Example: /data/www/app/webroot/files
| |
| */
| |
| define('REPO_PATH', '/var/www/files');
| |
| | |
| /**
| |
| * File path for storing public files to be rsynced for updates
| |
| * If left commented out, files will not be copied there and will use only REPO_PATH
| |
| */
| |
| //define('PUBLIC_STAGING_PATH', '');
| |
| | |
| /**
| |
| * The path to the gnu diff program (or any diff program able to create a unified diff).
| |
| * If left commented out, it will use the xdiff package
| |
| */
| |
| //define('DIFF_PATH', '/usr/bin/diff');
| |
| | |
| /**
| |
| * This is the number of seconds for which repeat downloads will not
| |
| * be counted, since Firefox does multiple gets during a single install process.
| |
| */
| |
| define('DL_COUNT_DELAY', '10');
| |
| l $shadow_databases;
| |
| $shadow_databases = array(
| |
| 0 => array(
| |
| 'DB_HOST' => '',
| |
| 'DB_PORT' => 3306,
| |
| 'DB_NAME' => '',
| |
| 'DB_USER' => '',
| |
| 'DB_PASS' => '',
| |
| 'DB_WEIGHT' => 0
| |
| )
| |
| );
| |
| | |
| /**
| |
| * TEST_DB_USER, TEST_DB_PASS, TEST_DB_NAME, TEST_DB_HOST, TEST_DB_PORT
| |
| * The test database. All fields default to their DB_* counterparts, except
| |
| * for TEST_DB_NAME, which is DB_NAME . "-test".
| |
| */
| |
| | |
| /**
| |
| * memcache configuration.
| |
| *
| |
| * The memcache_config array lists all possible memcached servers to use in case the default server does not have the appropriate key.
| |
| */
| |
| global $memcache_config;
| |
| $memcache_config = array(
| |
| 'localhost' => array(
| |
| 'port' => '11211',
| |
| 'persistent' => true,
| |
| 'weight' => '1',
| |
| 'timeout' => '1',
| |
| 'retry_interval' => 15
| |
| )
| |
| );
| |
| | |
| /**
| |
| * Recaptcha (recaptcha.net) configuration
| |
| */
| |
| define('RECAPTCHA_ENABLED', false);
| |
| define('RECAPTCHA_PRIVATE_KEY', '...');
| |
| define('RECAPTCHA_PUBLIC_KEY', '...');
| |
| | |
| /**
| |
| * Compatibility Center Versions
| |
| */
| |
| define('COMPAT_DEFAULT_VERSION', '3.1');
| |
| global $compatibility_versions;
| |
| $compatibility_versions = array(
| |
| '3.0', '3.1'
| |
| );
| |
| | |
| ?>
| |
| </nowiki></pre>
| |
| | |
| ====Edit config-local.php====
| |
|
| |
|
| <code> | | <code> |
| vim /var/www/site/app/config/config-local.php | | rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm |
| | yum install memcached |
| | service memcached start |
| | chkconfig --levels 235 httpd on |
| </code> | | </code> |
|
| |
| <code>
| |
| <?p
| |
|
| |
|
| == TODO == | | == TODO == |