QA/Sync/Sync Server Install Ubuntu

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

Back To ==> Mozilla BT Services


Note: This site has been deprecated. See the following links:
https://wiki.mozilla.org/QA/Sync/Sync_Server_Install_On_Ubuntu_10_04
https://wiki.mozilla.org/QA/Sync/Sync_Server_Install_On_Ubuntu_11_04
https://wiki.mozilla.org/QA/Sync/Sync_Server_Install_On_Ubuntu_11_10

Notes for Installing Sync Server on Ubuntu 10.04 or 10.10 64bit with Python 2.6.5

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, FireFox, and MySQL

  • Required packages
    • Python, python-dev, python-virtualenv
    • sqlite3 or mysql
    • mercurial
  • Run the following to make sure everything is installed:
$sudo apt-get install python-dev mercurial sqlite3 python-virtualenv
  • Verify the package installs and versions
$ which sqlite3
$ sqlite3 --version
$ which hg
$ hg --version
$ which python
$ python -V
  • Install FireFox 5.01

By default Ubuntu comes with FireFox 3.6.18 (or similar). In order to use Sync Server, FireFox 5 should be installed. The following steps are probably overkill, but they do get FireFox installed

$ sudo add-apt-repository ppa:ubuntu-mozilla-security/ppa
$ sudo add-apt-repository ppa:mozillateam/firefox-stable
$ sudo apt-get update
$ sudo apt-get upgrade
$ which firefox
  • Clone and Build the Sync Server
$ cd $home
$ hg clone https://hg.mozilla.org/services/server-full
$ cd server-full
$ make build

Start the Sync Server

  • Run the following command (see the wiki page) for more information
$ cd $home/server-full
$ bin/paster serve development.ini
or
$ 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 0.0.0.0:5000 view at http://127.0.0.1:5000

Installing and Using MySQL Server

Run the following commands to install and configure the necessary packages

$ sudo apt-get install mysql-server
root pwd: set the password for root
$ sudo apt-get install libmysqlclient-dev
  • Now install mysql-python
$bin/easy_install Mysql-Python
  • Enter MySQL to set up a database for the Sync Server
$ mysql -u root -p
(enter the root password set above)
mysql> CREATE DATABASE syncdb;
mysql> \quit
  • Edit the sync.conf file to use MySQL instead of sqlite3
$ cd server-full/etc
$ vi or vim or emacs sync.conf
Change both sqluri entries
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 0.0.0.0:5000 view at http://127.0.0.1:5000

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

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