QA/Sync/Sync Server Install EL6: Difference between revisions

From MozillaWiki
< QA‎ | Sync
Jump to navigation Jump to search
No edit summary
No edit summary
Line 124: Line 124:
  sqluri = mysql://root:mozroot@localhost/syncdb
  sqluri = mysql://root:mozroot@localhost/syncdb


== Starting the Sync Server ==
* Run the following command (see the wiki page) for more information  
* Run the following command (see the wiki page) for more information  
  $ bin/paster serve development.ini
  $ bin/paster serve development.ini

Revision as of 22:50, 4 August 2011

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 kernal 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 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
Change the two "sqluri" lines to match the following (or similar):
sqluri = mysql://root:mozroot@localhost/syncdb

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

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: