[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
howtos:weave [2012/09/18 21:36 (UTC)] – created alienbobhowtos:weave [2012/09/26 00:56 (UTC)] (current) – deleted page - moved to the howtos:network_services section mfillpot
Line 1: Line 1:
-====== Setting Up Your Own Mozilla Sync Server ====== 
  
-//Mozilla Sync// is feature which is supported in Firefox since version 4. It allows you to store your bookmarks, browsing history, browser preferences, and saved passwords on a remote server. It even allows you to work on multiple computers and have the same Firefox configuration on all these computers. That’s a pretty cool feature. You can for instance setup sync on your Android phone’s Firefox browser and quickly configure it by entering your account-specific sync key. Moments later you will have your synced desktop browser configuration on your phone. 
- 
-Mozilla offers public sync servers. If you don't trust your passwords and browsing history in the hands of Mozilla (though your data is supposedly being encrypted with your unique sync key before it gets uploaded to Mozilla), then you can use this HOWTO for setting up your own Sync Server at home (or at work). 
- 
-Luckily, Mozilla is open as always and makes the Open Source Sync Server code available to everyone who wants to play with it. And setting it up is not difficult at all. 
- 
-Note: Mozilla have re-designed and re-written the original Sync Server (it was called “//Mozilla Weave Server//” at the time, and was almost impossible to setup). It is now written in Python, and the steps to create your own Sync Server are [[http://docs.services.mozilla.com/howtos/run-sync.html|described on this page]]. That page is what you should follow. The rest of this HOWTO tries to bring more detail to the process of configuring your Slackware box to become a real Sync Server. 
- 
-Of course  you want to install this on a Slackware server! 
- 
-===== Requirements ===== 
- 
-There are some explicit dependencies as mentioned on the [[http://docs.services.mozilla.com/howtos/run-sync.html|Mozilla page]]: 
-     * python 2.6 (part of Slackware 13.37. I have not tested with Slackware 14 which upgraded to python 2.7) 
-     * sqlite3 (already supplied by Slackware as well) 
-     * [[http://www.virtualenv.org/|virtualenv]]. Slackware packages can be downloaded here: [[http://slackware.com/~alien/slackbuilds/virtualenv/|http://slackware.com/~alien/slackbuilds/virtualenv/]] or built using the [[http://slackbuilds.org/python/virtualenv/|SlackBuilds.org script]] . 
- 
-Installing a virtualenv package is not really needed since it will be downloaded automatically during the “''make build''” command which you will run as part of the next step in the procedure. 
- 
-The Sync Server code is hosted in a Mercurial repository and since Slackware ships a Mercurial client, that code is easy to check out to a local directory where you continue to build the server binary: <code> 
-$ mkdir -p /usr/local/server-full 
-$ cd /usr/local/server-full 
-$ hg clone https://hg.mozilla.org/services/server-full/ . 
-$ make build 
-</code> Now, this server is ready to run, but unless you make some configuration changes it is not going to do much good: 
- 
-  * By default, the server stores your sync data in a sqlite database (you can use a real MySQL server database if you want), but it will create the sqlite database in ''/tmp'' which is entirely inappropriate. Further down you will find what you have to modify so that your clients’ sync data go somewhere less “volatile”. 
-  * The python-based Sync Server can run all by itself on a configurable port number (5000 by default) which is just fine if you are its only user in your little LAN. But even Mozilla advises to put a real webserver between you and the Sync Server. In Slackware you can use the apache webserver for this. You must install an additional apache module for this to work: [[http://code.google.com/p/modwsgi/|mod_wsgi]]. Slackware packages can be downloaded here: [[http://slackware.com/~alien/slackbuilds/mod_wsgi/|http://slackware.com/~alien/slackbuilds/mod_wsgi/]] . 
- 
-===== Configuration ===== 
- 
-  * Create a separate system user and group (''weave:sync'') which is going to run the Sync Server so that it can not interfere with Apache if anything goes crazy: <code> 
-# groupadd sync 
-# useradd -g sync weave 
-</code> If you omitted the creation of the home directory for this “''weave''” user account, then create it like this: <code> 
-# mkdir /home/weave 
-# chown weave:sync /home/weave 
-# chmod 711 /home/weave 
-</code> 
- 
-  * Create a new file "''/etc/httpd/extra/httpd-wsgi.conf''" with the following content (adapt to your actual sync server hostname): <code> 
-    <Directory /usr/local/server-full> 
-      Order deny,allow 
-      Allow from all 
-    </Directory> 
- 
-    <VirtualHost *:80> 
-      ServerName sync.myserver.net 
-      DocumentRoot /usr/local/server-full 
-      WSGIProcessGroup sync 
-      WSGIDaemonProcess sync user=weave group=sync processes=2 threads=25 
-      WSGIPassAuthorization On 
-      WSGIScriptAlias / /usr/local/server-full/sync.wsgi 
-      CustomLog /var/log/httpd/sync.myserver.net-access.log combined 
-      ErrorLog  /var/log/httpd/sync.myserver.net-error.log 
-    </VirtualHost> 
-</code> This tells apache that a script called “sync.wsgi” is going to be spawned as user “weave:sync” whenever a client connects to %%http://sync.myserver.net/%% . 
- 
-  * Modify your apache server's main configuration file "''/etc/httpd/httpd.conf''", in order to make it load the mod_wsgi module and use its configuration file. Add the following lines to the ''httpd.conf'': <code> 
-    # Activate the WSGI module (serving python binaries to the web): 
-    Include /etc/httpd/extra/mod_wsgi.conf 
-    # Act as a reverse proxy to the Mozilla Sync server: 
-    Include /etc/httpd/extra/httpd-wsgi.conf 
-</code> 
- 
-  * Check your Apache configuration for syntax errors which you may have introduced: <code> 
-# apachectl configtest 
-</code> 
- 
-  * Restart Apache: <code> 
-# /etc/rc.d/rc.httpd stop 
-# pause 3 
-# /etc/rc.d/rc.httpd stop 
-# /etc/rc.d/rc.httpd start 
-</code> 
- 
-  * Configure the Sync Server configuration files. 
-    * Inside the directory "''/usr/local/server-full''" (where the Sync Server code has been downloaded and built if you followed this HOWTO to the letter) you will find the aforementioned "''sync.wsgi''" script. Open the file in an editor. Read through the file and change it to something which you find better suited. For instance, change "''/tmp''" to "''/var/tmp''" in the line "''os.environ['PYTHON_EGG_CACHE'] = ‘/tmp/python-eggs’''": <code> 
-os.environ['PYTHON_EGG_CACHE'] = '/tmp/python-eggs' 
-</code> changes to  <code> 
-os.environ['PYTHON_EGG_CACHE'] = '/var/tmp/python-eggs' 
-</code> 
-    * Next, edit the file "''development.ini''" (that filename is configured in "''sync.wsgi''" in case you want to use another name). In that file change the location of the error logfile so that it is created in "''/var/tmp''". The line <code> 
-args = (‘/tmp/sync-error.log’,) 
-</code> changes to: <code> 
-args = ('/var/tmp/sync-error.log',) 
-</code> 
-    * The "''development.ini''" file also mentions the name of the actual sync configuration file "etc/sync.conf". Note that this path is relative to the Weave server’s root directory. It requires some editing! For instance, create the SQL database file in the "''weave''" user’s own home directory. The line <code> 
-sqluri = sqlite:////tmp/test.db 
-</code> becomes: <code> 
-sqluri = sqlite:////home/weave/my_weave_server.db 
-</code> The default value for the quota assigned to each sync account is too low (it’s set to 5 MB). Mozilla states that 99.9% of all clients which connect to its public server use less than 25 MB of quota, so use that value as a default. The line <code> 
-quota_size = 5120 
-</code> changes to: <code> 
-quota_size = 25600 
-</code> Then, look for the following line and make absolutely certain that it is changed to the Apache %%http://%% URL of your Sync Server, i.e. the URL that the sync clients are going to use: <code> 
-fallback_node = http://localhost:5000/ 
-</code> You can play with other options in this file to see what they can offer. For instance, you can disable "//captcha//" and not enable SSL, but you may decide that this is important to your setup. 
- 
-<note important>Don’t forget to restart your apache server if you have not yet done so.</note> 
- 
-===== USing the Sync Server ===== 
- 
-And now it is time to tell your Firefox browser to use this new service! 
- 
-  * Select “Tools > Setup sync ...”: {{ :howtos:weave:ff_sync_01.png }} 
- 
-  * In case this is the first time you talk to your Sync Server, you need to setup an account, so click the button “''Create a New Account''“. This opens a new dialog box where you can type your email address (this will become your account name), an associated password and then in the dropdown menu, do **not** select "''Firefox Sync Server''". Instead, you choose "''Use a custom server''". This allows you to enter the URL for your brand-new private Sync Server. \\  Once the account has been created, Firefox will show you the sync key it will be using to encrypt your data. That key is important, you will need it if you want to add more computers to your sync account. \\ And that’s basically it – the sync process will start immediately: {{ :howtos:weave:ff_sync_02.png }} 
- 
-  * Else if you already have a Sync Account and want to add a second computer to it, you can click on “''Connect''” in the first dialog which will open a new dialog. There are two ways to add this computer to your existing sync account: 
-    * Either you enter the code which is being shown on another computer which is already syncing to the server; 
-    * Or else you click on “''I don’t have the device with me''“. This is what you would usually do. It is cumbersome to search for another computer or hand-held if all you need to know is your sync key: {{ :howtos:weave:ff_sync_03.png }} 
- 
-  * If you know your sync key you can enter that in the following dialog, along with your account details and the server URL: {{ :howtos:weave:ff_sync_04.png }} 
- 
-The sync key which is associated with your sync account can be retrieved at any moment should you have forgotten to write it down. Just go to a computer which has been setup for Sync, and open your Firefox browser’s Preferences at the “''Sync''” tab. Under “''Manage your account''” you will find a menu item to display your key (as well as a way to change your account’s password). \\ More help can be found at [[http://support.mozilla.com/kb/what-firefox-sync|http://support.mozilla.com/kb/what-firefox-sync]] . 
- 
-==== Securing your Sync Server with SSL ==== 
- 
-FIXME - This section is coming soon! You really want your Sync server to be accessible over %%https://%% if you sync over the Internet. 
- 
- 
-====== Sources ====== 
-  * Originally written by [[wiki:user:alienbob | Eric Hameleers]] 
-  * Original source: [[http://alien.slackbook.org/blog/setting-up-your-own-mozilla-sync-server/|Alien Pastures Blog]] 
- 
-<!-- Please do not modify anything below, except adding new tags.--> 
-{{tag>howtos software sync weave author_alienbob slackware_13.37}} 
 howtos:weave ()