1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/collabora_ynh.git synced 2024-09-03 18:16:25 +02:00

Merge pull request #84 from YunoHost-Apps/manifestv2

Manifestv2 bis
This commit is contained in:
Salamandar 2024-01-29 17:09:23 +01:00 committed by GitHub
commit b7185e08da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 199 additions and 410 deletions

View file

@ -35,30 +35,6 @@ Collabora Online is a powerful LibreOffice-based online office that supports all
![Screenshot of Collabora Online](./doc/screenshots/Nextcloud-writer.png) ![Screenshot of Collabora Online](./doc/screenshots/Nextcloud-writer.png)
## Disclaimers / important information
## Configuration
**Settings:**
The settings of Collabora are at `https://office.domain.tld/browser/dist/admin/admin.html`.
- User: admin
- Password: The password set during the installation. (If you forgot it, you can find it again in `/etc/coolwsd/coolwsd.xml`).
## Connexion to Nextcloud
If you want to connect with Nextcloud, you have to install the [Collabora Online](https://apps.nextcloud.com/apps/richdocuments) app in Nextcloud, and configure it with the domain of your Collabora installation.
*:warning: There are several Collabora Online apps. Be sure **not** to install the `Collabora Online - Built-in CODE server` apps, which are a lightwheigt version of this Collabora package. :warning:*
## Limitations
**ARM platform not supported.** If you want to run Collabora on Nextcloud, there is a lightweight version of the Collabora server for ARM, called [Collabora Online - Built-in CODE Server (ARM64)](https://apps.nextcloud.com/apps/richdocumentscode_arm64) which can easily connect with the [Collabora Online](https://apps.nextcloud.com/apps/richdocuments) app.
**CODE has a warning limitation**
![](https://www.libreoffice.org/assets/Uploads/LibreOffice-Online-limit.png)
## Documentation and resources ## Documentation and resources
* Official app website: <https://collaboraoffice.com> * Official app website: <https://collaboraoffice.com>

View file

@ -34,30 +34,6 @@ Collabora Online est une suite bureautique en ligne open source basé sur LibreO
![Capture décran de Collabora Online](./doc/screenshots/Nextcloud-writer.png) ![Capture décran de Collabora Online](./doc/screenshots/Nextcloud-writer.png)
## Avertissements / informations importantes
## Configuration
**Paramètres :**
Les paramètres de Collabora sont à `https://office.domain.tld/browser/dist/admin/admin.html`.
- Utilisateur : admin
- Mot de passe : Le mot de passe défini lors de l'installation. (Si vous l'avez oublié, vous pouvez le retrouver dans `/etc/coolwsd/coolwsd.xml`).
## Connexion à Nextcloud
Si vous souhaitez vous connecter à Nextcloud, vous devez installer l'application [Collabora Online](https://apps.nextcloud.com/apps/richdocuments) dans Nextcloud, et la configurer avec le domaine de votre installation Collabora.
*:warning: Il existe plusieurs applications Collabora Online. Assurez-vous **de ne pas** installer les applications `Collabora Online - Built-in CODE server`, qui sont une version allégée de ce package Collabora. :warning:*
## Limites
**Plateforme ARM non prise en charge.** Si vous souhaitez exécuter Collabora sur Nextcloud, il existe une version allégée du serveur Collabora pour ARM, appelée [Collabora Online - Built-in CODE Server (ARM64)](https://apps.nextcloud.com/apps/richdocumentscode_arm64) qui peut facilement se connecter à l'application [Collabora Online](https://apps.nextcloud.com/apps/richdocuments).
**CODE a une limitation d'avertissement**
![](https://www.libreoffice.org/assets/Uploads/LibreOffice-Online-limit.png)
## Documentations et ressources ## Documentations et ressources
* Site officiel de lapp : <https://collaboraoffice.com> * Site officiel de lapp : <https://collaboraoffice.com>

View file

@ -1,19 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
password="1Strong-Password"
nextcloud_domain="nextcloud.tld"
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=1
setup_nourl=0
setup_private=0
setup_public=1
upgrade=1
backup_restore=1
multi_instance=0
change_url=0
;;; Options
Email=
Notification=none

View file

@ -1,8 +1,4 @@
rewrite ^$ /; # rewrite ^$ / permanent;
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 # static files
location ^~ /browser { location ^~ /browser {
@ -50,3 +46,8 @@ location ^~ /cool/adminws {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_read_timeout 36000s; proxy_read_timeout 36000s;
} }
location / {
alias __INSTALL_DIR__/;
index index.html;
}

7
conf/root_index.html Normal file
View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<head></head>
<body>
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.
</body>
</html>

13
doc/ADMIN.md Normal file
View file

@ -0,0 +1,13 @@
## Configuration
**Settings:**
The settings of Collabora are at `https://__DOMAIN__/browser/dist/admin/admin.html`.
- User: admin
- Password: The password set during the installation. (If you forgot it, you can find it again in `/etc/coolwsd/coolwsd.xml`).
## Connection to Nextcloud
If you want to connect with Nextcloud, you have to install the [Collabora Online](https://apps.nextcloud.com/apps/richdocuments) app in Nextcloud, and configure it with the domain of your Collabora installation.
*:warning: There are several Collabora Online apps. Be sure **not** to install the `Collabora Online - Built-in CODE server` apps, which are a lightwheigt version of this Collabora package. :warning:*

View file

@ -1,7 +1,7 @@
## Configuration ## Configuration
**Paramètres :** **Paramètres :**
Les paramètres de Collabora sont à `https://office.domain.tld/browser/dist/admin/admin.html`. Les paramètres de Collabora sont à `https://__DOMAIN__/browser/dist/admin/admin.html`.
- Utilisateur : admin - Utilisateur : admin
- Mot de passe : Le mot de passe défini lors de l'installation. (Si vous l'avez oublié, vous pouvez le retrouver dans `/etc/coolwsd/coolwsd.xml`). - Mot de passe : Le mot de passe défini lors de l'installation. (Si vous l'avez oublié, vous pouvez le retrouver dans `/etc/coolwsd/coolwsd.xml`).
@ -11,11 +11,4 @@ Les paramètres de Collabora sont à `https://office.domain.tld/browser/dist/adm
Si vous souhaitez vous connecter à Nextcloud, vous devez installer l'application [Collabora Online](https://apps.nextcloud.com/apps/richdocuments) dans Nextcloud, et la configurer avec le domaine de votre installation Collabora. Si vous souhaitez vous connecter à Nextcloud, vous devez installer l'application [Collabora Online](https://apps.nextcloud.com/apps/richdocuments) dans Nextcloud, et la configurer avec le domaine de votre installation Collabora.
*:warning: Il existe plusieurs applications Collabora Online. Assurez-vous **de ne pas** installer les applications `Collabora Online - Built-in CODE server`, qui sont une version allégée de ce package Collabora. :warning:* *:warning: Il existe plusieurs applications Collabora Online. Assurez-vous **de ne pas** installer les applications `Collabora Online - Built-in CODE server`, qui sont une version allégée de ce package Collabora. :warning:*
ice-Online-limit.png)
## Limites
**Plateforme ARM non prise en charge.** Si vous souhaitez exécuter Collabora sur Nextcloud, il existe une version allégée du serveur Collabora pour ARM, appelée [Collabora Online - Built-in CODE Server (ARM64)](https://apps.nextcloud.com/apps/richdocumentscode_arm64) qui peut facilement se connecter à l'application [Collabora Online](https://apps.nextcloud.com/apps/richdocuments).
**CODE a une limitation d'avertissement**
![](https://www.libreoffice.org/assets/Uploads/LibreOffice-Online-limit.png)

View file

@ -1,21 +0,0 @@
## Configuration
**Settings:**
The settings of Collabora are at `https://office.domain.tld/browser/dist/admin/admin.html`.
- User: admin
- Password: The password set during the installation. (If you forgot it, you can find it again in `/etc/coolwsd/coolwsd.xml`).
## Connexion to Nextcloud
If you want to connect with Nextcloud, you have to install the [Collabora Online](https://apps.nextcloud.com/apps/richdocuments) app in Nextcloud, and configure it with the domain of your Collabora installation.
*:warning: There are several Collabora Online apps. Be sure **not** to install the `Collabora Online - Built-in CODE server` apps, which are a lightwheigt version of this Collabora package. :warning:*
## Limitations
**ARM platform not supported.** If you want to run Collabora on Nextcloud, there is a lightweight version of the Collabora server for ARM, called [Collabora Online - Built-in CODE Server (ARM64)](https://apps.nextcloud.com/apps/richdocumentscode_arm64) which can easily connect with the [Collabora Online](https://apps.nextcloud.com/apps/richdocuments) app.
**CODE has a warning limitation**
![](https://www.libreoffice.org/assets/Uploads/LibreOffice-Online-limit.png)

1
doc/POST_INSTALL.md Normal file
View file

@ -0,0 +1 @@
You can now use Collabora Online with Nextcloud, see the admin panel for more information!

8
doc/PRE_INSTALL.md Normal file
View file

@ -0,0 +1,8 @@
## ARM platform not supported
If you want to run Collabora on Nextcloud, there is a lightweight version of the Collabora server for ARM, called [Collabora Online - Built-in CODE Server (ARM64)](https://apps.nextcloud.com/apps/richdocumentscode_arm64) which can easily connect with the [Nextcloud Office](https://apps.nextcloud.com/apps/richdocuments) app.
## Usage limitation
![LibreOffice online has a warning when more than 10 documents or more than 20 connections are in use.](https://www.libreoffice.org/assets/Uploads/LibreOffice-Online-limit.png)

7
doc/PRE_INSTALL_fr.md Normal file
View file

@ -0,0 +1,7 @@
## Plateforme ARM non prise en charge
Si vous souhaitez exécuter Collabora sur Nextcloud, il existe une version allégée du serveur Collabora pour ARM, appelée [Collabora Online - Built-in CODE Server (ARM64)](https://apps.nextcloud.com/apps/richdocumentscode_arm64) qui peut facilement se connecter à l'application [Collabora Online](https://apps.nextcloud.com/apps/richdocuments).
## Avertissement de limite d'usage
![LibreOffice online a un avertissement quand plus de 10 documents ou plus de 20 connections sont utilisées.](https://www.libreoffice.org/assets/Uploads/LibreOff

View file

@ -1,50 +0,0 @@
{
"name": "Collabora Online",
"id": "collabora",
"packaging_format": 1,
"description": {
"en": "LibreOffice-based online office suite with collaborative editing",
"fr": "Suite office en ligne et collaborative, basée sur LibreOffice"
},
"version": "22.05.14.3~ynh1",
"url": "https://collaboraoffice.com",
"upstream": {
"license": "MPL-2.0",
"website": "https://collaboraoffice.com",
"admindoc": "https://www.collaboraoffice.com/code/"
},
"license": "MPL-2.0",
"maintainer": {
"name": "rafi59",
"email": "rafi59_dev@srvmaison.fr.nf"
},
"requirements": {
"yunohost": ">= 11.2"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain"
},
{
"name": "password",
"type": "password"
},
{
"name": "nextcloud_domain",
"type": "string",
"ask": {
"en": "The domain of your Nextcloud instance",
"fr": "Le domain de votre instance Nextcloud"
},
"example": "example.com/nextcloud",
"default": ""
}
]
}
}

75
manifest.toml Normal file
View file

@ -0,0 +1,75 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "collabora"
name = "Collabora Online"
description.en = "LibreOffice-based online office suite with collaborative editing"
description.fr = "Suite office en ligne et collaborative, basée sur LibreOffice"
version = "22.05.14.3~ynh1"
maintainers = ["rafi59"]
[upstream]
license = "MPL-2.0"
website = "https://collaboraoffice.com"
admindoc = "https://www.collaboraoffice.com/code/"
cpe = "cpe:2.3:a:collabora:online"
[integration]
yunohost = ">= 11.2"
architectures = ["amd64", "i386", "arm64"]
multi_instance = false
ldap = "not_relevant"
sso = "not_relevant"
disk = "1G"
ram.build = "300M"
ram.runtime = "600M"
[install]
[install.domain]
type = "domain"
[install.init_main_permission]
help.en = "You will only be able to connect Collabora to Nextcloud if both apps are public!"
help.fr = "Nextcloud et Collabora doivent être des applications publiques si vous voulez les connecter !"
type = "group"
default = "visitors"
[install.password]
type = "password"
[install.nextcloud_domain]
ask.en = "The domain of your Nextcloud instance"
ask.fr = "Le domain de votre instance Nextcloud"
type = "string"
example = "example.com/nextcloud"
default = ""
[resources]
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.ports]
main.default = 9980
[resources.apt]
packages = [
"hunspell-de-de",
"hunspell-en-gb",
"hunspell-fr",
"hunspell",
]
[resources.apt.extras.collabora]
repo = "deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian11 ./ "
key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D"
packages = [
"coolwsd",
"code-brand"
]

View file

@ -4,9 +4,6 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# dependencies used by the app
pkg_dependencies="coolwsd code-brand hunspell-de-de hunspell-en-gb hunspell-fr hunspell"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================

View file

@ -10,30 +10,17 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================
ynh_print_info --message="Declaring files to be backed up..." ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
@ -41,9 +28,7 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# SPECIFIC BACKUP # BACKUP VARIOUS FILES
#=================================================
# BACKUP CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/coolwsd/coolwsd.xml" ynh_backup --src_path="/etc/coolwsd/coolwsd.xml"

View file

@ -10,59 +10,19 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # INITIALIZE AND STORE SETTINGS
#================================================= #=================================================
ynh_clean_setup () { ynh_app_setting_set --app="$app" --key=password --value="$password"
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
domain=$YNH_APP_ARG_DOMAIN ynh_add_config --template="root_index.html" --destination="$install_dir/index.html"
path_url="/"
password=$YNH_APP_ARG_PASSWORD
nextcloud_domain=$YNH_APP_ARG_NEXTCLOUD_DOMAIN
app=$YNH_APP_INSTANCE_NAME chown -R "$app:www-data" "$install_dir"
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
if dpkg-architecture --is armhf
then
ynh_die --message="Sorry, this app can not be installed on an ARM architecture"
fi
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=password --value=$password
ynh_app_setting_set --app=$app --key=nextcloud_domain --value=$nextcloud_domain
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=1
# Find a free port
port=$(ynh_find_port --port=9980)
ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
# CONFIGURE ONLYOFFICE # CONFIGURE ONLYOFFICE
@ -74,30 +34,19 @@ ynh_script_progression --message="Installing config file..." --weight=2
# config directory which of course doesn't exists and we want to disable SSL # config directory which of course doesn't exists and we want to disable SSL
# because we're in a reverse proxy context... # because we're in a reverse proxy context...
mkdir -p /etc/coolwsd mkdir -p /etc/coolwsd
ynh_add_config --template="../conf/coolwsd.xml" --destination="/etc/coolwsd/coolwsd.xml" ynh_add_config --template="coolwsd.xml" --destination="/etc/coolwsd/coolwsd.xml"
chmod 640 "/etc/coolwsd/coolwsd.xml" chmod 640 "/etc/coolwsd/coolwsd.xml"
chown cool:root -R /etc/coolwsd
#================================================= #=================================================
# INSTALL DEPENDENCIES # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=10 ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
DEBIAN_VERSION_NUMBER=$(cat /etc/debian_version | head -n 1 | cut -f1 -d .)
ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian${DEBIAN_VERSION_NUMBER} ./ " --package="$pkg_dependencies" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D" 2>/dev/null
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=3
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log" yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log"
#================================================= #=================================================
@ -107,23 +56,13 @@ yunohost service add "coolwsd" --description="Collabora online office suite" --l
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=5 ynh_script_progression --message="Starting a systemd service..." --weight=5
# Start a systemd service
# 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 ... # 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="coolwsd" --action="restart" --log_path="systemd" --line_match="Ready to accept connections" ynh_systemd_action --service_name="coolwsd" --action="stop" --log_path="systemd"
# The service installed by the deb package failed in loop, thus the reset-failed.
systemctl reset-failed coolwsd
#================================================= # Start a systemd service
# SETUP SSOWAT ynh_systemd_action --service_name="coolwsd" --action="start" --log_path="systemd" --line_match="Ready to accept connections"
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
ynh_permission_update --permission="main" --add="visitors" --show_tile="false"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -10,63 +10,30 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status "coolwsd" >/dev/null if ynh_exec_warn_less yunohost service status "coolwsd" >/dev/null; then
then yunohost service remove "coolwsd"
ynh_script_progression --message="Removing coolwsd service integration..." --weight=1
yunohost service remove "coolwsd"
fi fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config --service="coolwsd" ynh_remove_systemd_config --service="coolwsd"
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Fix "rm: cannot remove '/etc/apt/apt.conf.d/25loolwsd': No such file or directory"
# on apt remove
touch /etc/apt/apt.conf.d/25loolwsd
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# Remove a directory securely # Remove a directory securely
ynh_secure_remove --file="/etc/coolwsd" ynh_secure_remove --file="/etc/coolwsd"
# FIXME: is it still required?
# Fix "rm: cannot remove '/etc/apt/apt.conf.d/25loolwsd': No such file or directory"
# on apt remove
touch /etc/apt/apt.conf.d/25loolwsd
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -11,32 +11,16 @@ source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_clean_setup () { ynh_restore_file --origin_path="$install_dir"
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= ### $install_dir will automatically be initialized with some decent
# LOAD SETTINGS ### permissions by default ... however, you may need to recursively reapply
#================================================= ### ownership to all files such as after the ynh_setup_source step
ynh_script_progression --message="Loading settings..." --weight=1 chown -R "$app:www-data" "$install_dir"
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE CONFIGURATION # RESTORE CONFIGURATION
@ -44,36 +28,33 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_script_progression --message="Restoring the configuration..." --weight=3 ynh_script_progression --message="Restoring the configuration..." --weight=3
ynh_restore_file --origin_path="/etc/coolwsd/coolwsd.xml" ynh_restore_file --origin_path="/etc/coolwsd/coolwsd.xml"
chmod 640 "/etc/coolwsd/coolwsd.xml" chmod 640 "/etc/coolwsd/coolwsd.xml"
chown cool:root -R /etc/coolwsd
#================================================= #=================================================
# SPECIFIC RESTORATION # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
# REINSTALL DEPENDENCIES ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=10
DEBIAN_VERSION_NUMBER=$(cat /etc/debian_version | head -n 1 | cut -f1 -d .) ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian${DEBIAN_VERSION_NUMBER} ./ " --package="$pkg_dependencies" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D" 2>/dev/null
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log" yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=5
ynh_systemd_action --service_name="coolwsd" --action="restart" --log_path="systemd" --line_match="Ready to accept connections" # 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="coolwsd" --action="stop" --log_path="systemd"
# The service installed by the deb package failed in loop, thus the reset-failed.
systemctl reset-failed coolwsd
#================================================= # Start a systemd service
# RELOAD NGINX ynh_systemd_action --service_name="coolwsd" --action="start" --log_path="systemd" --line_match="Ready to accept connections"
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -9,73 +9,26 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app="$app" --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
port=$(ynh_app_setting_get --app=$app --key=port)
password=$(ynh_app_setting_get --app="$app" --key=password)
nextcloud_domain=$(ynh_app_setting_get --app="$app" --key=nextcloud_domain)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2 ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
if ynh_compare_current_package_version --comparison le --version 6.4.10~ynh2 if ynh_compare_current_package_version --comparison le --version 6.4.10~ynh2; then
then ynh_die --message="Upgrade from version 6.4.10 is not possible. You must uninstall and reinstall Collabora package manually"
ynh_die --message="Upgrade from version 6.4.10 is not possible. You must uninstall and reinstall Collabora package manually"
fi fi
# If db_name doesn't exist, create it
if [ -z "$path_url" ]; then
path_url="/"
ynh_app_setting_set --app=$app --key=path_url --value=$path_url
fi
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_clean_check_starting
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# REMOVE OLD SERVICE INTEGRATION IN YUNOHOST # REMOVE OLD SERVICE INTEGRATION IN YUNOHOST
#================================================= #=================================================
# Remove the old service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the old service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status "loolwsd" >/dev/null if ynh_exec_warn_less yunohost service status "loolwsd" >/dev/null; then
then ynh_script_progression --message="Removing loolwsd service integration..." --weight=1
ynh_script_progression --message="Removing loolwsd service integration..." --weight=1 yunohost service remove "loolwsd"
yunohost service remove "loolwsd"
fi fi
#================================================= # Remove the legacy systemd config
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the old systemd service..." --weight=1
# Remove the dedicated systemd config
ynh_remove_systemd_config --service="loolwsd" ynh_remove_systemd_config --service="loolwsd"
#================================================= #=================================================
@ -88,12 +41,13 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=5
ynh_systemd_action --service_name="coolwsd" --action="stop" --log_path="systemd" --line_match="Stopped Collabora Online WebSocket Daemon" ynh_systemd_action --service_name="coolwsd" --action="stop" --log_path="systemd" --line_match="Stopped Collabora Online WebSocket Daemon"
#================================================= #=================================================
# NGINX CONFIGURATION # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 ynh_script_progression --message="Setting up source files..." --weight=1
# Create a dedicated NGINX config ynh_add_config --template="root_index.html" --destination="$install_dir/index.html"
ynh_add_nginx_config
chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
# UPGRADE CONFIG # UPGRADE CONFIG
@ -106,17 +60,12 @@ chown cool: "/etc/coolwsd/coolwsd.xml"
chmod 640 "/etc/coolwsd/coolwsd.xml" chmod 640 "/etc/coolwsd/coolwsd.xml"
#================================================= #=================================================
# UPGRADE DEPENDENCIES # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=10 ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
DEBIAN_VERSION_NUMBER=$(cat /etc/debian_version | head -n 1 | cut -f1 -d .) # Create a dedicated NGINX config
ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian${DEBIAN_VERSION_NUMBER} ./ " --package="$pkg_dependencies" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D" 2>/dev/null ynh_add_nginx_config
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log" yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log"
@ -127,13 +76,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3
ynh_systemd_action --service_name="coolwsd" --action="restart" --log_path="systemd" --line_match="Ready to accept connections" ynh_systemd_action --service_name="coolwsd" --action="restart" --log_path="systemd" --line_match="Ready to accept connections"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

11
tests.toml Normal file
View file

@ -0,0 +1,11 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0
[default]
args.nextcloud_domain = "nextcloud.tld"
exclude = ["change_url"]
# test_upgrade_from.5725c85c09f1d3b76d12a4dc4d367ec911cd0019.name = "Last packaging v1 version"