https://wiki.archlinux.org/api.php?action=feedcontributions&user=Caneylan&feedformat=atomArchWiki - User contributions [en]2024-03-28T12:58:15ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Firefox_Sync_Server&diff=239996Firefox Sync Server2012-12-12T02:46:43Z<p>Caneylan: /* Automatic Startup of the Server */</p>
<hr />
<div>[[Category:Web Server]]<br />
This page is about special operations required in order to install Mozilla Sync Server.<br />
<br />
Newer versions of Mozilla Firefox feature bookmarks, passwords, settings and browsing history synchronization between all your computers and devices. Mozilla Foundation provides a public Sync server, but you can host your own one if you want.<br />
==Prerequisites==<br />
===Dependencies===<br />
Before proceeding, you need to [[pacman|install]] {{pkg|python2}}, {{pkg|python2-virtualenv}}, {{pkg|sqlite3}}, {{pkg|mercurial}} and {{pkg|make}}, all available in the [[official repositories]].<br />
===Accessibility===<br />
If you intend to use your server with itinerant clients, you should install it on an Internet reachable computer.<br />
===Administration Rights===<br />
All installation instructions are commands relying on the superuser privileges, so open a terminal and type:<br />
{{bc|<br />
$ su -<br />
Password: <br />
# <br />
}}<br />
<br />
==Installation==<br />
Mozilla Sync Server depends on Python 2 during installation. Arch Linux provides Python 3 as default Python version so there are special tweaks needed before running Mozilla Sync Server setup.<br />
Setup process creates an isolated Python environment in which all necessary dependencies are downloaded and installed. Afterwards, running the server only relies on the isolated Python environment, independently of the system-wide Python.<br />
===Python preparation===<br />
Mozilla Sync Server setup needs Python 2.6 or newer. In default configuration, {{ic|/usr/bin/python}} is a symbolic link to {{ic|/usr/bin/python3}} whereas Python 2 is {{ic|/usr/bin/python2}}.<br />
<br />
Before running setup, we must check the link and change it if necessary:<br />
{{bc|<br />
# cd /usr/bin<br />
# ls -l python<br />
<br />
lrwxrwxrwx 1 root root 7 5 sept. 07:04 python -> python3<br />
<br />
# ls -l virtualenv<br />
<br />
ls: cannot access virtualenv: No such file or directory<br />
<br />
# ln -sf python2 python<br />
# ln -sf virtualenv2 virtualenv<br />
}}<br />
<br />
===Setup===<br />
Installation instructions:<br />
{{bc|<br />
# mkdir -p /opt/weave<br />
# cd /opt/weave<br />
# hg clone https://hg.mozilla.org/services/server-full<br />
<br />
... source repository cloning messages ...<br />
<br />
# cd server-full<br />
# make build<br />
<br />
... many build messages, including harmless warnings ...<br />
<br />
... end of the successful build messages:<br />
<br />
Building the app <br />
Checking the environ [ok]<br />
Updating the repo [ok]<br />
Building Services dependencies <br />
Getting server-core [ok]<br />
Getting server-reg [ok]<br />
Getting server-storage [ok] [ok]<br />
Building External dependencies [ok]<br />
Now building the app itself [ok]<br />
[done]<br />
<br />
}}<br />
<br />
Check the end of the build messages, they should state "[done]". Otherwise, look at the first error messages, they give you hints on the problem and how to solve it.<br />
<br />
===Python initial state restoration===<br />
Once the build is finished, restore the links in {{ic|/usr/bin}} to their original state.<br />
{{bc|<br />
# cd /usr/bin<br />
# ln -sf python3 python<br />
# rm -f virtualenv<br />
}}<br />
<br />
==Configuration==<br />
===Server-side configuration files===<br />
Configuration files are used to define where databases and logs will be created.<br />
We will place databases in {{ic|/opt/weave/data}} and log files in {{ic|/var/log/weave}}, so we must create the directories.<br />
# mkdir /opt/weave/data /var/log/weave<br />
<br />
At least two configuration files must be changed in {{ic|/opt/weave/server-full}} in order to reflect these choices: {{ic|development.ini}} and {{ic|etc/sync.conf}}.<br />
<br />
In {{ic|development.ini}}, locate the line:<br />
{{bc|1=<br />
args = ('/tmp/sync-error.log',)<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
args = ('/var/log/weave/sync-error.log',)<br />
}}<br />
<br />
In {{ic|etc/sync.conf}}, locate the line:<br />
{{bc|1=<br />
sqluri = sqlite:////tmp/test.db<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
sqluri = sqlite:////opt/weave/data/sync.db<br />
}}<br />
This statement appears twice in the file, both should be modified.<br />
<br />
Bump the disk quota from 5 to 25 MB:<br />
{{bc|1=<br />
quota_size = 25600<br />
}}<br />
The fallback node URL must reflect the server's hostname (here {{ic|server-name.domain-name}}). <br />
Change:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://localhost:5000/</nowiki><br />
}}<br />
to:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://server-name.domain-name:5000/</nowiki><br />
}}<br />
<br />
===Unprivileged User===<br />
It is a good practice to run daemons as an unprivileged user. Create the group {{ic|weave}} and the user {{ic|sync}} for that purpose:<br />
{{bc|<br />
# groupadd weave<br />
# useradd -d /opt/weave -g weave -r -s /bin/bash sync<br />
}}<br />
This new user must have read and write access on every file in {{ic|/opt/weave}} and {{ic|/var/log/weave}}<br />
# chown -R sync:weave /opt/weave/*<br />
# chown -R sync:weave /var/log/weave<br />
<br />
===Automatic Startup of the Server===<br />
In order to make the Sync Server start automatically at boot-time, create a startup script:<br />
{{hc|<br />
/etc/rc.d/mozillaweave|<nowiki><br />
#!/bin/bash<br />
<br />
RUNDIR=/var/run/weave<br />
DAEMON=/opt/weave/bin/python<br />
PIDFILE=/var/run/weave.pid<br />
MESSAGELOG=/var/log/weave/sync-messages.log<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
PID=`pidof -x -o %PPID paster`<br />
case "$1" in<br />
start)<br />
stat_busy "Starting Mozilla Sync Server"<br />
[ -d $RUNDIR ] || mkdir $RUNDIR<br />
[ -z "$PID" ] && su sync -c "cd /opt/weave/server-full && bin/paster serve development.ini &>$MESSAGELOG &"<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
PID=`pidof -x -o %PPID paster`<br />
echo $PID >$PIDFILE<br />
add_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping Mozilla Sync Server"<br />
[ ! -z "$PID" ] && kill $PID &>/dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
rm_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {start|stop|restart}" <br />
esac<br />
exit 0<br />
</nowiki><br />
}}<br />
The script must have execution rights:<br />
# chmod 755 /etc/rc.d/mozillaweave<br />
Start the Sync Server at boot by including {{ic|mozillaweave}} in the [[Daemon]] list. It depends on the network so it should be placed accordingly.<br />
<br />
For systemd:<br />
{{hc|<br />
/etc/systemd/system/mozillaweave.service|<nowiki><br />
[Unit]<br />
Description=Mozilla Weave<br />
After=network.target<br />
<br />
[Service]<br />
Type=simple<br />
User=sync<br />
WorkingDirectory=/opt/weave/server-full<br />
ExecStart=/opt/weave/server-full/bin/python2 /opt/weave/server-full/bin/paster serve /opt/weave/server-full/development.ini<br />
StandardOutput=/var/log/weave/sync-messages.log<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
Alias=mozillaweave.service<br />
</nowiki><br />
}}<br />
<br />
Test start the server using:<br />
{{bc|<br />
# systemctl start mozillaweave<br />
# systemctl status mozillaweave<br />
}}<br />
<br />
Set the Sync Server to start at boot with: <br />
{{bc|<br />
# systemctl enable mozillaweave<br />
}}<br />
<br />
===Client-side configuration===<br />
Use the Sync Configuration Wizard in Firefox' Settings to create a new account on the server. Don't forget to choose "Custom server..." in the list, and input the server address: {{ic|<nowiki>http://server-name.domain-name:5000/</nowiki>}}<br />
<br />
The "Advanced Settings" button allows fine tuning of the synchronized elements list, and the definition of the client hostname.<br />
==See also==<br />
* [http://docs.services.mozilla.com/howtos/run-sync.html Mozilla Sync Server Howto]<br />
* [http://alien.slackbook.org/blog/setting-up-your-own-mozilla-sync-server/ Great tutorial, by Eric Hameleers]</div>Caneylanhttps://wiki.archlinux.org/index.php?title=Firefox_Sync_Server&diff=239994Firefox Sync Server2012-12-12T02:33:52Z<p>Caneylan: /* Python initial state restoration */</p>
<hr />
<div>[[Category:Web Server]]<br />
This page is about special operations required in order to install Mozilla Sync Server.<br />
<br />
Newer versions of Mozilla Firefox feature bookmarks, passwords, settings and browsing history synchronization between all your computers and devices. Mozilla Foundation provides a public Sync server, but you can host your own one if you want.<br />
==Prerequisites==<br />
===Dependencies===<br />
Before proceeding, you need to [[pacman|install]] {{pkg|python2}}, {{pkg|python2-virtualenv}}, {{pkg|sqlite3}}, {{pkg|mercurial}} and {{pkg|make}}, all available in the [[official repositories]].<br />
===Accessibility===<br />
If you intend to use your server with itinerant clients, you should install it on an Internet reachable computer.<br />
===Administration Rights===<br />
All installation instructions are commands relying on the superuser privileges, so open a terminal and type:<br />
{{bc|<br />
$ su -<br />
Password: <br />
# <br />
}}<br />
<br />
==Installation==<br />
Mozilla Sync Server depends on Python 2 during installation. Arch Linux provides Python 3 as default Python version so there are special tweaks needed before running Mozilla Sync Server setup.<br />
Setup process creates an isolated Python environment in which all necessary dependencies are downloaded and installed. Afterwards, running the server only relies on the isolated Python environment, independently of the system-wide Python.<br />
===Python preparation===<br />
Mozilla Sync Server setup needs Python 2.6 or newer. In default configuration, {{ic|/usr/bin/python}} is a symbolic link to {{ic|/usr/bin/python3}} whereas Python 2 is {{ic|/usr/bin/python2}}.<br />
<br />
Before running setup, we must check the link and change it if necessary:<br />
{{bc|<br />
# cd /usr/bin<br />
# ls -l python<br />
<br />
lrwxrwxrwx 1 root root 7 5 sept. 07:04 python -> python3<br />
<br />
# ls -l virtualenv<br />
<br />
ls: cannot access virtualenv: No such file or directory<br />
<br />
# ln -sf python2 python<br />
# ln -sf virtualenv2 virtualenv<br />
}}<br />
<br />
===Setup===<br />
Installation instructions:<br />
{{bc|<br />
# mkdir -p /opt/weave<br />
# cd /opt/weave<br />
# hg clone https://hg.mozilla.org/services/server-full<br />
<br />
... source repository cloning messages ...<br />
<br />
# cd server-full<br />
# make build<br />
<br />
... many build messages, including harmless warnings ...<br />
<br />
... end of the successful build messages:<br />
<br />
Building the app <br />
Checking the environ [ok]<br />
Updating the repo [ok]<br />
Building Services dependencies <br />
Getting server-core [ok]<br />
Getting server-reg [ok]<br />
Getting server-storage [ok] [ok]<br />
Building External dependencies [ok]<br />
Now building the app itself [ok]<br />
[done]<br />
<br />
}}<br />
<br />
Check the end of the build messages, they should state "[done]". Otherwise, look at the first error messages, they give you hints on the problem and how to solve it.<br />
<br />
===Python initial state restoration===<br />
Once the build is finished, restore the links in {{ic|/usr/bin}} to their original state.<br />
{{bc|<br />
# cd /usr/bin<br />
# ln -sf python3 python<br />
# rm -f virtualenv<br />
}}<br />
<br />
==Configuration==<br />
===Server-side configuration files===<br />
Configuration files are used to define where databases and logs will be created.<br />
We will place databases in {{ic|/opt/weave/data}} and log files in {{ic|/var/log/weave}}, so we must create the directories.<br />
# mkdir /opt/weave/data /var/log/weave<br />
<br />
At least two configuration files must be changed in {{ic|/opt/weave/server-full}} in order to reflect these choices: {{ic|development.ini}} and {{ic|etc/sync.conf}}.<br />
<br />
In {{ic|development.ini}}, locate the line:<br />
{{bc|1=<br />
args = ('/tmp/sync-error.log',)<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
args = ('/var/log/weave/sync-error.log',)<br />
}}<br />
<br />
In {{ic|etc/sync.conf}}, locate the line:<br />
{{bc|1=<br />
sqluri = sqlite:////tmp/test.db<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
sqluri = sqlite:////opt/weave/data/sync.db<br />
}}<br />
This statement appears twice in the file, both should be modified.<br />
<br />
Bump the disk quota from 5 to 25 MB:<br />
{{bc|1=<br />
quota_size = 25600<br />
}}<br />
The fallback node URL must reflect the server's hostname (here {{ic|server-name.domain-name}}). <br />
Change:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://localhost:5000/</nowiki><br />
}}<br />
to:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://server-name.domain-name:5000/</nowiki><br />
}}<br />
<br />
===Unprivileged User===<br />
It is a good practice to run daemons as an unprivileged user. Create the group {{ic|weave}} and the user {{ic|sync}} for that purpose:<br />
{{bc|<br />
# groupadd weave<br />
# useradd -d /opt/weave -g weave -r -s /bin/bash sync<br />
}}<br />
This new user must have read and write access on every file in {{ic|/opt/weave}} and {{ic|/var/log/weave}}<br />
# chown -R sync:weave /opt/weave/*<br />
# chown -R sync:weave /var/log/weave<br />
<br />
===Automatic Startup of the Server===<br />
In order to make the Sync Server start automatically at boot-time, create a startup script:<br />
{{hc|<br />
/etc/rc.d/mozillaweave|<nowiki><br />
#!/bin/bash<br />
<br />
RUNDIR=/var/run/weave<br />
DAEMON=/opt/weave/bin/python<br />
PIDFILE=/var/run/weave.pid<br />
MESSAGELOG=/var/log/weave/sync-messages.log<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
PID=`pidof -x -o %PPID paster`<br />
case "$1" in<br />
start)<br />
stat_busy "Starting Mozilla Sync Server"<br />
[ -d $RUNDIR ] || mkdir $RUNDIR<br />
[ -z "$PID" ] && su sync -c "cd /opt/weave/server-full && bin/paster serve development.ini &>$MESSAGELOG &"<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
PID=`pidof -x -o %PPID paster`<br />
echo $PID >$PIDFILE<br />
add_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping Mozilla Sync Server"<br />
[ ! -z "$PID" ] && kill $PID &>/dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
rm_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {start|stop|restart}" <br />
esac<br />
exit 0<br />
</nowiki><br />
}}<br />
The script must have execution rights:<br />
# chmod 755 /etc/rc.d/mozillaweave<br />
Start the Sync Server at boot by including {{ic|mozillaweave}} in the [[Daemon]] list. It depends on the network so it should be placed accordingly.<br />
===Client-side configuration===<br />
Use the Sync Configuration Wizard in Firefox' Settings to create a new account on the server. Don't forget to choose "Custom server..." in the list, and input the server address: {{ic|<nowiki>http://server-name.domain-name:5000/</nowiki>}}<br />
<br />
The "Advanced Settings" button allows fine tuning of the synchronized elements list, and the definition of the client hostname.<br />
==See also==<br />
* [http://docs.services.mozilla.com/howtos/run-sync.html Mozilla Sync Server Howto]<br />
* [http://alien.slackbook.org/blog/setting-up-your-own-mozilla-sync-server/ Great tutorial, by Eric Hameleers]</div>Caneylanhttps://wiki.archlinux.org/index.php?title=Firefox_Sync_Server&diff=239993Firefox Sync Server2012-12-12T02:33:15Z<p>Caneylan: /* Python initial state restoration */</p>
<hr />
<div>[[Category:Web Server]]<br />
This page is about special operations required in order to install Mozilla Sync Server.<br />
<br />
Newer versions of Mozilla Firefox feature bookmarks, passwords, settings and browsing history synchronization between all your computers and devices. Mozilla Foundation provides a public Sync server, but you can host your own one if you want.<br />
==Prerequisites==<br />
===Dependencies===<br />
Before proceeding, you need to [[pacman|install]] {{pkg|python2}}, {{pkg|python2-virtualenv}}, {{pkg|sqlite3}}, {{pkg|mercurial}} and {{pkg|make}}, all available in the [[official repositories]].<br />
===Accessibility===<br />
If you intend to use your server with itinerant clients, you should install it on an Internet reachable computer.<br />
===Administration Rights===<br />
All installation instructions are commands relying on the superuser privileges, so open a terminal and type:<br />
{{bc|<br />
$ su -<br />
Password: <br />
# <br />
}}<br />
<br />
==Installation==<br />
Mozilla Sync Server depends on Python 2 during installation. Arch Linux provides Python 3 as default Python version so there are special tweaks needed before running Mozilla Sync Server setup.<br />
Setup process creates an isolated Python environment in which all necessary dependencies are downloaded and installed. Afterwards, running the server only relies on the isolated Python environment, independently of the system-wide Python.<br />
===Python preparation===<br />
Mozilla Sync Server setup needs Python 2.6 or newer. In default configuration, {{ic|/usr/bin/python}} is a symbolic link to {{ic|/usr/bin/python3}} whereas Python 2 is {{ic|/usr/bin/python2}}.<br />
<br />
Before running setup, we must check the link and change it if necessary:<br />
{{bc|<br />
# cd /usr/bin<br />
# ls -l python<br />
<br />
lrwxrwxrwx 1 root root 7 5 sept. 07:04 python -> python3<br />
<br />
# ls -l virtualenv<br />
<br />
ls: cannot access virtualenv: No such file or directory<br />
<br />
# ln -sf python2 python<br />
# ln -sf virtualenv2 virtualenv<br />
}}<br />
<br />
===Setup===<br />
Installation instructions:<br />
{{bc|<br />
# mkdir -p /opt/weave<br />
# cd /opt/weave<br />
# hg clone https://hg.mozilla.org/services/server-full<br />
<br />
... source repository cloning messages ...<br />
<br />
# cd server-full<br />
# make build<br />
<br />
... many build messages, including harmless warnings ...<br />
<br />
... end of the successful build messages:<br />
<br />
Building the app <br />
Checking the environ [ok]<br />
Updating the repo [ok]<br />
Building Services dependencies <br />
Getting server-core [ok]<br />
Getting server-reg [ok]<br />
Getting server-storage [ok] [ok]<br />
Building External dependencies [ok]<br />
Now building the app itself [ok]<br />
[done]<br />
<br />
}}<br />
<br />
Check the end of the build messages, they should state "[done]". Otherwise, look at the first error messages, they give you hints on the problem and how to solve it.<br />
<br />
===Python initial state restoration===<br />
Once the build is finished, restore the links in /usr/bin to their original state.<br />
{{bc|<br />
# cd /usr/bin<br />
# ln -sf python3 python<br />
# rm -f virtualenv<br />
}}<br />
<br />
==Configuration==<br />
===Server-side configuration files===<br />
Configuration files are used to define where databases and logs will be created.<br />
We will place databases in {{ic|/opt/weave/data}} and log files in {{ic|/var/log/weave}}, so we must create the directories.<br />
# mkdir /opt/weave/data /var/log/weave<br />
<br />
At least two configuration files must be changed in {{ic|/opt/weave/server-full}} in order to reflect these choices: {{ic|development.ini}} and {{ic|etc/sync.conf}}.<br />
<br />
In {{ic|development.ini}}, locate the line:<br />
{{bc|1=<br />
args = ('/tmp/sync-error.log',)<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
args = ('/var/log/weave/sync-error.log',)<br />
}}<br />
<br />
In {{ic|etc/sync.conf}}, locate the line:<br />
{{bc|1=<br />
sqluri = sqlite:////tmp/test.db<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
sqluri = sqlite:////opt/weave/data/sync.db<br />
}}<br />
This statement appears twice in the file, both should be modified.<br />
<br />
Bump the disk quota from 5 to 25 MB:<br />
{{bc|1=<br />
quota_size = 25600<br />
}}<br />
The fallback node URL must reflect the server's hostname (here {{ic|server-name.domain-name}}). <br />
Change:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://localhost:5000/</nowiki><br />
}}<br />
to:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://server-name.domain-name:5000/</nowiki><br />
}}<br />
<br />
===Unprivileged User===<br />
It is a good practice to run daemons as an unprivileged user. Create the group {{ic|weave}} and the user {{ic|sync}} for that purpose:<br />
{{bc|<br />
# groupadd weave<br />
# useradd -d /opt/weave -g weave -r -s /bin/bash sync<br />
}}<br />
This new user must have read and write access on every file in {{ic|/opt/weave}} and {{ic|/var/log/weave}}<br />
# chown -R sync:weave /opt/weave/*<br />
# chown -R sync:weave /var/log/weave<br />
<br />
===Automatic Startup of the Server===<br />
In order to make the Sync Server start automatically at boot-time, create a startup script:<br />
{{hc|<br />
/etc/rc.d/mozillaweave|<nowiki><br />
#!/bin/bash<br />
<br />
RUNDIR=/var/run/weave<br />
DAEMON=/opt/weave/bin/python<br />
PIDFILE=/var/run/weave.pid<br />
MESSAGELOG=/var/log/weave/sync-messages.log<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
PID=`pidof -x -o %PPID paster`<br />
case "$1" in<br />
start)<br />
stat_busy "Starting Mozilla Sync Server"<br />
[ -d $RUNDIR ] || mkdir $RUNDIR<br />
[ -z "$PID" ] && su sync -c "cd /opt/weave/server-full && bin/paster serve development.ini &>$MESSAGELOG &"<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
PID=`pidof -x -o %PPID paster`<br />
echo $PID >$PIDFILE<br />
add_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping Mozilla Sync Server"<br />
[ ! -z "$PID" ] && kill $PID &>/dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
rm_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {start|stop|restart}" <br />
esac<br />
exit 0<br />
</nowiki><br />
}}<br />
The script must have execution rights:<br />
# chmod 755 /etc/rc.d/mozillaweave<br />
Start the Sync Server at boot by including {{ic|mozillaweave}} in the [[Daemon]] list. It depends on the network so it should be placed accordingly.<br />
===Client-side configuration===<br />
Use the Sync Configuration Wizard in Firefox' Settings to create a new account on the server. Don't forget to choose "Custom server..." in the list, and input the server address: {{ic|<nowiki>http://server-name.domain-name:5000/</nowiki>}}<br />
<br />
The "Advanced Settings" button allows fine tuning of the synchronized elements list, and the definition of the client hostname.<br />
==See also==<br />
* [http://docs.services.mozilla.com/howtos/run-sync.html Mozilla Sync Server Howto]<br />
* [http://alien.slackbook.org/blog/setting-up-your-own-mozilla-sync-server/ Great tutorial, by Eric Hameleers]</div>Caneylanhttps://wiki.archlinux.org/index.php?title=Firefox_Sync_Server&diff=239992Firefox Sync Server2012-12-12T02:25:21Z<p>Caneylan: /* Python initial state restoration */</p>
<hr />
<div>[[Category:Web Server]]<br />
This page is about special operations required in order to install Mozilla Sync Server.<br />
<br />
Newer versions of Mozilla Firefox feature bookmarks, passwords, settings and browsing history synchronization between all your computers and devices. Mozilla Foundation provides a public Sync server, but you can host your own one if you want.<br />
==Prerequisites==<br />
===Dependencies===<br />
Before proceeding, you need to [[pacman|install]] {{pkg|python2}}, {{pkg|python2-virtualenv}}, {{pkg|sqlite3}}, {{pkg|mercurial}} and {{pkg|make}}, all available in the [[official repositories]].<br />
===Accessibility===<br />
If you intend to use your server with itinerant clients, you should install it on an Internet reachable computer.<br />
===Administration Rights===<br />
All installation instructions are commands relying on the superuser privileges, so open a terminal and type:<br />
{{bc|<br />
$ su -<br />
Password: <br />
# <br />
}}<br />
<br />
==Installation==<br />
Mozilla Sync Server depends on Python 2 during installation. Arch Linux provides Python 3 as default Python version so there are special tweaks needed before running Mozilla Sync Server setup.<br />
Setup process creates an isolated Python environment in which all necessary dependencies are downloaded and installed. Afterwards, running the server only relies on the isolated Python environment, independently of the system-wide Python.<br />
===Python preparation===<br />
Mozilla Sync Server setup needs Python 2.6 or newer. In default configuration, {{ic|/usr/bin/python}} is a symbolic link to {{ic|/usr/bin/python3}} whereas Python 2 is {{ic|/usr/bin/python2}}.<br />
<br />
Before running setup, we must check the link and change it if necessary:<br />
{{bc|<br />
# cd /usr/bin<br />
# ls -l python<br />
<br />
lrwxrwxrwx 1 root root 7 5 sept. 07:04 python -> python3<br />
<br />
# ls -l virtualenv<br />
<br />
ls: cannot access virtualenv: No such file or directory<br />
<br />
# ln -sf python2 python<br />
# ln -sf virtualenv2 virtualenv<br />
}}<br />
<br />
===Setup===<br />
Installation instructions:<br />
{{bc|<br />
# mkdir -p /opt/weave<br />
# cd /opt/weave<br />
# hg clone https://hg.mozilla.org/services/server-full<br />
<br />
... source repository cloning messages ...<br />
<br />
# cd server-full<br />
# make build<br />
<br />
... many build messages, including harmless warnings ...<br />
<br />
... end of the successful build messages:<br />
<br />
Building the app <br />
Checking the environ [ok]<br />
Updating the repo [ok]<br />
Building Services dependencies <br />
Getting server-core [ok]<br />
Getting server-reg [ok]<br />
Getting server-storage [ok] [ok]<br />
Building External dependencies [ok]<br />
Now building the app itself [ok]<br />
[done]<br />
<br />
}}<br />
<br />
Check the end of the build messages, they should state "[done]". Otherwise, look at the first error messages, they give you hints on the problem and how to solve it.<br />
<br />
===Python initial state restoration===<br />
{{bc|<br />
# cd /usr/bin<br />
# ln -sf python3 python<br />
# rm -f virtualenv<br />
}}<br />
<br />
==Configuration==<br />
===Server-side configuration files===<br />
Configuration files are used to define where databases and logs will be created.<br />
We will place databases in {{ic|/opt/weave/data}} and log files in {{ic|/var/log/weave}}, so we must create the directories.<br />
# mkdir /opt/weave/data /var/log/weave<br />
<br />
At least two configuration files must be changed in {{ic|/opt/weave/server-full}} in order to reflect these choices: {{ic|development.ini}} and {{ic|etc/sync.conf}}.<br />
<br />
In {{ic|development.ini}}, locate the line:<br />
{{bc|1=<br />
args = ('/tmp/sync-error.log',)<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
args = ('/var/log/weave/sync-error.log',)<br />
}}<br />
<br />
In {{ic|etc/sync.conf}}, locate the line:<br />
{{bc|1=<br />
sqluri = sqlite:////tmp/test.db<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
sqluri = sqlite:////opt/weave/data/sync.db<br />
}}<br />
This statement appears twice in the file, both should be modified.<br />
<br />
Bump the disk quota from 5 to 25 MB:<br />
{{bc|1=<br />
quota_size = 25600<br />
}}<br />
The fallback node URL must reflect the server's hostname (here {{ic|server-name.domain-name}}). <br />
Change:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://localhost:5000/</nowiki><br />
}}<br />
to:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://server-name.domain-name:5000/</nowiki><br />
}}<br />
<br />
===Unprivileged User===<br />
It is a good practice to run daemons as an unprivileged user. Create the group {{ic|weave}} and the user {{ic|sync}} for that purpose:<br />
{{bc|<br />
# groupadd weave<br />
# useradd -d /opt/weave -g weave -r -s /bin/bash sync<br />
}}<br />
This new user must have read and write access on every file in {{ic|/opt/weave}} and {{ic|/var/log/weave}}<br />
# chown -R sync:weave /opt/weave/*<br />
# chown -R sync:weave /var/log/weave<br />
<br />
===Automatic Startup of the Server===<br />
In order to make the Sync Server start automatically at boot-time, create a startup script:<br />
{{hc|<br />
/etc/rc.d/mozillaweave|<nowiki><br />
#!/bin/bash<br />
<br />
RUNDIR=/var/run/weave<br />
DAEMON=/opt/weave/bin/python<br />
PIDFILE=/var/run/weave.pid<br />
MESSAGELOG=/var/log/weave/sync-messages.log<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
PID=`pidof -x -o %PPID paster`<br />
case "$1" in<br />
start)<br />
stat_busy "Starting Mozilla Sync Server"<br />
[ -d $RUNDIR ] || mkdir $RUNDIR<br />
[ -z "$PID" ] && su sync -c "cd /opt/weave/server-full && bin/paster serve development.ini &>$MESSAGELOG &"<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
PID=`pidof -x -o %PPID paster`<br />
echo $PID >$PIDFILE<br />
add_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping Mozilla Sync Server"<br />
[ ! -z "$PID" ] && kill $PID &>/dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
rm_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {start|stop|restart}" <br />
esac<br />
exit 0<br />
</nowiki><br />
}}<br />
The script must have execution rights:<br />
# chmod 755 /etc/rc.d/mozillaweave<br />
Start the Sync Server at boot by including {{ic|mozillaweave}} in the [[Daemon]] list. It depends on the network so it should be placed accordingly.<br />
===Client-side configuration===<br />
Use the Sync Configuration Wizard in Firefox' Settings to create a new account on the server. Don't forget to choose "Custom server..." in the list, and input the server address: {{ic|<nowiki>http://server-name.domain-name:5000/</nowiki>}}<br />
<br />
The "Advanced Settings" button allows fine tuning of the synchronized elements list, and the definition of the client hostname.<br />
==See also==<br />
* [http://docs.services.mozilla.com/howtos/run-sync.html Mozilla Sync Server Howto]<br />
* [http://alien.slackbook.org/blog/setting-up-your-own-mozilla-sync-server/ Great tutorial, by Eric Hameleers]</div>Caneylanhttps://wiki.archlinux.org/index.php?title=Firefox_Sync_Server&diff=239991Firefox Sync Server2012-12-12T02:24:04Z<p>Caneylan: /* Python preparation -- build needs virtualenv */</p>
<hr />
<div>[[Category:Web Server]]<br />
This page is about special operations required in order to install Mozilla Sync Server.<br />
<br />
Newer versions of Mozilla Firefox feature bookmarks, passwords, settings and browsing history synchronization between all your computers and devices. Mozilla Foundation provides a public Sync server, but you can host your own one if you want.<br />
==Prerequisites==<br />
===Dependencies===<br />
Before proceeding, you need to [[pacman|install]] {{pkg|python2}}, {{pkg|python2-virtualenv}}, {{pkg|sqlite3}}, {{pkg|mercurial}} and {{pkg|make}}, all available in the [[official repositories]].<br />
===Accessibility===<br />
If you intend to use your server with itinerant clients, you should install it on an Internet reachable computer.<br />
===Administration Rights===<br />
All installation instructions are commands relying on the superuser privileges, so open a terminal and type:<br />
{{bc|<br />
$ su -<br />
Password: <br />
# <br />
}}<br />
<br />
==Installation==<br />
Mozilla Sync Server depends on Python 2 during installation. Arch Linux provides Python 3 as default Python version so there are special tweaks needed before running Mozilla Sync Server setup.<br />
Setup process creates an isolated Python environment in which all necessary dependencies are downloaded and installed. Afterwards, running the server only relies on the isolated Python environment, independently of the system-wide Python.<br />
===Python preparation===<br />
Mozilla Sync Server setup needs Python 2.6 or newer. In default configuration, {{ic|/usr/bin/python}} is a symbolic link to {{ic|/usr/bin/python3}} whereas Python 2 is {{ic|/usr/bin/python2}}.<br />
<br />
Before running setup, we must check the link and change it if necessary:<br />
{{bc|<br />
# cd /usr/bin<br />
# ls -l python<br />
<br />
lrwxrwxrwx 1 root root 7 5 sept. 07:04 python -> python3<br />
<br />
# ls -l virtualenv<br />
<br />
ls: cannot access virtualenv: No such file or directory<br />
<br />
# ln -sf python2 python<br />
# ln -sf virtualenv2 virtualenv<br />
}}<br />
<br />
===Setup===<br />
Installation instructions:<br />
{{bc|<br />
# mkdir -p /opt/weave<br />
# cd /opt/weave<br />
# hg clone https://hg.mozilla.org/services/server-full<br />
<br />
... source repository cloning messages ...<br />
<br />
# cd server-full<br />
# make build<br />
<br />
... many build messages, including harmless warnings ...<br />
<br />
... end of the successful build messages:<br />
<br />
Building the app <br />
Checking the environ [ok]<br />
Updating the repo [ok]<br />
Building Services dependencies <br />
Getting server-core [ok]<br />
Getting server-reg [ok]<br />
Getting server-storage [ok] [ok]<br />
Building External dependencies [ok]<br />
Now building the app itself [ok]<br />
[done]<br />
<br />
}}<br />
<br />
Check the end of the build messages, they should state "[done]". Otherwise, look at the first error messages, they give you hints on the problem and how to solve it.<br />
<br />
===Python initial state restoration===<br />
{{bc|<br />
# cd /usr/bin<br />
# ln -sf python3 python<br />
}}<br />
<br />
==Configuration==<br />
===Server-side configuration files===<br />
Configuration files are used to define where databases and logs will be created.<br />
We will place databases in {{ic|/opt/weave/data}} and log files in {{ic|/var/log/weave}}, so we must create the directories.<br />
# mkdir /opt/weave/data /var/log/weave<br />
<br />
At least two configuration files must be changed in {{ic|/opt/weave/server-full}} in order to reflect these choices: {{ic|development.ini}} and {{ic|etc/sync.conf}}.<br />
<br />
In {{ic|development.ini}}, locate the line:<br />
{{bc|1=<br />
args = ('/tmp/sync-error.log',)<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
args = ('/var/log/weave/sync-error.log',)<br />
}}<br />
<br />
In {{ic|etc/sync.conf}}, locate the line:<br />
{{bc|1=<br />
sqluri = sqlite:////tmp/test.db<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
sqluri = sqlite:////opt/weave/data/sync.db<br />
}}<br />
This statement appears twice in the file, both should be modified.<br />
<br />
Bump the disk quota from 5 to 25 MB:<br />
{{bc|1=<br />
quota_size = 25600<br />
}}<br />
The fallback node URL must reflect the server's hostname (here {{ic|server-name.domain-name}}). <br />
Change:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://localhost:5000/</nowiki><br />
}}<br />
to:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://server-name.domain-name:5000/</nowiki><br />
}}<br />
<br />
===Unprivileged User===<br />
It is a good practice to run daemons as an unprivileged user. Create the group {{ic|weave}} and the user {{ic|sync}} for that purpose:<br />
{{bc|<br />
# groupadd weave<br />
# useradd -d /opt/weave -g weave -r -s /bin/bash sync<br />
}}<br />
This new user must have read and write access on every file in {{ic|/opt/weave}} and {{ic|/var/log/weave}}<br />
# chown -R sync:weave /opt/weave/*<br />
# chown -R sync:weave /var/log/weave<br />
<br />
===Automatic Startup of the Server===<br />
In order to make the Sync Server start automatically at boot-time, create a startup script:<br />
{{hc|<br />
/etc/rc.d/mozillaweave|<nowiki><br />
#!/bin/bash<br />
<br />
RUNDIR=/var/run/weave<br />
DAEMON=/opt/weave/bin/python<br />
PIDFILE=/var/run/weave.pid<br />
MESSAGELOG=/var/log/weave/sync-messages.log<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
PID=`pidof -x -o %PPID paster`<br />
case "$1" in<br />
start)<br />
stat_busy "Starting Mozilla Sync Server"<br />
[ -d $RUNDIR ] || mkdir $RUNDIR<br />
[ -z "$PID" ] && su sync -c "cd /opt/weave/server-full && bin/paster serve development.ini &>$MESSAGELOG &"<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
PID=`pidof -x -o %PPID paster`<br />
echo $PID >$PIDFILE<br />
add_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping Mozilla Sync Server"<br />
[ ! -z "$PID" ] && kill $PID &>/dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
rm_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {start|stop|restart}" <br />
esac<br />
exit 0<br />
</nowiki><br />
}}<br />
The script must have execution rights:<br />
# chmod 755 /etc/rc.d/mozillaweave<br />
Start the Sync Server at boot by including {{ic|mozillaweave}} in the [[Daemon]] list. It depends on the network so it should be placed accordingly.<br />
===Client-side configuration===<br />
Use the Sync Configuration Wizard in Firefox' Settings to create a new account on the server. Don't forget to choose "Custom server..." in the list, and input the server address: {{ic|<nowiki>http://server-name.domain-name:5000/</nowiki>}}<br />
<br />
The "Advanced Settings" button allows fine tuning of the synchronized elements list, and the definition of the client hostname.<br />
==See also==<br />
* [http://docs.services.mozilla.com/howtos/run-sync.html Mozilla Sync Server Howto]<br />
* [http://alien.slackbook.org/blog/setting-up-your-own-mozilla-sync-server/ Great tutorial, by Eric Hameleers]</div>Caneylanhttps://wiki.archlinux.org/index.php?title=Firefox_Sync_Server&diff=239990Firefox Sync Server2012-12-12T02:21:20Z<p>Caneylan: /* Python preparation -- build needs virtualenv */</p>
<hr />
<div>[[Category:Web Server]]<br />
This page is about special operations required in order to install Mozilla Sync Server.<br />
<br />
Newer versions of Mozilla Firefox feature bookmarks, passwords, settings and browsing history synchronization between all your computers and devices. Mozilla Foundation provides a public Sync server, but you can host your own one if you want.<br />
==Prerequisites==<br />
===Dependencies===<br />
Before proceeding, you need to [[pacman|install]] {{pkg|python2}}, {{pkg|python2-virtualenv}}, {{pkg|sqlite3}}, {{pkg|mercurial}} and {{pkg|make}}, all available in the [[official repositories]].<br />
===Accessibility===<br />
If you intend to use your server with itinerant clients, you should install it on an Internet reachable computer.<br />
===Administration Rights===<br />
All installation instructions are commands relying on the superuser privileges, so open a terminal and type:<br />
{{bc|<br />
$ su -<br />
Password: <br />
# <br />
}}<br />
<br />
==Installation==<br />
Mozilla Sync Server depends on Python 2 during installation. Arch Linux provides Python 3 as default Python version so there are special tweaks needed before running Mozilla Sync Server setup.<br />
Setup process creates an isolated Python environment in which all necessary dependencies are downloaded and installed. Afterwards, running the server only relies on the isolated Python environment, independently of the system-wide Python.<br />
===Python preparation===<br />
Mozilla Sync Server setup needs Python 2.6 or newer. In default configuration, {{ic|/usr/bin/python}} is a symbolic link to {{ic|/usr/bin/python3}} whereas Python 2 is {{ic|/usr/bin/python2}}.<br />
<br />
Before running setup, we must check the link and change it if necessary:<br />
{{bc|<br />
# cd /usr/bin<br />
# ls -l python<br />
<br />
lrwxrwxrwx 1 root root 7 5 sept. 07:04 python -> python3<br />
<br />
# ln -sf python2 python<br />
# ln -s virtualenv2 virtualenv<br />
}}<br />
<br />
===Setup===<br />
Installation instructions:<br />
{{bc|<br />
# mkdir -p /opt/weave<br />
# cd /opt/weave<br />
# hg clone https://hg.mozilla.org/services/server-full<br />
<br />
... source repository cloning messages ...<br />
<br />
# cd server-full<br />
# make build<br />
<br />
... many build messages, including harmless warnings ...<br />
<br />
... end of the successful build messages:<br />
<br />
Building the app <br />
Checking the environ [ok]<br />
Updating the repo [ok]<br />
Building Services dependencies <br />
Getting server-core [ok]<br />
Getting server-reg [ok]<br />
Getting server-storage [ok] [ok]<br />
Building External dependencies [ok]<br />
Now building the app itself [ok]<br />
[done]<br />
<br />
}}<br />
<br />
Check the end of the build messages, they should state "[done]". Otherwise, look at the first error messages, they give you hints on the problem and how to solve it.<br />
<br />
===Python initial state restoration===<br />
{{bc|<br />
# cd /usr/bin<br />
# ln -sf python3 python<br />
}}<br />
<br />
==Configuration==<br />
===Server-side configuration files===<br />
Configuration files are used to define where databases and logs will be created.<br />
We will place databases in {{ic|/opt/weave/data}} and log files in {{ic|/var/log/weave}}, so we must create the directories.<br />
# mkdir /opt/weave/data /var/log/weave<br />
<br />
At least two configuration files must be changed in {{ic|/opt/weave/server-full}} in order to reflect these choices: {{ic|development.ini}} and {{ic|etc/sync.conf}}.<br />
<br />
In {{ic|development.ini}}, locate the line:<br />
{{bc|1=<br />
args = ('/tmp/sync-error.log',)<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
args = ('/var/log/weave/sync-error.log',)<br />
}}<br />
<br />
In {{ic|etc/sync.conf}}, locate the line:<br />
{{bc|1=<br />
sqluri = sqlite:////tmp/test.db<br />
}}<br />
and change it to:<br />
{{bc|1=<br />
sqluri = sqlite:////opt/weave/data/sync.db<br />
}}<br />
This statement appears twice in the file, both should be modified.<br />
<br />
Bump the disk quota from 5 to 25 MB:<br />
{{bc|1=<br />
quota_size = 25600<br />
}}<br />
The fallback node URL must reflect the server's hostname (here {{ic|server-name.domain-name}}). <br />
Change:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://localhost:5000/</nowiki><br />
}}<br />
to:<br />
{{bc|1=<br />
fallback_node = <nowiki>http://server-name.domain-name:5000/</nowiki><br />
}}<br />
<br />
===Unprivileged User===<br />
It is a good practice to run daemons as an unprivileged user. Create the group {{ic|weave}} and the user {{ic|sync}} for that purpose:<br />
{{bc|<br />
# groupadd weave<br />
# useradd -d /opt/weave -g weave -r -s /bin/bash sync<br />
}}<br />
This new user must have read and write access on every file in {{ic|/opt/weave}} and {{ic|/var/log/weave}}<br />
# chown -R sync:weave /opt/weave/*<br />
# chown -R sync:weave /var/log/weave<br />
<br />
===Automatic Startup of the Server===<br />
In order to make the Sync Server start automatically at boot-time, create a startup script:<br />
{{hc|<br />
/etc/rc.d/mozillaweave|<nowiki><br />
#!/bin/bash<br />
<br />
RUNDIR=/var/run/weave<br />
DAEMON=/opt/weave/bin/python<br />
PIDFILE=/var/run/weave.pid<br />
MESSAGELOG=/var/log/weave/sync-messages.log<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
PID=`pidof -x -o %PPID paster`<br />
case "$1" in<br />
start)<br />
stat_busy "Starting Mozilla Sync Server"<br />
[ -d $RUNDIR ] || mkdir $RUNDIR<br />
[ -z "$PID" ] && su sync -c "cd /opt/weave/server-full && bin/paster serve development.ini &>$MESSAGELOG &"<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
PID=`pidof -x -o %PPID paster`<br />
echo $PID >$PIDFILE<br />
add_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping Mozilla Sync Server"<br />
[ ! -z "$PID" ] && kill $PID &>/dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
rm_daemon weave<br />
stat_done<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {start|stop|restart}" <br />
esac<br />
exit 0<br />
</nowiki><br />
}}<br />
The script must have execution rights:<br />
# chmod 755 /etc/rc.d/mozillaweave<br />
Start the Sync Server at boot by including {{ic|mozillaweave}} in the [[Daemon]] list. It depends on the network so it should be placed accordingly.<br />
===Client-side configuration===<br />
Use the Sync Configuration Wizard in Firefox' Settings to create a new account on the server. Don't forget to choose "Custom server..." in the list, and input the server address: {{ic|<nowiki>http://server-name.domain-name:5000/</nowiki>}}<br />
<br />
The "Advanced Settings" button allows fine tuning of the synchronized elements list, and the definition of the client hostname.<br />
==See also==<br />
* [http://docs.services.mozilla.com/howtos/run-sync.html Mozilla Sync Server Howto]<br />
* [http://alien.slackbook.org/blog/setting-up-your-own-mozilla-sync-server/ Great tutorial, by Eric Hameleers]</div>Caneylan