QA/Sync/Sync Server Install CentOS
Back To ==> Mozilla BT Services
Contents
Notes for Installing Sync Server on CentOS 6
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
These are the instructions for install Sync Server and FireFox on CentOS 6 64-bit OS
- The following packages will need to be installed:
- Mecurial
- sqlite3
- MySQL (optional - if you do not want to use Sqlite3)
- Python 2.6.6
- Python 2.6.6 virtualenv
- Python 2.6.6 SetupTools
- Python 2.6.6 Developer Tools
- Verify that sqlite was already installed
$ which sqlite3 $ sqlite3 --version
- Install the latest version of mercurial
$ yum install mercurial $ which hg $ hg --version 1.4
- Install the required development tools and libraries
$ yum groupinstall 'Development Tools' 'Development Libraries' $ yum install tk-devel libjpeg-devel mysql-devel python-devel httpd-devel zlib-devel bzip2-devel
- Install Python 2.6.6 in $home (in case it is needed)
$ cd $home $ sudo wget http://python.org/ftp/python/2.6.6/Python-2.6.6.tgz $ sudo tar xzvf Python-2.6.6.tgz
- Build Python 2.6.6
$ cd $home/Python-2.6.6 $ sudo ./configure --prefix=/opt/python2.6 --enable-thread --enable-shared --enable-unicode=ucs4 $ sudo make $ sudo make install
- Now clone and build the Sync Server
$ hg clone https://hg.mozilla.org/services/server-full $ cd server-full $ make build
- Start the Sync Server and verify it works properly
$ bin/paster serve development.ini You should see something like this: Starting server in PID 5952. serving on 0.0.0.0:5000 view at http://127.0.0.1:5000
- If the previous step isn't working, you may find that you need to run
$ python setup.py develop
- from the server-full directory, and then
$ make build
- and run
$ python setup.py develop
- in each of the three directories contained within the server-full/deps/ : server-core, server-reg, and server-storage. These seem to be services that the Sync Server relies on.
- Stop the server to continue the installations (if needed)
ctrl-c
- Install MySQL
MySQL, mysql-devel, and libmysqlclient-dev should already be installed on CentOS 6
$ which mysql $ mysql --version
If need, you can just run the following:
$ yum install mysql-server, mysql-devel, and libmysqlclient-dev (or similar)
- Install MySQL-Python
Run the following:
$ cd $home $ cd server-full $ bin/easy_install Mysql-Python
- Verify mysql-server is running or start it up
$ sudo /etc/init.d/mysqld start
- Set the MySQL root/user password:
$ /usr/bin/mysqladmin -u root password 'new-password' $ /usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password' where 'new-password' is the password you have chosen for 'root'
- Ran the following to enter mysql:
$ mysql -u root -p (password should be 'new-password' above)
- Create a database for use with SyncServer
mysql> CREATE DATABASE syncdb; mysql>\quit
- Edit the server-full/etc/sync.conf file to use mysql instead of sqlite3
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 and verify it works properly
$ bin/paster serve deployment.ini You should see something like this: Starting server in PID 5952. serving on 0.0.0.0:5000 view at http://127.0.0.1:5000
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
Restarting MySQL after system boot/restart
If needed, one of the following sets of steps can be followed
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
Downloading and Installing FireFox 5
By default CentOS 6 comes with FireFox 3.6. In order to use Sync Server, you should have FireFox 5.
$ 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 $ ./firefox Verify that FireFox runs properly and is version 5.01 or newer
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
- NOTE: More specific redeployment ideas can be found on this great site:
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