diff --git a/conf/nginx.conf b/conf/nginx.conf index 2fecb65..30217dd 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,3 +1,9 @@ +rewrite ^$ /; +location ~ ^/$ { + default_type text/plain; + return 200 "This is where Collabora Online is installed. To actually be useful, this needs to be integrated in a front-end such as Nextcloud for example."; +} + # static files location ^~ /loleaflet { proxy_pass http://localhost:__PORT__; diff --git a/manifest.json b/manifest.json index e4f2b19..3faac8c 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "rafi59_dev@srvmaison.fr.nf" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.4.4" }, "multi_instance": false, "services": [ diff --git a/scripts/install b/scripts/install index ff9ab9b..3478e2a 100644 --- a/scripts/install +++ b/scripts/install @@ -60,6 +60,17 @@ port=$(ynh_find_port --port=9980) ynh_app_setting_set --app=$app --key=port --value=$port +#================================================= +# CONFIGURE ONLYOFFICE +#================================================= + +# Turns out we need to create/copy this file BEFORE the actual .deb install, +# otherwise stupid collabora will expect to find a certificate file in its own +# config directory which of course doesn't exists and we want to disable SSL +# because we're in a reverse proxy context... +mkdir -p /etc/loolwsd +ynh_add_config ../conf/loolwsd.xml /etc/loolwsd/loolwsd.xml + #================================================= # INSTALL DEPENDENCIES #================================================= @@ -79,23 +90,6 @@ ynh_add_nginx_config #================================================= # SPECIFIC SETUP #================================================= -# MODIFY A CONFIG FILE -#================================================= - -config="/etc/loolwsd/loolwsd.xml" - -cp -f ../conf/loolwsd.xml $config - -ynh_replace_string --match_string="__NEXTCLOUD_DOMAIN__" --replace_string="$nextcloud_domain" --target_file="$config" -ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="$config" - -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum "/etc/loolwsd/loolwsd.xml" - #================================================= # GENERIC FINALIZATION #================================================= @@ -104,7 +98,8 @@ ynh_store_file_checksum "/etc/loolwsd/loolwsd.xml" ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name="loolwsd" --action="start" --log_path="systemd" --line_match="Started LibreOffice Online WebSocket Daemon" +# NB. : we need a stupid *re*start because the service is in fact already started during the damn package install ... so it won't find a recent "Ready to accept connection" match ... +ynh_systemd_action --service_name="loolwsd" --action="restart" --log_path="systemd" --line_match="Ready to accept connections" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index 045bc9b..5078f9f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -68,7 +68,7 @@ ynh_restore_file --origin_path="/etc/loolwsd/loolwsd.xml" #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name="loolwsd" --action="restart" --log_path="systemd" --line_match="Started LibreOffice Online WebSocket Daemon" +ynh_systemd_action --service_name="loolwsd" --action="restart" --log_path="systemd" --line_match="Ready to accept connections" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 3bad87d..e755dff 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -89,17 +89,7 @@ ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos # UPGRADE CONFIG #================================================= -config="/etc/loolwsd/loolwsd.xml" - -ynh_backup_if_checksum_is_different --file="$config" - -cp -f ../conf/loolwsd.xml $config - -ynh_replace_string "__NEXTCLOUD_DOMAIN__" "$nextcloud_domain" "$config" -ynh_replace_string "__PASSWORD__" "$password" "$config" - -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$config" +ynh_add_config "../conf/loolwsd.xml" "/etc/loolwsd/loolwsd.xml" #================================================= # GENERIC FINALIZATION @@ -117,7 +107,7 @@ ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name="loolwsd" --action="restart" --log_path="systemd" --line_match="Started LibreOffice Online WebSocket Daemon" +ynh_systemd_action --service_name="loolwsd" --action="restart" --log_path="systemd" --line_match="Ready to accept connections" #================================================= # RELOAD NGINX