Mozilla Sync
Jan 28, 2018 Step 1, Open Mozilla Firefox. Click the icon on your desktop to launch the browser.Step 2, Open the Options window. Click on “Tools” on the menu toolbar at the upper part of the window and select “Options.”Step 3, Click on the “Sync” tab. Mozilla Sync app Simple ownCloud app integrating the Mozilla Sync API. It allows users to synchronize Firefox data (e.g. Bookmarks, passwords, history.) using their ownCloud server. Open the menu in the top right of Firefox and select “Sign in to Sync”. Click “Get started” in the tab that opens. Enter an email address and password to “Create a Firefox Account.”.
The Firefox Sync Server is deployed on our systems using RPM packaging,and we don’t provide any other packaging or publish official RPMs yet.
The easiest way to install a Sync Server is to checkout our repositoryand run a build in-place. Once this is done, Sync can be run behindany Web Server that supports the WSGI protocol.
Important Notes¶
These instructions are for the sync-1.5 server protocol used by thethe new sync service inFirefox 29 and later. For a server compatible with earlier versions ofFirefox, see howto_run_sync11.
The new sync service uses Firefox Accounts for user authentication, which is a separate service and isnot covered by this guide.
Note
By default, a server set up using this guide will defer authenticationto the Mozilla-hosted accounts server at https://accounts.firefox.com.
You can safely use the Mozilla-hosted Firefox Accounts server in combinationwith a self-hosted sync storage server. The authentication and encryptionprotocols are designed so that the account server does not know the user’splaintext password, and therefore cannot access their stored sync data.
Alternatively, you can also Run your own Firefox Accounts Server to control all aspects of thesystem. The process for doing so is currently very experimental and not welldocumented.
Prerequisites¶
The various parts are using Python 2.7 and Virtualenv. Make sure yoursystem has them, or install them:
- Python 2.7 downloads: http://python.org/download/releases/2.7.6
- Virtualenv: http://pypi.python.org/pypi/virtualenv
To build and run the server, you will also need to have these packagesinstalled:
- python-dev
- make
- git
- c and c++ compiler
For example, under a fresh Ubuntu, you can run this command to meet allrequirements:
Building the server¶
Get the latest version at https://github.com/mozilla-services/syncserver andrun the build command:
This command will create an isolated Python environment and pull all therequired dependencies in it. A local/bin directory is created and containsa gunicorn command that can be used to run the server.
If you like, you can run the testsuite to make sure everything is workingproperly:
Basic Configuration¶
The server is configured using an ini-like file to specify various runtimesettings. The file “syncserver.ini” will provide a useful starting point.
There is one setting that you must specify before running the server: theclient-visible URL for the service. Open “./syncserver.ini” and locate thefollowing lines:
The default value of “public_url” will work for testing purposes on your localmachine. For final deployment, change it to the external, publicly-visible URLof your server.
By default the server will use an in-memory database for storage, meaning thatany sync data will be lost on server restart. You will almost certainly wantto configure a more permanent database, which can be done with the “sqluri”setting:
This setting will accept any SQLAlchemydatabase URI; for example the following would connect to a mysql server:
Running the Server¶
Now you can run the server using gunicorn and the provided “syncserver.ini”file. The simplest way is to use the Makefile like this:
Or if you’d like to pass additional arguments to gunicorn, like this:
Once the server is launched, you need to tell Firefox about its location.
To configure desktop Firefox to talk to your new Sync server, go to“about:config”, search for “identity.sync.tokenserver.uri” and change its valueto be the public URL of your server with a path of “token/1.0/sync/1.5”:
- identity.sync.tokenserver.uri: http://localhost:5000/token/1.0/sync/1.5
Alternatively, if you’re running your own Firefox Accounts server, and runningFirefox 52 or later, see the documentation on how to Run your own Firefox Accounts Server forhow to configure your client for both Sync and Firefox Accounts with a singlepreference.
Firefox for Android (“Daylight”, versions 79 and later) does support using anon-Mozilla-hosted Sync server. Before logging in, go to App Menu > Settings> About Firefox and click the logo 5 times. You should see a “debug menu enabled”notification. Go back to the main menu and you will see two options for a customaccount server and a custom Sync server. Set the Sync server to the URL givenabove and then log in.
To configure Android Firefox 44 up to 78 to talk to your new Sync server, just setthe “identity.sync.tokenserver.uri” exactly as above before signing in toFirefox Accounts and Sync on your Android device.
Important: after creating the Android account, changes to“identity.sync.tokenserver.uri” will be ignored. (If you need to change theURI, delete the Android account using the Settings > Sync > Disconnect… menuitem, update the pref, and sign in again.) Non-default TokenServer URLs aredisplayed in the Settings > Sync panel in Firefox for Android, so you shouldbe able to verify your URL there.
Prior to Firefox 44, a custom add-on was needed to configure Firefox forAndroid. For Firefox 43 and earlier, see the blog post How to connect Firefoxfor Android to self-hosted Firefox Account and Firefox Sync servers.
(Prior to Firefox 42, the TokenServer preference name for Firefox Desktop was“services.sync.tokenServerURI”. While the old preference name will work inFirefox 42 and later, the new preference is recommended as the old preferencename will be reset when the user signs out from Sync causing potentialconfusion.)
Since Firefox 18, Firefox for iOS has support for custom sync servers. The settingscan be made in the Advanced Sync Settings in the Firefox account section, which arevisible if you are not signed in with a Firefox account and have enabled the debug mode(tap 5 times on the version number). In order to use the custom sync server with Firefox 28,the token server’s url must not contain the path “/1.0/sync/1.5”. It is also important toconfigure a custom FxA content server (you may use the default https://accounts.firefox.com).
Further Configuration¶
Once the server is running and Firefox is syncing successfully, there arefurther configuration options you can tweak in the “syncserver.ini” file.
The “secret” setting is used by the server to generate cryptographically-signedauthentication tokens. It is blank by default, which means the server willrandomly generate a new secret at startup. For long-lived server installationsthis should be set to a persistent value, generated from a good source ofrandomness. An easy way to generate such a value on posix-style systemsis to do:
Then copy-paste the value into the config file like so:
The “identity_provider” setting controls which server service can issueidentity assertions for access to the service. By default it will acceptidentity assertions from the Mozilla-hosted account server athttps://accounts.firefox.com. If you are hosting your own instance ofFirefox Accounts, you should change this to your own domain:
The “allow_new_users” setting controls whether the server will acceptrequests from previously-unseen users. It is allowed by default, but onceyou have configured Firefox and successfully synced with your user account,additional users can be disabled by setting:
Updating the server¶
You should periodically update your code to make sure you’ve got the latestfixes. The following commands will update syncserver in place:
Running behind a Web Server¶
The built-in server should not be used in production, as it does not reallysupport a lot of load.
If you want to set up a production server, you can use different web serversthat are compatible with the WSGI protocol. For example:
- Apache combined with mod_wsgi
- NGinx with Gunicorn or uWSGI
Note
Remember, you must set the syncserver.public_url option to theclient-visible URL of your server.
For example, if your server will be located at http://example.com/ff-sync/,the public_url should be set to this value in your config file:
Apache + mod_wsgi¶
Here’s an example of an Apache 2.2 setup that uses mod_wsgi:
Here’s the equivalent setup for Apache 2.4, which uses a different syntaxfor access control:
We provide a syncserver.wsgi file for your convenience in the repository.Before running Apache, edit the file and check that it loads the the right.ini file with its full path.
Some users have reported issues with outbound TLS connections when runningunder Apache. If your server is giving 503 errors and the Apache error logmentions “SysCallError”, you may be able to correct the problem by installingthe pyopenssl library:
Nginx + Gunicorn¶
Tested with debian stable/squeeze
First install gunicorn in the syncserver python environment:
Then enable gunicorn in the syncserver.ini file:
Finally edit your nginx vhost file:
- After restarting your nginx and syncserver you should be able to use thesync server behind your nginx installation
Note
If you see errors about a mismatch between public_url andapplication_url, you may need to tell gunicorn that it should trustthe X-Forwarded-Proto header being sent by nginx. Add the followingto the gunicorn configuration in syncserver.ini:
Mozilla Sync Bookmarks
Note
If you see errors about “client sent too long header line” in yournginx logs, you may need to configure nginx to allow large client headerbuffers by adding this to the nginx config:
Nginx + uWSGI¶
Mozilla Sync Bookmarks
Install uWSGI and its Python 2 plugin
Start it with the following options:
Use the following nginx configuration:
Things that still need to be Documented¶
- periodic pruning of expired sync data
Asking for help¶
Don’t hesitate to jump online and ask us for help:
- on IRC (irc.mozilla.org) in the #sync channel
- in our Mailing List: https://mail.mozilla.org/listinfo/sync-dev
Your indispensable test assistant.
Mozilla Sync Server
With each web page, device and browser, testing time grows exponentially. From live reloads to URL pushing, form replication to click mirroring, Browsersync cuts out repetitive manual tasks. It’s like an extra pair of hands. Customise an array of sync settings from the UI or command line to create a personalised test environment. Need more control? Browsersync is easily integrated with your web platform, build tools, and other Node.js projects.
Integrates with your current build tools like Gulp & Grunt
Awesome Features
Built on Node.JS_ENTRY to support Windows, MacOS and Linux. Setup in less than 5 minutes.
Browsersync is an open source project available to use under the Apache 2.0 License.
Easily integrated with task runners like Grunt and Gulp, or included in other Node projects.
Mozilla Sync
Test your website against a slower connection. Even when devices are connected to wifi.
Your scroll, click, refresh and form actions are mirrored between browsers while you test.
Browsers are automatically updated as you change HTML, CSS, images and other project files.
Run the new browser-based UI for quick control, or stick with the original command line usage.
Mozilla Sync Tabs
Toggle individual sync settings to create your preferred test environment.
Records your test URLs so you can push them back out to all devices with a single click.
An open source project by JH
BrowserSync is an open-source project created and maintained by the front-end designers/developers at JH. Together with contributors from all over the world, we aim to make modern, multi-device web development faster & easier.
Tried and trusted.
Dave Rupert
Want to feel like a modern day demigod? Fire up Browsersync and control an entire device lab with your phone.
Paravel and Shop Talk Show
Addy Osmani
It has a fantastic feature-set and at least 5 developers I’ve spoken to this week alone swear by it for their own synchronized cross-device testing.
Google and addyosmani.com
Get started in 5 minutes.
1. Install Node.js
Browsersync is a module for Node.js, a platform for fast network applications. There are convenient installers for MacOS, Windows and Linux.
2. Install Browsersync
The Node.js package manager (npm) is used to install Browsersync from a repository. Open a terminal window and run the following command:
You’re telling the package manager to download the Browsersync files and install them globally so they’re available to all your projects.
3. Start Browsersync
A basic use is to watch all CSS files in the
css
directory and update connected browsers if a change occurs. Navigate your terminal window to a project and run the appropriate command:Static sites
If you’re only using
.html
files, you’ll need to use the server mode. Browsersync will start a mini-server and provide a URL to view your site.Dynamic sites
If you’re already running a local server with PHP or similar, you’ll need to use the proxy mode. Browsersync will wrap your vhost with a proxy URL to view your site.