mirror of
https://github.com/YunoHost-Apps/ffsync_ynh.git
synced 2024-09-03 18:26:38 +02:00
Merge branch 'testing' into master
This commit is contained in:
commit
10f4e78ad2
11 changed files with 115 additions and 112 deletions
22
README.md
22
README.md
|
@ -1,7 +1,7 @@
|
|||
# Mozilla’s Sync Server for Yunohost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/ffsync.svg)](https://dash.yunohost.org/appci/app/ffsync) ![](https://ci-apps.yunohost.org/ci/badges/ffsync.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ffsync.maintain.svg)
|
||||
[![Install ffsync with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=ffsync)
|
||||
[![Install ffsync with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ffsync)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
> *This package allow you to install ffsync quickly and simply on a YunoHost server.
|
||||
|
@ -47,3 +47,23 @@ sudo yunohost app install https://github.com/YunoHost-Apps/ffsync_ynh/tree/testi
|
|||
or
|
||||
sudo yunohost app upgrade ffsync -u https://github.com/YunoHost-Apps/ffsync_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
### Solving problems with Android
|
||||
|
||||
The sure-fire way to know what Sync on Android is really doing is to observe the Android device log using adb logcat. You’ll want to bump your log-level:
|
||||
```
|
||||
adb shell setprop log.tag.FxAccounts VERBOSE
|
||||
```
|
||||
|
||||
Then, you can observe the log using:
|
||||
```
|
||||
adb logcat | grep FxAccounts
|
||||
```
|
||||
|
||||
It’s best to observe the log while you force a sync from the Android Settings App. You should see output like:
|
||||
|
||||
```
|
||||
D FxAccounts(...) fennec :: BaseResource :: HTTP GET https://token.stage.mozaws.net/1.0/sync/1.5
|
||||
...
|
||||
D FxAccounts(...) fennec :: BaseResource :: HTTP GET https://sync-4-us-east-1.stage.mozaws.net/
|
||||
```
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Serveur de synchronisation de Firefox pour Yunohost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/ffsync.svg)](https://dash.yunohost.org/appci/app/ffsync)
|
||||
[![Install ffsync with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=ffsync)
|
||||
[![Install ffsync with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ffsync)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
> *Ce package vous permet d'installer ffsync rapidement et simplement sur un serveur Yunohost.
|
||||
|
|
|
@ -18,18 +18,6 @@
|
|||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=0
|
||||
;;; Levels
|
||||
Level 1=auto
|
||||
Level 2=auto
|
||||
Level 3=auto
|
||||
# impossible with Firefox Sync (it uses Firefox Accounts)
|
||||
Level 4=na
|
||||
Level 5=auto
|
||||
Level 6=auto
|
||||
Level 7=auto
|
||||
Level 8=0
|
||||
Level 9=0
|
||||
Level 10=0
|
||||
;;; Options
|
||||
Email=jean-baptiste@holcroft.fr
|
||||
Notification=fail
|
||||
|
|
|
@ -12,7 +12,7 @@ location __PATH__/ {
|
|||
include uwsgi_params;
|
||||
# Needed for long running operations in admin interface
|
||||
uwsgi_read_timeout 3600;
|
||||
uwsgi_param SCRIPT_NAME __PATH__;
|
||||
uwsgi_modifier1 30;
|
||||
uwsgi_pass unix:///var/run/__NAME__/app.socket;
|
||||
__IS_SUBPATH__uwsgi_param SCRIPT_NAME __PATH__;
|
||||
__IS_SUBPATH__uwsgi_modifier1 30;
|
||||
uwsgi_pass unix:///run/__NAME__/app.socket;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
plugins = python
|
||||
master = true
|
||||
protocol = uwsgi
|
||||
socket = /var/run/__APP__/app.socket
|
||||
socket = /run/__APP__/app.socket
|
||||
chmod-socket = 660
|
||||
virtualenv = __FINALPATH__/local
|
||||
wsgi-file = __FINALPATH__/syncserver.wsgi
|
||||
|
|
|
@ -20,7 +20,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -33,30 +33,30 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the main app directory..."
|
||||
ynh_print_info --message="Backing up the main app directory..."
|
||||
ynh_backup --src_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up nginx web server configuration..."
|
||||
ynh_print_info --message="Backing up nginx web server configuration..."
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the MySQL database..."
|
||||
ynh_print_info --message="Backing up the MySQL database..."
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# Backup Log
|
||||
ynh_script_progression --message="Backing up logs"
|
||||
ynh_print_info --message="Backing up logs"
|
||||
ynh_backup --src_path="/var/log/uwsgi/$app"
|
||||
|
||||
# BACKUP THE UWSGI FILES
|
||||
ynh_script_progression --message="Backing up UWSGI..."
|
||||
ynh_print_info --message="Backing up UWSGI..."
|
||||
ynh_backup --src_path="/etc/uwsgi/apps-available/$app.ini"
|
||||
ynh_backup --src_path="/etc/systemd/system/uwsgi-app@.service"
|
||||
|
||||
|
@ -64,4 +64,4 @@ ynh_backup --src_path="/etc/systemd/system/uwsgi-app@.service"
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
#
|
||||
# usage: ynh_check_global_uwsgi_config
|
||||
ynh_check_global_uwsgi_config () {
|
||||
uwsgi --version || ynh_die --message "You need to add uwsgi (and appropriate plugin) as a dependency"
|
||||
uwsgi --version || ynh_die --message="You need to add uwsgi (and appropriate plugin) as a dependency"
|
||||
|
||||
cat > /etc/systemd/system/uwsgi-app@.service <<EOF
|
||||
cat > /etc/systemd/system/uwsgi-app@.service <<EOF
|
||||
[Unit]
|
||||
Description=%i uWSGI app
|
||||
After=syslog.target
|
||||
|
@ -13,7 +13,7 @@ After=syslog.target
|
|||
RuntimeDirectory=%i
|
||||
ExecStart=/usr/bin/uwsgi \
|
||||
--ini /etc/uwsgi/apps-available/%i.ini \
|
||||
--socket /var/run/%i/app.socket \
|
||||
--socket /run/%i/app.socket \
|
||||
--logto /var/log/uwsgi/%i/%i.log
|
||||
User=%i
|
||||
Group=www-data
|
||||
|
@ -28,7 +28,7 @@ NotifyAccess=all
|
|||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl daemon-reload
|
||||
}
|
||||
|
||||
# Create a dedicated uwsgi ini file to use with generic uwsgi service
|
||||
|
@ -48,77 +48,79 @@ EOF
|
|||
#
|
||||
# To be able to customise the settings of the systemd unit you can override the rules with the file "conf/uwsgi-app@override.service".
|
||||
# This file will be automatically placed on the good place
|
||||
#
|
||||
# Note that the service need to be started manually at the end of the installation.
|
||||
# Generally you can start the service with this command:
|
||||
# # ynh_systemd_action --service_name "uwsgi-app@$app.service" --line_match "WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/$app.log"
|
||||
#
|
||||
# usage: ynh_add_uwsgi_service
|
||||
#
|
||||
# to interact with your service: `systemctl <action> uwsgi-app@app`
|
||||
# to interact with your service: `systemctl <action> uwsgi-app@$app`
|
||||
ynh_add_uwsgi_service () {
|
||||
ynh_check_global_uwsgi_config
|
||||
ynh_check_global_uwsgi_config
|
||||
|
||||
local others_var=${1:-}
|
||||
local finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
||||
local others_var=${1:-}
|
||||
local finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
||||
|
||||
# www-data group is needed since it is this nginx who will start the service
|
||||
usermod --append --groups www-data "$app" || ynh_die --message "It wasn't possible to add user $app to group www-data"
|
||||
# www-data group is needed since it is this nginx who will start the service
|
||||
usermod --append --groups www-data "$app" || ynh_die --message="It wasn't possible to add user $app to group www-data"
|
||||
|
||||
ynh_backup_if_checksum_is_different --file "$finaluwsgiini"
|
||||
cp ../conf/uwsgi.ini "$finaluwsgiini"
|
||||
ynh_backup_if_checksum_is_different --file="$finaluwsgiini"
|
||||
cp ../conf/uwsgi.ini "$finaluwsgiini"
|
||||
|
||||
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
|
||||
# Substitute in a nginx config file only if the variable is not empty
|
||||
if test -n "${final_path:-}"; then
|
||||
ynh_replace_string --match_string __FINALPATH__ --replace_string "$final_path" --target_file "$finaluwsgiini"
|
||||
fi
|
||||
if test -n "${path_url:-}"; then
|
||||
ynh_replace_string --match_string __PATH__ --replace_string "$path_url" --target_file "$finaluwsgiini"
|
||||
fi
|
||||
if test -n "${app:-}"; then
|
||||
ynh_replace_string --match_string __APP__ --replace_string "$app" --target_file "$finaluwsgiini"
|
||||
fi
|
||||
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
|
||||
# Substitute in a nginx config file only if the variable is not empty
|
||||
if test -n "${final_path:-}"; then
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$finaluwsgiini"
|
||||
fi
|
||||
if test -n "${path_url:-}"; then
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$finaluwsgiini"
|
||||
fi
|
||||
if test -n "${app:-}"; then
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$finaluwsgiini"
|
||||
fi
|
||||
|
||||
# Replace all other variable given as arguments
|
||||
for var_to_replace in $others_var
|
||||
do
|
||||
# ${var_to_replace^^} make the content of the variable on upper-cases
|
||||
# ${!var_to_replace} get the content of the variable named $var_to_replace
|
||||
ynh_replace_string "__${var_to_replace^^}__" "${!var_to_replace}" "$finaluwsgiini"
|
||||
done
|
||||
# Replace all other variable given as arguments
|
||||
for var_to_replace in $others_var
|
||||
do
|
||||
# ${var_to_replace^^} make the content of the variable on upper-cases
|
||||
# ${!var_to_replace} get the content of the variable named $var_to_replace
|
||||
ynh_replace_string --match_string="__${var_to_replace^^}__" --replace_string="${!var_to_replace}" --target_file="$finaluwsgiini"
|
||||
done
|
||||
|
||||
ynh_store_file_checksum --file "$finaluwsgiini"
|
||||
ynh_store_file_checksum --file="$finaluwsgiini"
|
||||
|
||||
chown $app:root "$finaluwsgiini"
|
||||
chown $app:root "$finaluwsgiini"
|
||||
|
||||
# make sure the folder for logs exists and set authorizations
|
||||
mkdir -p /var/log/uwsgi/$app
|
||||
chown $app:root /var/log/uwsgi/$app
|
||||
chmod -R u=rwX,g=rX,o= /var/log/uwsgi/$app
|
||||
# make sure the folder for logs exists and set authorizations
|
||||
mkdir -p /var/log/uwsgi/$app
|
||||
chown $app:root /var/log/uwsgi/$app
|
||||
chmod -R u=rwX,g=rX,o= /var/log/uwsgi/$app
|
||||
|
||||
# Setup specific Systemd rules if necessary
|
||||
test -e ../conf/uwsgi-app@override.service && \
|
||||
mkdir /etc/systemd/system/uwsgi-app@$app.service.d && \
|
||||
cp ../conf/uwsgi-app@override.service /etc/systemd/system/uwsgi-app@$app.service.d/override.conf
|
||||
# Setup specific Systemd rules if necessary
|
||||
test -e ../conf/uwsgi-app@override.service && \
|
||||
mkdir /etc/systemd/system/uwsgi-app@$app.service.d && \
|
||||
cp ../conf/uwsgi-app@override.service /etc/systemd/system/uwsgi-app@$app.service.d/override.conf
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl stop "uwsgi-app@$app.service" || true
|
||||
systemctl enable "uwsgi-app@$app.service"
|
||||
systemctl start "uwsgi-app@$app.service"
|
||||
systemctl daemon-reload
|
||||
systemctl enable "uwsgi-app@$app.service"
|
||||
|
||||
# Add as a service
|
||||
yunohost service add "uwsgi-app@$app" --log "/var/log/uwsgi/$app/$app.log"
|
||||
# Add as a service
|
||||
yunohost service add "uwsgi-app@$app" --log "/var/log/uwsgi/$app/$app.log"
|
||||
}
|
||||
|
||||
# Remove the dedicated uwsgi ini file
|
||||
#
|
||||
# usage: ynh_remove_uwsgi_service
|
||||
ynh_remove_uwsgi_service () {
|
||||
local finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
||||
if [ -e "$finaluwsgiini" ]; then
|
||||
systemctl stop "uwsgi-app@$app.service"
|
||||
systemctl disable "uwsgi-app@$app.service"
|
||||
yunohost service remove "uwsgi-app@$app"
|
||||
local finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
||||
if [ -e "$finaluwsgiini" ]; then
|
||||
yunohost service remove "uwsgi-app@$app"
|
||||
systemctl stop "uwsgi-app@$app.service"
|
||||
systemctl disable "uwsgi-app@$app.service"
|
||||
|
||||
ynh_secure_remove --file="$finaluwsgiini"
|
||||
ynh_secure_remove --file="/var/log/uwsgi/$app"
|
||||
ynh_secure_remove --file="/etc/systemd/system/uwsgi-app@$app.service.d"
|
||||
fi
|
||||
ynh_secure_remove --file="$finaluwsgiini"
|
||||
ynh_secure_remove --file="/var/log/uwsgi/$app"
|
||||
ynh_secure_remove --file="/etc/systemd/system/uwsgi-app@$app.service.d"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -81,17 +81,15 @@ install_sources
|
|||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring nginx"
|
||||
ynh_add_nginx_config
|
||||
|
||||
if [ "$path_url" == "/" ]
|
||||
then
|
||||
# $finalnginxconf comes from ynh_add_nginx_config
|
||||
# uwsgi_param is only needed for non-root installation
|
||||
ynh_replace_string --match_string "uwsgi_param " --replace_string "#uwsgi_param " --target_file "$finalnginxconf"
|
||||
ynh_replace_string --match_string "uwsgi_modifier1 " --replace_string "#uwsgi_modifier1 " --target_file "$finalnginxconf"
|
||||
is_subpath="# "
|
||||
else
|
||||
is_subpath=" "
|
||||
fi
|
||||
ynh_store_file_checksum --file "$finalnginxconf"
|
||||
systemctl reload nginx
|
||||
ynh_add_nginx_config 'is_subpath'
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -138,12 +136,15 @@ ynh_script_progression --message="Configuring permissions"
|
|||
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
# RELOAD Services
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..."
|
||||
|
||||
ynh_script_progression --message="Restart services..."
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
ynh_script_progression --message="Starting $app services..." --weight=3
|
||||
ynh_systemd_action --service_name "uwsgi-app@$app.service" \
|
||||
--line_match "WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -24,17 +24,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE UWSGI
|
||||
#=================================================
|
||||
|
||||
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status uwsgi-app@$app >/dev/null
|
||||
then
|
||||
ynh_print_info --message="Removing $app service..."
|
||||
yunohost service remove uwsgi-app@$app
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
|
|
|
@ -81,12 +81,11 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
|
|||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
yunohost service add "uwsgi-app@$app" --log "/var/log/uwsgi/app/$app"
|
||||
|
||||
ynh_script_progression --message="Reloading services..." --weight=3
|
||||
|
||||
ynh_check_global_uwsgi_config
|
||||
systemctl enable "uwsgi-app@$app"
|
||||
systemctl enable "uwsgi-app@$app" --quiet
|
||||
yunohost service add "uwsgi-app@$app" --log "/var/log/uwsgi/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -94,7 +93,9 @@ systemctl enable "uwsgi-app@$app"
|
|||
# RELOAD NGINX AND UWSGI
|
||||
#=================================================
|
||||
|
||||
systemctl start "uwsgi-app@$app"
|
||||
systemctl reload nginx
|
||||
ynh_script_progression --message="Starting pgadmin services..." --weight=3
|
||||
ynh_systemd_action --service_name "uwsgi-app@$app.service" \
|
||||
--line_match "WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/$app.log"
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
|
|
|
@ -110,18 +110,16 @@ install_sources
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring nginx..."
|
||||
ynh_add_nginx_config
|
||||
|
||||
ynh_script_progression --message="Configuring nginx"
|
||||
if [ "$path_url" == "/" ]
|
||||
then
|
||||
# $finalnginxconf comes from ynh_add_nginx_config
|
||||
# uwsgi_param is only needed for non-root installation
|
||||
ynh_replace_string "uwsgi_param " "#uwsgi_param " "$finalnginxconf"
|
||||
ynh_replace_string "uwsgi_modifier1 " "#uwsgi_modifier1 " "$finalnginxconf"
|
||||
is_subpath="# "
|
||||
else
|
||||
is_subpath=" "
|
||||
fi
|
||||
ynh_store_file_checksum --file "$finalnginxconf"
|
||||
systemctl reload nginx
|
||||
ynh_add_nginx_config 'is_subpath'
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -162,6 +160,10 @@ set_permissions
|
|||
|
||||
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
||||
|
||||
ynh_script_progression --message="Restarting $app services..." --weight=3
|
||||
ynh_systemd_action --service_name "uwsgi-app@$app.service" \
|
||||
--line_match "WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue