From MozillaWiki
Jump to: navigation, search

« Back to Archive | Update: Main

Ambox outdated.png THIS PAGE MAY BE OUTDATED
This article is in parts, or in its entirety, outdated. Hence, the information presented on this page may be incorrect, and should be treated with due caution until this flag has been lifted. Help by editing the article, or discuss its contents on the talk page.

Check out code from CVS


cvs co -P -d v1 -rMOZILLA_UPDATE_1_0_BRANCH mozilla/webtools/update 


cvs co -P -d v2 mozilla/webtools/addons

For CVS instructions, see the devmo page on CVS.

Server Requirements

v1 and v2

  • A server
  • mysqld
  • apache2
  • php4.x
  • php-mysql


  • zzlib PHP extension (for inflating xpi's in additem.php)


  • Smarty
  • PEAR::DB

v2 Enhancements

Without these, the app will still run, but it will be slower than optimal. We should plan on managing these, even if it is a PITA.

  • APC 3.x.x
  • memcached
  • PECL PHP memcache extension (--enable-memcache[=DIR])

v2 Server Notes

  • Apache
    • Prod
      • Copy contents of ./public/htaccess.dist into vhost conf file.
    • Dev/Testing
      • If you are using a singular vhost to test multiple instances of AMO, you'll have to adjust the vhost to use .htaccess files, so you'd have to add "AllowOverride FileInfo" then restart httpd.
    • Make sure mod_rewrite is installed
  • MySQL
    • 4.1.x+
    • When we move things forward we will need to import a mysqldump from production
    • We then will need to run ./shared/sql/v2.sql -- This was already completed in the v2 release, so if you have an access to the chameleon dump, using that should be adequate.
  • PHP
    • php-mysql - PHP packages for mysql support, this is a basic package
    • APC (optional, production only)
    • PECL memcache extension (optional, production only)
      • This involves adding a C extension to PHP and recompiling it.
      • The INSTALL file offers instructions on how to do this using PHP utils and make.
    • PEAR::DB -- This is a basic package.
    • Smarty -- https://intranet.mozilla.org/AMO -- Only the /lib directory is needed, the rest doesn't really need to be extracted.
      • In the past, it was helpful to just make symlink that was /usr/local/share/php/Smarty --> /usr/local/share/php/Smarty-2.x.x
      • When you configure the application, you will point at the lib directory not the base directory for Smarty -- so be aware of the distinction.

v1 Installation

  • copy core/config-dist.php -> core/config.php
  • Fill in the proper variables, see the comments in config.php for help
  • Your server needs to have a previews directory containing add-on previews
  • Find this directory (or contact morgamic if you don't have it)
  • Symlink the previews directory from ./images:
$ ln -s /data/previews/ previews
  • Your server needs to have a files directory containing the right .xpi's
  • You'll want to do something similar to set up the xpi directory:
$ ln -s /data/amo/files/ files

v2 Installation

Application Config

The application is split into sections on purpose. The goal here was to:

  • segregate public, private and backend pieces
  • hide non-public scripts from the world by not having php includes in the webroot

Directory Structure

The main directories we should be aware of:

  • ./shared/bin - backend scripts are stored here, and use the config.php in this directory
  • ./shared/sql - sql structure along with a v2.sql for migrating v1 to the new structure live here
  • ./shared/lib - all php libs and dependencies that are central live here (class defninitions, etc.)
  • ./public/inc - wrappers live here, like config.php, init.php and finish.php
  • ./public/htdocs - this should be the webroot of the site
  • ./public/tpl - this is the template directory, not stored in the webroot
  • ./public/templates_c - this is where smarty stores compiled templates
  • ./public/cache - this is the smarty cache dir, not really needed but config requires it
  • ./public/configs - this is the smarty configs dir, not really needed but config requires it

Setting things up, permissions, etc.

  • ./public/(templates_c, cache, and configs)
    • These should be writeable by apache
  • ./public/inc/config.php
    • Copy config-dist.php to config.php and follow the instructions in the comments.
  • ./public/htdocs/htaccess.dist
    • Copy to .htaccess then set the rewrite base to the proper value.


  • As with v1 you will have to create a symlink to the previews directory from images/:
$ cd public/htdocs/images
$ ln -s /data/previews/ previews