FIREFOX SYNC SERVER DEBIAN FAQ: Unterschied zwischen den Versionen
KKeine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 1: | Zeile 1: | ||
FIREFOX SYNC SERVER DEBIAN FAQ (Stand | FIREFOX SYNC SERVER DEBIAN FAQ (Stand 14.05.2013) [ © Oliver Schuetz aka OppTupacShakur | http://OPPServer.net | http://unix.oppserver.net ] | ||
Alle Befehle sind als user root auszufuehren: | Alle Befehle sind als user root auszufuehren: | ||
Zeile 85: | Zeile 85: | ||
[captcha] | [captcha] | ||
use = true | use = true | ||
public_key = | public_key = xyz | ||
private_key = | private_key = xyz | ||
use_ssl = true | use_ssl = true | ||
Die Keys kann man hier https://www.google.com/recaptcha/admin/create generieren. | Die Keys kann man hier https://www.google.com/recaptcha/admin/create generieren. | ||
Im folgenden sind nur die Aenderungen aufgefuehrt: | Im folgenden sind nur die Aenderungen aufgefuehrt: | ||
Zeile 95: | Zeile 96: | ||
backend = syncstorage.storage.sql.SQLStorage | backend = syncstorage.storage.sql.SQLStorage | ||
sqluri = mysql://ffsync:P@ssw0rt@localhost/ffsync | sqluri = mysql://ffsync:P@ssw0rt@localhost/ffsync | ||
... | |||
quota_size = 20480 | |||
[auth] | [auth] | ||
backend = services. | backend = services.user.sql.SQLUser | ||
sqluri = mysql://ffsync:P@ssw0rt@localhost/ffsync | sqluri = mysql://ffsync:P@ssw0rt@localhost/ffsync | ||
Zeile 123: | Zeile 126: | ||
/etc/apache2/sites-available/ffsync.oppserver.net.conf Datei anlegen: | /etc/apache2/sites-available/ffsync.oppserver.net.conf Datei anlegen: | ||
<VirtualHost *:80> | <nowiki> | ||
<VirtualHost *:80> | |||
DocumentRoot "/home/ffsync/server-full" | |||
ServerName ffsync.oppserver.net | |||
CustomLog ${APACHE_LOG_DIR}/ffsync.oppserver.net-access.log combined | |||
ErrorLog ${APACHE_LOG_DIR}/ffsync.oppserver.net-error.log | |||
<Directory "/home/ffsync/server-full"> | |||
Order deny,allow | |||
Allow from all | |||
</Directory> | |||
WSGIProcessGroup ffsync | |||
WSGIDaemonProcess ffsync user=ffsync group=ffsync processes=2 threads=25 | |||
WSGIPassAuthorization On | |||
WSGIScriptAlias / /home/ffsync/server-full/sync.wsgi | |||
</VirtualHost> | |||
<IfModule mod_ssl.c> | |||
<VirtualHost *:443> | |||
DocumentRoot "/home/ffsync/server-full" | |||
ServerName ffsync.oppserver.net | |||
CustomLog ${APACHE_LOG_DIR}/ffsync.oppserver.net-access.log combined | |||
ErrorLog ${APACHE_LOG_DIR}/ffsync.oppserver.net-error.log | |||
SSLEngine on | |||
SSLCertificateFile /usr/share/ssl-cert/oppserver.net.pem | |||
<Directory "/home/ffsync/server-full"> | |||
Order deny,allow | |||
Allow from all | |||
</Directory> | |||
WSGIProcessGroup ffsync | |||
WSGIDaemonProcess ffsyncs user=ffsync group=ffsync processes=2 threads=25 | |||
WSGIPassAuthorization On | |||
WSGIScriptAlias / /home/ffsync/server-full/sync.wsgi | |||
</ | </VirtualHost> | ||
</IfModule> | |||
</nowiki> | |||
a2ensite ffsync.oppserver.net.conf | a2ensite ffsync.oppserver.net.conf | ||
Zeile 160: | Zeile 165: | ||
Ich musste bei meinem VPS die threads beim WSGIDaemonProcess von 25 auf 10 senken, damit nicht zuviel RAM Verbrauch an stand. | Ich musste bei meinem VPS die threads beim WSGIDaemonProcess von 25 auf 10 senken, damit nicht zuviel RAM Verbrauch an stand. | ||
Um den Sync Server beim Systemstart und jetzt zu starten, erstellen wir ein init Script (nano /etc/init.d/ffsync) mit folgenden Inhalt: | |||
<nowiki> | |||
#!/bin/bash | |||
### BEGIN INIT INFO | |||
# Short-Description: Mozilla Sync Server | |||
# Provides: ffsync | |||
# Required-Start: $remote_fs $syslog | |||
# Required-Stop: $remote_fs $syslog | |||
# Default-Start: 2 3 4 5 | |||
# Default-Stop: 0 1 6 | |||
### END INIT INFO | |||
RUNDIR=/var/run/ffsync | |||
DAEMON=/home/ffsync/server-full/python | |||
PIDFILE=/var/run/ffsync.pid | |||
MESSAGELOG=/home/ffsync/tmp/sync-messages.log | |||
PID=`pidof -x -o %PPID paster` | |||
case "$1" in | |||
start) | |||
echo "Starting Mozilla Sync Server" | |||
[ -d $RUNDIR ] || mkdir $RUNDIR | |||
[ -z "$PID" ] && su ffsync -c "cd /home/ffsync/server-full && bin/paster serve server.ini &>$MESSAGELOG &" | |||
if [ $? -gt 0 ]; then | |||
echo "Dont start succesfully. (Maybe it is running?)" | |||
else | |||
PID=`pidof -x -o %PPID paster` | |||
echo $PID >$PIDFILE | |||
echo "Start succesfully." | |||
fi | |||
;; | |||
stop) | |||
echo "Stopping Mozilla Sync Server" | |||
[ ! -z "$PID" ] && kill $PID >/dev/null 2>&1 | |||
if [ $? -gt 0 ]; then | |||
echo "Dont stop succesfully. (Maybe it is not running?)" | |||
else | |||
echo "Stop succesfully." | |||
fi | |||
;; | |||
restart) | |||
$0 stop | |||
$0 start | |||
;; | |||
*) | |||
echo "usage: $0 {start|stop|restart}" | |||
esac | |||
exit 0 | |||
</nowiki> | |||
Jetzt geben wir dem Script die richtigen Rechte: | |||
chmod +x /etc/init.d/ffsync | |||
Nun starten wir den Sync Server: | |||
service ffsync start | |||
Als letztes wenn alles funktioniert tragen wir das Script in die Runlevel ein: | |||
update-rc.d ffsync defaults |
Version vom 13. Mai 2013, 23:44 Uhr
FIREFOX SYNC SERVER DEBIAN FAQ (Stand 14.05.2013) [ © Oliver Schuetz aka OppTupacShakur | http://OPPServer.net | http://unix.oppserver.net ]
Alle Befehle sind als user root auszufuehren:
Die noetigen Pakete installieren:
aptitude install libapache2-mod-wsgi python-dev mercurial python-virtualenv php-services-json sqlite3 libmysqlclient-dev mysql-server
Benutzer ffsync erstellen:
adduser --system --home /home/ffsync --group ffsync passwd ffsync usermod -s /bin/bash ffsync
Den Apache User zu der Gruppe ffsync hinzufuegen:
adduser www-data ffsync
Mysql einrichten:
mysql -u root -p mysql create database ffsync; CREATE USER 'ffsync'@'localhost' IDENTIFIED BY 'ffsync'; SET PASSWORD FOR 'ffsync'@'localhost' = PASSWORD('P@ssw0rt'); grant all on ffsync.* to 'ffsync'@'localhost'; quit
Den User wechseln:
su - ffsync
Den Server holen und installieren:
hg clone https://hg.mozilla.org/services/server-full mkdir data tmp cd server-full make build bin/easy_install Mysql-Python
In sync.wsgi folgendes aendern:
os.environ['PYTHON_EGG_CACHE'] = '/tmp/python-eggs'
in
os.environ['PYTHON_EGG_CACHE'] = '/home/ffsync/tmp/python-eggs'
ini_file = os.path.join(_CURDIR, 'development.ini')
in
ini_file = os.path.join(_CURDIR, 'server.ini')
cp development.ini server.ini
In server.ini folges aendern:
[server:main] use = egg:Paste#http host = 0.0.0.0
in
[server:main] use = egg:Paste#http host = 192.168.0.2 << Beispiel
[handler_syncserver_errors] class = handlers.RotatingFileHandler args = ('/tmp/sync-error.log',)
in
[handler_syncserver_errors] class = handlers.RotatingFileHandler args = ('/home/ffsync/tmp/sync-error.log',)
In etc/sync.conf folgendes aendern:
[captcha] use = true public_key = xyz private_key = xyz use_ssl = true
Die Keys kann man hier https://www.google.com/recaptcha/admin/create generieren.
Im folgenden sind nur die Aenderungen aufgefuehrt:
[storage] backend = syncstorage.storage.sql.SQLStorage sqluri = mysql://ffsync:P@ssw0rt@localhost/ffsync ... quota_size = 20480
[auth] backend = services.user.sql.SQLUser sqluri = mysql://ffsync:P@ssw0rt@localhost/ffsync [nodes] # You must set this to your client-visible server URL. # fallback_node = http://example.com/path/to/sync fallback_node = http://ffsync.oppserver.net/ [smtp] host = localhost port = 25 sender = ffsync@oppserver.net [reset_codes] backend = services.resetcodes.rc_sql.ResetCodeSQL #sqluri = sqlite:////tmp/test.db sqluri = mysql://ffsync:P@ssw0rt@localhost/ffsync
Apache und Vhost einrichten:
Hier wieder weiter als User root:
a2enmod wsgi
/etc/apache2/sites-available/ffsync.oppserver.net.conf Datei anlegen:
<VirtualHost *:80> DocumentRoot "/home/ffsync/server-full" ServerName ffsync.oppserver.net CustomLog ${APACHE_LOG_DIR}/ffsync.oppserver.net-access.log combined ErrorLog ${APACHE_LOG_DIR}/ffsync.oppserver.net-error.log <Directory "/home/ffsync/server-full"> Order deny,allow Allow from all </Directory> WSGIProcessGroup ffsync WSGIDaemonProcess ffsync user=ffsync group=ffsync processes=2 threads=25 WSGIPassAuthorization On WSGIScriptAlias / /home/ffsync/server-full/sync.wsgi </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> DocumentRoot "/home/ffsync/server-full" ServerName ffsync.oppserver.net CustomLog ${APACHE_LOG_DIR}/ffsync.oppserver.net-access.log combined ErrorLog ${APACHE_LOG_DIR}/ffsync.oppserver.net-error.log SSLEngine on SSLCertificateFile /usr/share/ssl-cert/oppserver.net.pem <Directory "/home/ffsync/server-full"> Order deny,allow Allow from all </Directory> WSGIProcessGroup ffsync WSGIDaemonProcess ffsyncs user=ffsync group=ffsync processes=2 threads=25 WSGIPassAuthorization On WSGIScriptAlias / /home/ffsync/server-full/sync.wsgi </VirtualHost> </IfModule>
a2ensite ffsync.oppserver.net.conf /etc/init.d/apache2 reload
Ich musste bei meinem VPS die threads beim WSGIDaemonProcess von 25 auf 10 senken, damit nicht zuviel RAM Verbrauch an stand.
Um den Sync Server beim Systemstart und jetzt zu starten, erstellen wir ein init Script (nano /etc/init.d/ffsync) mit folgenden Inhalt:
#!/bin/bash ### BEGIN INIT INFO # Short-Description: Mozilla Sync Server # Provides: ffsync # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO RUNDIR=/var/run/ffsync DAEMON=/home/ffsync/server-full/python PIDFILE=/var/run/ffsync.pid MESSAGELOG=/home/ffsync/tmp/sync-messages.log PID=`pidof -x -o %PPID paster` case "$1" in start) echo "Starting Mozilla Sync Server" [ -d $RUNDIR ] || mkdir $RUNDIR [ -z "$PID" ] && su ffsync -c "cd /home/ffsync/server-full && bin/paster serve server.ini &>$MESSAGELOG &" if [ $? -gt 0 ]; then echo "Dont start succesfully. (Maybe it is running?)" else PID=`pidof -x -o %PPID paster` echo $PID >$PIDFILE echo "Start succesfully." fi ;; stop) echo "Stopping Mozilla Sync Server" [ ! -z "$PID" ] && kill $PID >/dev/null 2>&1 if [ $? -gt 0 ]; then echo "Dont stop succesfully. (Maybe it is not running?)" else echo "Stop succesfully." fi ;; restart) $0 stop $0 start ;; *) echo "usage: $0 {start|stop|restart}" esac exit 0
Jetzt geben wir dem Script die richtigen Rechte:
chmod +x /etc/init.d/ffsync
Nun starten wir den Sync Server:
service ffsync start
Als letztes wenn alles funktioniert tragen wir das Script in die Runlevel ein:
update-rc.d ffsync defaults