QA/Sync/Sync Server Install EL6

From MozillaWiki
< QA‎ | Sync
Jump to: navigation, search

Back To ==> Mozilla BT Services


Notes for installing Sync Server on Red Hat Enterprise Linux 6 for 64-Bit systems

REF: http://docs.services.mozilla.com/howtos/run-sync.html

General Notes

  • The "Building the server" steps can be repeated for each new build you want to test.
  • Once it is running, you can point to it for your own Sync server.
  • It is highly recommended that Python 2.6.6 be installed before proceeding with the Sync install.
  • Python 2.7 appears to be compatible, but the pre-packaged installer assumes 2.6.6.
  • Also, it is highly recommended that the developer tools are installed after installing Python 2.6.6.

Installing the Developer Tools

To get a full development environment on the box, do the following:

$ curl -O http://python-distribute.org/distribute_setup.py
$ sudo python2.6 distribute_setup.py
$ sudo easy_install-2.6 MoPyTools

Keeping the build logs

Run the "make build" step as follows:

$ make build 1> buildlog.log 2> builderr.err

Using Sqlite3

If sqlite3 is to be used, the server-full/etc/sync.conf file must be edited to change the default location of the temp.db file. The default location is in /tmp, which will get wiped at each system boot/restart.

Installing Sync Server

Assuming kernel version similar to the following 2.6.32-131.6.1.el6.x86_64 ... x86_64 x86_64 x86_64 GNU/Linux

Pre-Installed Packages

The following packages were already installed by OPs on the sync6 VM:

  • Python 2.6.6
  • Sqlite3 3.6.20

Required Packages

The following packages need to be installed. This should be a one-off, unless updates/upgrades are needed by the Sync Server code:

  • Mercurial
  • MySQL Server, Devel, etc.
  • Make
  • Virtualenv
  • SetupTools
  • Python virtualenv
  • Python devel
  • Gcc

Installations

  • Install Mercurial 1.4
$ sudo yum install mercurial
  • Verify the installation:
$ hg --version
  • Install MySQL Server 14.14
$ sudo yum install mysql-server
  • Verify the installation:
$ mysql --version
  • Install Gnu Make 3.81
$ sudo yum install make
  • Verify the installation:
$ make -v

Note: For the more manual installation steps, using /usr/local/src as a working directory, although this can be any location you choose.

  • Install SetupTools
$ cd /usr/local/src
$ sudo wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
$ sudo tar xzfv setuptools-0.6c11.tar.gz
$ cd setuptools-0.6c11
$ sudo python2.6 setup.py install
  • Install Python virtualenv-1.6.4:
$ cd /usr/local/src
$ sudo wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.6.4.tar.gz
$ sudo tar xvfz virtualenv-1.6.4.tar.gz
$ cd virtualenv-1.6.4
$ sudo python2.6 setup.py install
  • Install Python Devel for Python 2.6.6
$ sudo yum install python-devel-2.6.6-20.el6.x86_64
  • Install GCC, which is required for MySQL-Python
$ cd /usr/local/src
$ sudo yum install gcc
  • Verify the installation:
$ which gcc
returns the following
/usr/bin/gcc
$ gcc --version
returns the following
gcc (GCC) 4.4.5 20110214 (Red Hat 4.4.5-6)
  • Start up MySQL
sudo /etc/init.d/mysqld start
  • Configure MySQL with a password and a test DB for Sync.
mysql -u root -p
There may be no password (or a "blank" password)
  • Two commands seems to work to change the password:
mysql> UPDATE mysql.user set Password=PASSWORD('mozroot') WHERE User='root';
mysql> FLUSH PRIVILEGES
  • Create a test database for use with SyncServer
mysql> CREATE DATABASE syncdb;
mysql> \quit

Note: mysql-server install usually prints several lines that show how to do initial setup, so those steps could also be followed instead of the steps listed above.

  • Next, clone and build the sync server (installing to an open folder for now: /opt/sync)
$ mkdir /opt/sync
$ cd /opt/sync
$ hg clone https://hg.mozilla.org/services/server-full
$ cd server-full
$ make build
  • Install mysql-devel (which is a prereq for MySQL-Python)
$ sudo yum install mysql-devel
  • Install MySQL-Python
$ cd /opt/sync/server-full
$ bin/easy_install MySQL-Python
  • Configure server-full/etc/sync.conf to use MySQL
sqluri = mysql://user:password@server/database
where "user" is the current user on this install
"password" is the mysql password for this user
"server" is just localhost
"database" is a default or new database for use with the Sync server

Running the Sync 1.1 Tests

  • Once the build is complete, you can run the test as follows
$ make test
  • If everything runs as expected, you should see the following:
bin/nosetests -s --with-xunit deps/server-core/services/tests
deps/server-reg/syncreg/tests deps/server-storage/syncstorage/tests
............................................................etc.......
----------------------------------------------------------------------
Ran 177 tests in 33.031s
OK
  • The tests are located in the following directories:
    • server-full/deps/*/*/tests
  • Note: Remember to cleanup after the test by deleted some db files in /tmp
rm /tmp/sync.db /tmp/tests*.db

Starting the Sync Server

  • Run the following command (see the wiki page) for more information
$ bin/paster serve development.ini
  • If the Server is running correctly, you should see something like this
Starting server in PID 3568.
serving on 0.0.0.0:5000 view at http://127.0.0.1:5000

Rebuilding and Deploying the Sync Server

  • Kill the Sync Server process
$ kill -9 <PID>

(Leave MySQL running)

  • Save the Sync Server directory and its contents

(this in case you want to keep various snapshots)

$ mv server-full server-full-<DATE>

(example: mv server-full server-full-08012011)

  • Repeat the build and deploy steps from above
  • Make the necessary changes in the server-full/etc/sync.conf file:
  • Change the sqluri entries
  • Restart the server

Redeploying a Live Server

  • The following steps can be used to redeploy a live sync server
$ cd /path/to/server-full
$ hg pull -uv
$ make build
$ apachectl graceful
  • This should be sufficient, as "make build" will pull and update the repositories underneath the "deps" directory.
  • There is also a "make update" target which will update only the dependent repositories, without rebuilding any of the third-party dependencies from PyPi.
  • Also note that the Makefile will build the production channel by default, meaning this will not update you to the very latest checked-in changes but rather to the latest tags. If instead you want to deploy the very latest code, then use this line instead:
$ make build CHANNEL=dev


For more advanced configurations, including web server support, please see the following documentation:

For a more technical overview of Sync Server and an introduction to Mozilla Services, please see the following documentation:


Back To ==> Mozilla BT Services