QA/Sync/Sync Server Install Fedora

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

Back To ==> Mozilla BT Services

Notes for Installing Sync Server on Fedora 15


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
$ sudo python2.6
$ 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 the prerequisites have been met, following the clone, build, and make steps from the link above.

Configuring Sync Server to use MySQL

The Sync Server can be re-configured to use MySQL instead of Sqlite3.

  • Install MySQL
$ sudo yum install mysql, mysql-devel, mysql-server

Note: mysql-python will also have to be installed since Fedora 15 does not pre-install this package.

$ cd server_full
$ bin/easy_install MySQL-Python
  • Start MySQL
$ sudo /etc/init.d/mysqld start
(will ask for the root password, if set)
will show something like the following:
Server version: 5.5.13 MySQL Community Server (GPL)
mysql  Ver 14.14 Distrib 5.5.14, for Linux (i686) using readline 5.1
  • Run the following to enter mysql:
$ mysql -u root -p
There may be no password yet (in which case the password field is blank)
  • If there is no password, run following to create one
mysql> UPDATE mysql.user set Password=PASSWORD('mozroot') WHERE User='root';
mysql> \quit
  • While in mysql, create a database for use with SyncServer
mysql> CREATE DATABASE syncdb;
mysql> \quit
  • Change two lines in the server-full/etc/sync.conf file
sqluri = sqlite:////tmp/test.db
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

Start the Sync Server

  • Run the following command (see the wiki page) for more information
$ bin/paster serve development.ini
$ nohup bin/paster serve development.ini 1>> syncserver.log 2>>syncserver.log &
While running, the Sync Server messages/events will print to STDOUT and STDERR.
This command will run the server outside of any login session and save STDOUT and STDERR to a log file.
  • If the Server is running correctly, you should see something like this
Starting server in PID 3568.
serving on view at

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
Ran 177 tests in 33.031s
  • 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

Restarting MySQL after System Restart

  • Possible lines for autostarting MySQL server on boot
$ sudo /etc/init.d/mysqld start ## use restart after update
## OR ##
$ sudo service mysqld start ## use restart after update
$ sudo chkconfig --levels 235 mysqld on

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 using the "nohup" command from above
  • Test the service to verify everything is running correctly

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