QA/Sync/Sync Server Install On Ubuntu 10 04
Back To ==> Mozilla BT Services
Contents
- 1 Installing Sync Server on Ubuntu 10.10 64-bit
- 1.1 ISO Source
- 1.2 Pre-Installed Packages
- 1.3 Required Packages
- 1.4 Initial/Required Installations
- 1.5 Install Python Tools and Developer Tools
- 1.6 Install Mercurial and Sqlite3
- 1.7 Install MySQL-Server and the Client Library
- 1.8 Clone and Build the Sync Server
- 1.9 Configure the Sync Server for sqlite3
- 1.10 Start and Verify the Sync Server
- 1.11 Configure MySQL and the sync.conf file
- 2 Running the Sync 1.1 Tests
- 3 Re-building and Re-deploying the Sync Server
- 4 Redeploying a Live Server
- 5 For more information
Installing Sync Server on Ubuntu 10.10 64-bit
ISO Source
Example: http://releases.ubuntu.com/10.10/ubuntu-10.10-desktop-amd64.iso
Pre-Installed Packages
The following applications should already be installed on Ubuntu 10.04 and 10.10:
$ firefox -V Mozilla Firefox 3.6.18, Copyright (c) 1998 - 2011 mozilla.org (So, this will need to be upgraded or manually installed to FireFox 5) $ python -V Python 2.6.6
Required Packages
The following packages are required before installing Sync Server:
- Mecurial
- Sqlite3
- make
- gcc
The following packages are optional, but highly recommended:
- MySQL-Server
$ which hg $ which sqlite3 $ which mysql
$ which make /usr/bin/make $ make --version GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for x86_64-pc-linux-gnu
$ which gcc /usr/bin/gcc $ gcc --version gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Media:Ubuntu10_10BeforeSnapshot.jpg
Initial/Required Installations
Upgrade to or manually install FireFox 5.01
Pulling the build from the Mozilla public releases site: http://releases.mozilla.org/pub/mozilla.org/firefox/releases/5.0.1/linux-x86_64/en-US/firefox-5.0.1.tar.bz2 Install FireFox to your home directory or other public directory if you are not the only user... $ cd $home $ wget http://releases.mozilla.org/pub/mozilla.org/firefox/releases/5.0.1/linux-x86_64/en-US/firefox-5.0.1.tar.bz2 $ tar xvjf firefox-5.0.1.tar.bz2 $ cd firefox $ which firefox Compare that to $ which ./firefox $ firefox -V Compare that to the following: $ ./firefox -V
So, the recommendation is to either run FireFox 5 from its own directory, or add this directory to the front of your PATH.
Now, run firefox from this folder and verify it starts and the version is correct.
$ ./firefox
Media:Ubuntu10_10FireFoxInstall1.jpg
Media:Ubuntu10_10FireFoxInstall2.jpg
Media:Ubuntu10_10FireFoxInstall3.jpg
Install Python Tools and Developer Tools
$ cd $home $ which python /usr/bin/python $ python -V Python 2.6.6
So, you need to install the Python Tools, Developer Tools, and the virtualenv for 2.6.6.
$ sudo apt-get install python-dev python-virtualenv
And, then the rest of the Python Tools:
$ sudo apt-get install curl $ curl -O http://python-distribute.org/distribute_setup.py $ sudo python2.6 distribute_setup.py $ sudo easy_install-2.6 MoPyTools
Install Mercurial and Sqlite3
The sqlite3 install is good for quick testing the Sync Server.
$ sudo apt-get install mercurial sqlite3 $ which hg /usr/bin/hg $ hg --version Mercurial Distributed SCM (version 1.6.3) Copyright (C) 2005-2010 Matt Mackall <mpm@selenic.com> and others This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ which sqlite3 /usr/bin/sqlite3 $ sqlite3 --version 3.7.2
Install MySQL-Server and the Client Library
The client library install may actually be an optional step.
$ sudo apt-get install mysql-server $ which mysql /usr/bin/mysql $ mysql --version mysql Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (x86_64) using readline 6.1 $ ps aux | grep sql mysql 4234 0.2 4.7 188292 24196 ? Ssl 21:01 0:00 /usr/sbin/mysqld mozroot 4323 0.0 0.1 8952 876 pts/0 S+ 21:02 0:00 grep --color=auto sql
And now the (optional) client library:
$ sudo apt-get install libmysqlclient-dev
Clone and Build the Sync Server
Clone and build the Sync Server in your home directory, or in some other directory if it will be used by others:
$ cd $home $ hg clone https://hg.mozilla.org/services/server-full $ cd server-full $ make build
Media:Ubuntu10_10ServerInstall1.jpg
Finally, install MySQL-Python
$ cd server-full $ bin/easy_install Mysql-Python
Media:Ubuntu10_10MySqlPython.jpg
Configure the Sync Server for sqlite3
Configure server-full/etc/sync.conf to use sqlite3 for quick testing.
Change the default db file and directory in the sync.conf file: $ cd server-full $ vi etc/sync.conf Change the following two lines: From: sqluri = sqlite:////tmp/test.db To: sqluri = sqlite:////home/<YOUR HOME>/sync.db (or to some other directory outside of /tmp)
Start and Verify the Sync Server
Start up the Sync Server (from the server-full directory)
$ bin/paster serve development.ini
Verify the server is up and running:
Starting server in PID <SOME PID>. serving on 0.0.0.0:5000 view at http://127.0.0.1:5000
Media:Ubuntu10_10ServerStartup.jpg
Check the Sync Server host using curl:
Open a new terminal window: $ curl http://127.0.0.1:5000 This should return a 404 error if it is working correctly (the 404 Not Found error will be within some html returned to STDOUT/STDERR) Alternatively: $ curl http://127.0.0.1:5000 > check.html
Check the Sync Server host using HTTP:
From an open browser: http://127.0.0.1:5000/user/1.0/a This should return a '0' if it is working correctly
Both of these should generate Sync Server INFO messages to STDOUT/STDERR (from the terminal running Sync Server).
Media:Ubuntu10_10ServerINFOMessages.jpg
Stop the Sync Server:
From the first terminal window: type ctrl-c
Configure MySQL and the sync.conf file
Configure MySQL with a root password and add a test sync DB:
$ mysql -u root -p
If your MySQL install does not already have a root password, do the following:
mysql> UPDATE mysql.user set Password=PASSWORD('mozroot') WHERE User='root'; mysql> FLUSH PRIVILEGES
Now set up a sync db for testing:
mysql> CREATE DATABASE syncdb; mysql> \quit
Configure server-full/etc/sync.conf to use MySQL for testing:
$ cd server-full $ vi etc/sync.conf Change the following two lines: From: sqluri = sqlite:////<YOUR DIR>/sync.db To: sqluri = mysql://root:<ROOT PWD>@localhost/<DB NAME> Example for root password of "mozroot" and sync DB on localhaost (from above steps): sqluri = mysql://root:mozroot@localhost/syncdb
Restart the Sync Server:
$ bin/paster serve development.ini
Notes: If you want to run the Sync Server outside of any login session, you can try the following:
$ nohup bin/paster server development.ini &
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
Re-building and Re-deploying the Sync Server
To re-build and re-deploy the sync server, you can try these steps:
Kill the Sync Server process $ kill -9 <Sync Server PID> (Leave MySQL running) Save the Sync Server directory and its contents (this in case you want to keep various snapshots) $ cd .. (one level up from server-full directory) $ 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
- NOTE: More specific redeployment ideas can be found on this great site:
For more information
For more advanced configurations, including web server support, please see the following documentation: http://docs.services.mozilla.com/howtos/run-sync.html
For a more technical overview of Sync Server and an introduction to Mozilla Services, please see the following documentation: http://docs.services.mozilla.com
Back To ==> Mozilla BT Services