1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/onlyoffice_ynh.git synced 2024-09-03 19:56:11 +02:00

Merge pull request #116 from YunoHost-Apps/manifestv2

Manifest v2 bis
This commit is contained in:
Salamandar 2024-03-19 15:35:57 +01:00 committed by GitHub
commit 2c33ba2252
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 253 additions and 1023 deletions

View file

@ -1,65 +0,0 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

View file

@ -1,49 +0,0 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

24
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,24 @@
{
"python.autoComplete.extraPaths": [
"${workspaceFolder}/sources/poky/bitbake/lib",
"${workspaceFolder}/sources/poky/meta/lib"
],
"python.analysis.extraPaths": [
"${workspaceFolder}/sources/poky/bitbake/lib",
"${workspaceFolder}/sources/poky/meta/lib"
],
"[python]": {
"diffEditor.ignoreTrimWhitespace": false,
"gitlens.codeLens.symbolScopes": [
"!Module"
],
"editor.formatOnType": true,
"editor.wordBasedSuggestions": "off",
"files.trimTrailingWhitespace": false
},
"[shellscript]": {
"files.eol": "\n",
"files.trimTrailingWhitespace": false
},
"task.saveBeforeRun": "always"
}

View file

@ -35,59 +35,8 @@ A solution made easy by YunoHost is to install (1.i) and (2.i), see [section bel
## Screenshots
![Screenshot of OnlyOffice](./doc/screenshots/document-short.png)
## Disclaimers / important information
## Demo
* A free 30 days demo of Document Server is available from ONLYOFFICE connector for Nextcloud:
* Install Nextcloud and the ONLYOFFICE app (connector).
* Go in the Nextcloud administrator settings, section ONLYOFFICE.
* Tick the box `Connection to demo ONLYOFFICE Document Server` in Server Parameters.
* Some testing is also possible using [ONLYOFFICE Desktop Editor](https://www.onlyoffice.com/fr/download-desktop.aspx).
## Prerequisite
You should not install ONLYOFFICE on your main YunoHost domain, especially if you want to use it with a Nextcloud installed on the same domain.
* Add a new domain for ONLYOFFICE in YunoHost.
* If your main YunoHost domain was provided by YunoHost, e.g. `domain.nohost.me`, then you don't have to buy/register a new domain name.
* Just click on `I already have a domain`.
* Type e.g. `office.domain.nohost.me` and click on `Add`.
* Add a Let's Encrypt certificate for this domain.
## Configuration of ONLYOFFICE Server
* Assuming that:
* `yunohost.domain` is your main YunoHost domain.
* You have configured `office.yunohost.domain` for ONLYOFFICE, see Prerequisite above.
* You have Nextcloud installed on `yunohost.domain/nextcloud` or `nextcloud.yunohost.domain`.
* Install `ONLYOFFICE` using CLI or webadmin.
* Choose a domain name for ONLYOFFICE that is different from your Nextcloud domain, e.g. `office.yunohost.domain` (or `office.domain.nohost.me`, see previous section).
* Choose a path for ONLYOFFICE, e.g. `/` if you install on `office.yunohost.domain` (do not install any other app on this domain).
* The domain of your Nextcloud instance, e.g. `yunohost.domain/nextcloud` or `nextcloud.yunohost.domain`.
* Is it a public application? **If you want to connect it to Nextcloud, ONLYOFFICE should be public**: then select `Yes` or `tick the box`.
## How to edit ONLYOFFICE documents?
### Web Edition in Nextcloud
Prerequisite: **ONLYOFFICE should be public**, see previous section.
* In Nextcloud apps store, install `ONLYOFFICE`, i.e. the [ONLYOFFICE connector for Nextcloud](https://apps.nextcloud.com/apps/onlyoffice).
* Go in the Nextcloud `settings` > `Administration` > `ONLYOFFICE` > `Server settings` > `Address of the Document Server`.
* Give the installation domain of your `onlyoffice`, e.g. `https://office.yunohost.domain/`.
* Give the secret key that was sent to you by email during the install (you can also retrieve it with the CLI command `sudo documentserver-jwt-status.sh`).
* Click `Save`.
* Create a new document and enjoy!
### Desktop Edition on PC
* Download and install a [ONLYOFFICE Desktop Editors](https://www.onlyoffice.com/fr/download-desktop.aspx).
* Start ONLYOFFICE and Go to `Connect to cloud` > `Add cloud`.
* Select `ONLYOFFICE` and give the installation domain of your `ONLYOFFICE`, e.g. `office.yunohost.domain`
* or (only if you connected `ONLYOFFICE` to Nextcloud, see previous section).
* Select `Nextcloud` and give your Nextcloud installation domain, e.g. `yunohost.domain/nextcloud`.
* Create a new document and enjoy!
![Screenshot of OnlyOffice](./doc/screenshots/01-presentation.jpg)
![Screenshot of OnlyOffice](./doc/screenshots/02-document-short.png)
## Documentation and resources

View file

@ -35,59 +35,8 @@ Une solution rendue facile par YunoHost est d'installer (1.i) et (2.i), voir [ci
## Captures décran
![Capture décran de OnlyOffice](./doc/screenshots/document-short.png)
## Avertissements / informations importantes
## Démo
* Une démo gratuite de 30 jours de Document Server est disponible à partir du connecteur ONLYOFFICE pour Nextcloud:
* Installez Nextcloud et l'application ONLYOFFICE (connector).
* Allez dans les paramètres de l'administrateur Nextcloud, section ONLYOFFICE.
* Cochez la case `Connexion à la démonstration ONLYOFFICE Document Server` dans les paramètres du serveur.
* Certains tests sont également possibles en utilisant [ONLYOFFICE Desktop Editor](https://www.onlyoffice.com/fr/download-desktop.aspx).
## Prérequis
Vous ne devez pas installer ONLYOFFICE sur votre domaine YunoHost principal, surtout si vous souhaitez l'utiliser avec une instance Nextcloud installée sur le même domaine.
* Ajouter un nouveau domaine pour ONLYOFFICE dans YunoHost
* Si votre domaine YunoHost principal a été fourni par YunoHost, par exemple `domain.nohost.me`, alors vous n'avez pas à acheter/enregistrer un nouveau nom de domaine.
* Cliquez simplement sur `J'ai déjà un nom de domaine`.
* Tapez par exemple `office.domain.nohost.me` et cliquez sur `Ajouter`.
* Ajoutez un certificat Let's Encrypt pour ce domaine.
## Configuration de ONLYOFFICE Server
* Supposons que :
* `yunohost.domain` est votre domaine principal YunoHost.
* Vous avez configuré `office.yunohost.domain` pour ONLYOFFICE, voir Prérequis ci-dessus
* Vous avez Nextcloud installé sur `yunohost.domain / nextcloud` ou `nextcloud.yunohost.domain`.
* Installez `ONLYOFFICE` à l'aide de la CLI ou de l'administrateur Web
* choisissez un nom de domaine pour ONLYOFFICE différent de votre domaine Nextcloud, par exemple `office.yunohost.domain` (ou `office.domain.nohost.me`, voir section précédente).
* Choisissez un chemin pour ONLYOFFICE, par exemple `/` si vous installez sur `office.yunohost.domain` (n'installez aucune autre application sur ce domaine).
* Le domaine de votre instance Nextcloud, par exemple `yunohost.domain / nextcloud` ou `nextcloud.yunohost.domain`.
* Est-ce une application publique ? **Si vous souhaitez le connecter à Nextcloud, ONLYOFFICE doit être public** : puis sélectionnez `Oui` ou `cochez la case`.
## Comment éditer des documents ONLYOFFICE ?
### Web Édition dans Nextcloud
Prérequis : **ONLYOFFICE doit être public**, voir la section précédente.
* dans le magasin d'applications Nextcloud, installez `ONLYOFFICE`, c'est-à-dire le [connecteur ONLYOFFICE pour Nextcloud](https://apps.nextcloud.com/apps/onlyoffice)
* Allez dans Nextcloud `Paramètres` > `Administration` > `ONLYOFFICE` > `Paramètres du serveur` > `Adresse du service d'édition de document`.
* Spécifiez le domaine d'installation de votre serveur `ONLYOFFICE`, par exemple `https://office.yunohost.domain/`.
* Renseignez la clé secrète qui vous a été envoyée par email lors de l'installation (vous pouvez aussi la retrouve avec la ligne de commande `sudo documentserver-jwt-status.sh`).
* Cliquez sur `Enregistrer`.
* Créez un nouveau document !
### Desktop Édition sur PC
* Téléchargez et installez [ONLYOFFICE Desktop Editors](https://www.onlyoffice.com/fr/download-desktop.aspx)
* Démarrez l'éditeur et allez dans `Connecter au Cloud` > `Ajouter cloud`
* sélectionnez ONLYOFFICE et indiquez le domaine d'installation de votre server ONLYOFFICE, par ex. `office.yunohost.domain`
* ou (uniquement si vous avez connecté `ONLYOFFICE` à Nextcloud, voir section précédente).
* Sélectionnez `Nextcloud` et donnez votre domaine d'installation Nextcloud, par exemple `yunohost.domain/nextcloud`.
* Créez un nouveau document !
![Capture décran de OnlyOffice](./doc/screenshots/01-presentation.jpg)
![Capture décran de OnlyOffice](./doc/screenshots/02-document-short.png)
## Documentations et ressources

View file

@ -1,27 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
path="/path"
is_public=1
nextclouddomain="domain.tld"
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
#7.3.3~ynh1
upgrade=1 from_commit=205cc12c26b46c57ba8459f449e835949be44096
backup_restore=1
multi_instance=0
port_already_use=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=205cc12c26b46c57ba8459f449e835949be44096
name=7.3.3~ynh1
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -6,13 +6,13 @@ location __PATH__/ {
proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection $proxy_connection;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Host $server_name__SUB_PATH__;
proxy_set_header X-Forwarded-Host $server_name__PATH_NO_SLASH__;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
more_set_headers "X-Frame-Options : ALLOW-FROM https://__NEXTCLOUDDOMAIN__ always";
client_max_body_size 10M;
}

View file

@ -9,6 +9,7 @@
## Prerequisite
You should not install ONLYOFFICE on your main YunoHost domain, especially if you want to use it with a Nextcloud installed on the same domain.
* Add a new domain for ONLYOFFICE in YunoHost.
* If your main YunoHost domain was provided by YunoHost, e.g. `domain.nohost.me`, then you don't have to buy/register a new domain name.
* Just click on `I already have a domain`.
@ -32,6 +33,7 @@ You should not install ONLYOFFICE on your main YunoHost domain, especially if yo
### Web Edition in Nextcloud
Prerequisite: **ONLYOFFICE should be public**, see previous section.
* In Nextcloud apps store, install `ONLYOFFICE`, i.e. the [ONLYOFFICE connector for Nextcloud](https://apps.nextcloud.com/apps/onlyoffice).
* Go in the Nextcloud `settings` > `Administration` > `ONLYOFFICE` > `Server settings` > `Address of the Document Server`.
* Give the installation domain of your `onlyoffice`, e.g. `https://office.yunohost.domain/`.

View file

@ -1,37 +1,39 @@
## Démo
* Une démo gratuite de 30 jours de Document Server est disponible à partir du connecteur ONLYOFFICE pour Nextcloud:
* Installez Nextcloud et l'application ONLYOFFICE (connector).
* Allez dans les paramètres de l'administrateur Nextcloud, section ONLYOFFICE.
* Cochez la case `Connexion à la démonstration ONLYOFFICE Document Server` dans les paramètres du serveur.
* Installez Nextcloud et l'application ONLYOFFICE (connector).
* Allez dans les paramètres de l'administrateur Nextcloud, section ONLYOFFICE.
* Cochez la case `Connexion à la démonstration ONLYOFFICE Document Server` dans les paramètres du serveur.
* Certains tests sont également possibles en utilisant [ONLYOFFICE Desktop Editor](https://www.onlyoffice.com/fr/download-desktop.aspx).
## Prérequis
Vous ne devez pas installer ONLYOFFICE sur votre domaine YunoHost principal, surtout si vous souhaitez l'utiliser avec une instance Nextcloud installée sur le même domaine.
* Ajouter un nouveau domaine pour ONLYOFFICE dans YunoHost
* Si votre domaine YunoHost principal a été fourni par YunoHost, par exemple `domain.nohost.me`, alors vous n'avez pas à acheter/enregistrer un nouveau nom de domaine.
* Cliquez simplement sur `J'ai déjà un nom de domaine`.
* Tapez par exemple `office.domain.nohost.me` et cliquez sur `Ajouter`.
* Si votre domaine YunoHost principal a été fourni par YunoHost, par exemple `domain.nohost.me`, alors vous n'avez pas à acheter/enregistrer un nouveau nom de domaine.
* Cliquez simplement sur `J'ai déjà un nom de domaine`.
* Tapez par exemple `office.domain.nohost.me` et cliquez sur `Ajouter`.
* Ajoutez un certificat Let's Encrypt pour ce domaine.
## Configuration de ONLYOFFICE Server
* Supposons que :
* `yunohost.domain` est votre domaine principal YunoHost.
* Vous avez configuré `office.yunohost.domain` pour ONLYOFFICE, voir Prérequis ci-dessus
* Vous avez Nextcloud installé sur `yunohost.domain / nextcloud` ou `nextcloud.yunohost.domain`.
* `yunohost.domain` est votre domaine principal YunoHost.
* Vous avez configuré `office.yunohost.domain` pour ONLYOFFICE, voir Prérequis ci-dessus
* Vous avez Nextcloud installé sur `yunohost.domain / nextcloud` ou `nextcloud.yunohost.domain`.
* Installez `ONLYOFFICE` à l'aide de la CLI ou de l'administrateur Web
* choisissez un nom de domaine pour ONLYOFFICE différent de votre domaine Nextcloud, par exemple `office.yunohost.domain` (ou `office.domain.nohost.me`, voir section précédente).
* Choisissez un chemin pour ONLYOFFICE, par exemple `/` si vous installez sur `office.yunohost.domain` (n'installez aucune autre application sur ce domaine).
* Le domaine de votre instance Nextcloud, par exemple `yunohost.domain / nextcloud` ou `nextcloud.yunohost.domain`.
* Est-ce une application publique ? **Si vous souhaitez le connecter à Nextcloud, ONLYOFFICE doit être public** : puis sélectionnez `Oui` ou `cochez la case`.
* choisissez un nom de domaine pour ONLYOFFICE différent de votre domaine Nextcloud, par exemple `office.yunohost.domain` (ou `office.domain.nohost.me`, voir section précédente).
* Choisissez un chemin pour ONLYOFFICE, par exemple `/` si vous installez sur `office.yunohost.domain` (n'installez aucune autre application sur ce domaine).
* Le domaine de votre instance Nextcloud, par exemple `yunohost.domain / nextcloud` ou `nextcloud.yunohost.domain`.
* Est-ce une application publique ? **Si vous souhaitez le connecter à Nextcloud, ONLYOFFICE doit être public** : puis sélectionnez `Oui` ou `cochez la case`.
## Comment éditer des documents ONLYOFFICE ?
### Web Édition dans Nextcloud
Prérequis : **ONLYOFFICE doit être public**, voir la section précédente.
* dans le magasin d'applications Nextcloud, installez `ONLYOFFICE`, c'est-à-dire le [connecteur ONLYOFFICE pour Nextcloud](https://apps.nextcloud.com/apps/onlyoffice)
* Allez dans Nextcloud `Paramètres` > `Administration` > `ONLYOFFICE` > `Paramètres du serveur` > `Adresse du service d'édition de document`.
* Spécifiez le domaine d'installation de votre serveur `ONLYOFFICE`, par exemple `https://office.yunohost.domain/`.

View file

@ -1,11 +1,12 @@
__APP__ was successfully installed :)
To configure OnlyOffice with Nextcloud:
- Within Nextcloud, install ONLYOFFICE app
- go to the settings under "Administration > ONLYOFFICE > Server settings
- Address of the Document Server: "https://__DOMAIN____PATH_URL__"
- Address of the Document Server: "https://__DOMAIN____PATH__"
- Secret key: "__JWT_SECRET__"
OnlyOffice should now work with your Nextcloud!
If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/onlyoffice_ynh
If you are facing any problem or want to improve this app, please open a new issue here: <https://github.com/YunoHost-Apps/onlyoffice_ynh>

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 245 KiB

After

Width:  |  Height:  |  Size: 245 KiB

View file

@ -1,79 +0,0 @@
{
"name": "OnlyOffice",
"id": "onlyoffice",
"packaging_format": 1,
"description": {
"en": "Create and edit documents collaboratively",
"fr": "Créez et éditer des documents collaborativement"
},
"version": "7.5~ynh1",
"url": "https://www.onlyoffice.com",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://www.onlyoffice.com",
"demo": "https://www.onlyoffice.com/fr/download-desktop.aspx",
"code": "https://github.com/ONLYOFFICE/DocumentServer"
},
"license": "GPL-3.0-or-later",
"maintainer": {
"name": "",
"email": ""
},
"requirements": {
"yunohost": ">= 11.2"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain",
"example": "office.yunohost.domain",
"help": {
"en": "You should not install OnlyOffice on your main YunoHost domain, especially if you want to use it with a Nextcloud installed on the same domain.",
"fr": "Évitez d'installer OnlyOffice sur votre domaine YunoHost principal, surtout si vous voulez l'utiliser avec une instance Nextcloud installée sur le même domaine."
}
},
{
"name": "path",
"type": "path",
"example": "/onlyoffice or /",
"help": {
"en": "Root path / if you chose a subdomain, e.g. office.yunohost.domain.",
"fr": "Choisissez le chemin racine / si vous avez choisi un sous-domaine, ex. office.yunohost.domain."
},
"default": "/onlyoffice"
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "You will only be able to connect OnlyOffice to Nextcloud if both apps are public!",
"fr": "Nextcloud et OnlyOffice doivent être des applications publiques si vous voulez les connecter !"
},
"default": true
},
{
"name": "nextclouddomain",
"type": "string",
"ask": {
"en": "The domain of the Nextcloud to connect to OnlyOffice",
"fr": "Le domaine du Nextcloud à connecter à OnlyOffice"
},
"example": "yunohost.domain/nextcloud or nextcloud.yunohost.domain",
"help": {
"en": "Install the OnlyOffice connector to edit documents from Nextcloud.",
"fr": "Installez le connecteur OnlyOffice pour éditer des documents dans Nextcloud."
},
"default": "yunohost.domain/nextcloud"
},
{
"name": "admin",
"type": "user"
}
]
}
}

90
manifest.toml Normal file
View file

@ -0,0 +1,90 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "onlyoffice"
name = "OnlyOffice"
description.en = "Create and edit documents collaboratively"
description.fr = "Créez et éditer des documents collaborativement"
version = "7.5~ynh1"
maintainers = []
[upstream]
license = "GPL-3.0-or-later"
website = "https://www.onlyoffice.com"
demo = "https://www.onlyoffice.com/fr/download-desktop.aspx"
code = "https://github.com/ONLYOFFICE/DocumentServer"
cpe = "cpe:2.3:a:onlyoffice:document_server"
[integration]
yunohost = ">= 11.2"
architectures = ["amd64"]
multi_instance = false
ldap = "not_relevant"
sso = "not_relevant"
disk = "2000M"
ram.build = "800M"
ram.runtime = "800M"
[install]
[install.domain]
type = "domain"
# FIXME: subpath doesn't work anymore?
# [install.path]
# type = "path"
# default = "/onlyoffice"
[install.init_main_permission]
help.en = "You will only be able to connect OnlyOffice to Nextcloud if both apps are public!"
help.fr = "Nextcloud et OnlyOffice doivent être des applications publiques si vous voulez les connecter !"
type = "group"
default = "visitors"
[install.nextclouddomain]
ask.en = "The domain of the Nextcloud to connect to OnlyOffice"
ask.fr = "Le domaine du Nextcloud à connecter à OnlyOffice"
help.en = "Install the OnlyOffice connector to edit documents from Nextcloud."
help.fr = "Installez le connecteur OnlyOffice pour éditer des documents dans Nextcloud."
type = "string"
example = "yunohost.domain/nextcloud or nextcloud.yunohost.domain"
[install.admin]
type = "user"
[resources]
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.ports]
main.default = 8095
[resources.apt]
packages = [
"postgresql",
"postgresql-contrib",
"libstdc++6",
"rabbitmq-server",
"libcurl4-openssl-dev",
]
# Manual install in scripts
# [resources.apt.extras.ttf]
# repo = "deb http://deb.debian.org/debian/ bullseye main contrib"
# key = "https://ftp-master.debian.org/keys/release-bullseye.asc"
# packages = ["ttf-mscorefonts-installer"]
# Manual install in scripts
# [resources.apt.extras.onlyoffice]
# repo = "https://download.onlyoffice.com/repo/debian squeeze main"
# key = "https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE"
# packages = "onlyoffice-documentserver"
[resources.database]
type = "postgresql"

View file

@ -4,13 +4,38 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="postgresql postgresql-contrib libstdc++6 rabbitmq-server libcurl4-dev"
#=================================================
# PERSONAL HELPERS
#=================================================
_install_msfonts_deb() {
# Run this here because it's less verbose for some reason
ynh_exec_warn_less ynh_install_extra_app_dependencies \
--repo="deb http://deb.debian.org/debian/ $(lsb_release --codename --short) main contrib" \
--key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc" \
--package="ttf-mscorefonts-installer"
}
_install_onlyoffice_deb() {
echo onlyoffice-documentserver onlyoffice/ds-port select "$port" | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-host string 127.0.0.1 | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-user string "$db_user" | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-pwd password "$db_pwd" | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-name string "$db_name" | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/jwt-secret password "$jwt_secret" | debconf-set-selections
# The OnlyOffice dev had the magnificent idea to add a "nginx restart" during
# the install/configure of their package, which is awful since that will
# restart NGINX and the whole webadmin and maybe even the YunoHost command
# running the install...
# Can't do that in the manifest because we need the debconf-set-selections and postgresql already configured
ynh_exec_warn_less ynh_install_extra_app_dependencies \
--repo="https://download.onlyoffice.com/repo/debian squeeze main" \
--key="https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE" \
--package="onlyoffice-documentserver"
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
@ -18,129 +43,3 @@ pkg_dependencies="postgresql postgresql-contrib libstdc++6 rabbitmq-server libcu
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
# Send an email to inform the administrator
#
# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
# | arg: -m --app_message= - The file with the content to send to the administrator.
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
# example: "root admin@domain"
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
# example: "root admin@domain user1 user2"
# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
#
# Requires YunoHost version 4.1.0 or higher.
ynh_send_readme_to_admin() {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
local app_message
local recipients
local type
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
app_message="${app_message:-}"
recipients="${recipients:-root}"
type="${type:-install}"
# Get the value of admin_mail_html
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
admin_mail_html="${admin_mail_html:-0}"
# Retrieve the email of users
find_mails () {
local list_mails="$1"
local mail
local recipients=" "
# Read each mail in argument
for mail in $list_mails
do
# Keep root or a real email address as it is
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
then
recipients="$recipients $mail"
else
# But replace an user name without a domain after by its email
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
then
recipients="$recipients $mail"
fi
fi
done
echo "$recipients"
}
recipients=$(find_mails "$recipients")
# Subject base
local mail_subject="☁️🆈🅽🅷☁️: \`$app\`"
# Adapt the subject according to the type of mail required.
if [ "$type" = "backup" ]; then
mail_subject="$mail_subject has just been backup."
elif [ "$type" = "change_url" ]; then
mail_subject="$mail_subject has just been moved to a new URL!"
elif [ "$type" = "remove" ]; then
mail_subject="$mail_subject has just been removed!"
elif [ "$type" = "restore" ]; then
mail_subject="$mail_subject has just been restored!"
elif [ "$type" = "upgrade" ]; then
mail_subject="$mail_subject has just been upgraded!"
else # install
mail_subject="$mail_subject has just been installed!"
fi
ynh_add_config --template="$app_message" --destination="../conf/msg__to_send"
ynh_delete_file_checksum --file="../conf/msg__to_send"
local mail_message="This is an automated message from your beloved YunoHost server.
Specific information for the application $app.
$(cat "../conf/msg__to_send")"
# Store the message into a file for further modifications.
echo "$mail_message" > mail_to_send
# If a html email is required. Apply html tags to the message.
if [ "$admin_mail_html" -eq 1 ]
then
# Insert 'br' tags at each ending of lines.
ynh_replace_string "$" "<br>" mail_to_send
# Insert starting HTML tags
sed --in-place '1s@^@<!DOCTYPE html>\n<html>\n<head></head>\n<body>\n@' mail_to_send
# Keep tabulations
ynh_replace_string " " "\&#160;\&#160;" mail_to_send
ynh_replace_string "\t" "\&#160;\&#160;" mail_to_send
# Insert url links tags
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
# Insert finishing HTML tags
echo -e "\n</body>\n</html>" >> mail_to_send
# Otherwise, remove tags to keep a plain text.
else
# Remove URL tags
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
fi
# Define binary to use for mail command
if [ -e /usr/bin/bsd-mailx ]
then
local mail_bin=/usr/bin/bsd-mailx
else
local mail_bin=/usr/bin/mail.mailutils
fi
if [ "$admin_mail_html" -eq 1 ]
then
content_type="text/html"
else
content_type="text/plain"
fi
# Send the email to the recipients
cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients"
}

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -10,31 +8,13 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# 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
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE NGINX CONFIGURATION
# BACKUP THE SYSTEM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -46,6 +26,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/onlyoffice"
ynh_backup --src_path="/var/lib/onlyoffice/documentserver/App_Data/cache/files" --not_mandatory
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/var/log/$app/"
#=================================================
# BACKUP THE POSTGRESQL DATABASE
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,109 +7,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
port=$(ynh_app_setting_get --app=$app --key=port)
nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
if [ $new_path = "/" ]; then
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf"
else
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="$new_path" --target_file="../conf/nginx.conf"
fi
# Create a dedicated NGINX config
ynh_add_nginx_config "nextclouddomain"
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
ynh_change_url_nginx_config
#=================================================
# END OF SCRIPT

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -10,150 +8,32 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
# INITIALIZE AND STORE SETTINGS
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
nextclouddomain=$YNH_APP_ARG_NEXTCLOUDDOMAIN
app=$YNH_APP_INSTANCE_NAME
admin=$YNH_APP_ARG_ADMIN
admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
jwt_secret=$(ynh_string_random --length=32)
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..."
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
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..."
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=nextclouddomain --value=$nextclouddomain
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_app_setting_set --app=$app --key=jwt_secret --value=$jwt_secret
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..."
# Find an available port
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..."
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb http://deb.debian.org/debian/ $(lsb_release --codename --short) main contrib" --package="ttf-mscorefonts-installer" --key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..."
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
if [ $path_url = "/" ]; then
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf"
else
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="$path_url" --target_file="../conf/nginx.conf"
fi
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# CONFIGURE ONLYOFFICE
#=================================================
ynh_script_progression --message="Configuring OnlyOffice..."
echo onlyoffice-documentserver onlyoffice/ds-port select $port | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-host string 127.0.0.1 | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-user string $db_user | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-pwd password $db_pwd | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-selections
#JWT options
echo onlyoffice-documentserver onlyoffice/jwt-secret password $jwt_secret | debconf-set-selections
ynh_app_setting_set --app="$app" --key=jwt_secret --value="$jwt_secret"
#=================================================
# INSTALL ONLYOFFICE
#=================================================
ynh_script_progression --message="Install OnlyOffice..."
# The OnlyOffice dev had the magnificent idea to add a "nginx restart" during
# the install/configure of their package, which is awful since that will
# restart NGINX and the whole webadmin and maybe even the YunoHost command
# running the install...
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.onlyoffice.com/repo/debian squeeze main" --package="onlyoffice-documentserver" --key="https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE"
_install_msfonts_deb
_install_onlyoffice_deb
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_script_progression --message="Adding $app's configuration file..."
ynh_replace_string --match_string="\"rejectUnauthorized\": true" --replace_string="\"rejectUnauthorized\": false" --target_file="/etc/onlyoffice/documentserver/default.json"
ynh_replace_string --target_file="/etc/onlyoffice/documentserver/default.json" \
--match_string="\"rejectUnauthorized\": true" \
--replace_string="\"rejectUnauthorized\": false"
ynh_store_file_checksum --file="/etc/onlyoffice/documentserver/default.json"
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R ds:ds "$final_path"
#=================================================
# REGENERATE FONTS
#=================================================
@ -162,31 +42,27 @@ ynh_script_progression --message="Generating fonts..."
/usr/bin/documentserver-generate-allfonts.sh 2>/dev/null
#=================================================
# SETUP SSOWAT
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
# Set permissions to app files
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R ds:ds "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
if [ $path = "/" ]; then
path_no_slash=""
else
path_no_slash="$path"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
ynh_script_progression --message="Sending a readme for the admin..."
ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_mail --type='install'
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# END OF SCRIPT

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,21 +7,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE ONLYOFFICE
#=================================================
@ -40,48 +23,21 @@ ynh_secure_remove --file=/var/lib/dpkg/info/onlyoffice-documentserver.prerm
#ln -s /bin/true /usr/local/bin/supervisorctl
ynh_package_autopurge onlyoffice-documentserver
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Removing the PostgreSQL database..."
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name"
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
dpkg --configure -a
apt-key del "E09C A29F 6E17 8040 EF22 B409 8320 CA65 CB2D E8E5" 2>/dev/null
#=================================================
# REMOVE APP MAIN DIR
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
# Remove a directory securely
ynh_secure_remove --file="/etc/onlyoffice"
@ -90,17 +46,6 @@ ynh_secure_remove --file="/var/lib/onlyoffice"
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
#gpasswd -d www-data onlyoffice
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -10,95 +8,20 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port)
nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
jwt_secret=$(ynh_app_setting_get --app=$app --key=jwt_secret)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb http://deb.debian.org/debian/ buster main contrib" --package="ttf-mscorefonts-installer" --key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..."
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
#=================================================
# CONFIGURE ONLYOFFICE
# INSTALL ONLYOFFICE
#=================================================
ynh_script_progression --message="Configuring OnlyOffice..."
ynh_script_progression --message="Install OnlyOffice..."
echo onlyoffice-documentserver onlyoffice/ds-port select $port | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-host string 127.0.0.1 | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-user string $db_user | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-pwd password $db_pwd | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-selections
#JWT options
#echo onlyoffice-documentserver onlyoffice/jwt-secret password $jwt_secret | debconf-set-selections
#=================================================
# REINSTALL ONLYOFFICE
#=================================================
ynh_script_progression --message="Reinstalling OnlyOffice..."
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.onlyoffice.com/repo/debian squeeze main" --package="onlyoffice-documentserver" --key="https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE"
_install_msfonts_deb
_install_onlyoffice_deb
#=================================================
# RESTORE THE CONFIGURATION
@ -125,12 +48,17 @@ ynh_script_progression --message="Generating fonts..."
#=================================================
# Set permissions to app files
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R ds:ds "$final_path"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R ds:ds "$install_dir"
#=================================================
# GENERIC FINALIZATION
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,137 +7,23 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port)
nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
#jwt_secret=$(ynh_app_setting_get --app=$app --key=jwt_secret)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
if [ -z "$db_pwd" ]; then
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
ynh_app_setting_set --app=$app --key=db_pwd
ynh_app_setting_set --app=$app --key=psqlpwd --value=$db_pwd
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
ynh_secure_remove --file="/etc/apt/sources.list.d/onlyoffice.list"
ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb http://deb.debian.org/debian/ $(lsb_release --codename --short) main contrib" --package="ttf-mscorefonts-installer" --key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
if [ "$path_url" = "/" ]; then
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf"
else
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="$path_url" --target_file="../conf/nginx.conf"
fi
# Create a dedicated nginx config
ynh_add_nginx_config "nextclouddomain"
#=================================================
# SPECIFIC UPGRADE
#=================================================
# CONFIGURE ONLYOFFICE
#=================================================
ynh_script_progression --message="Configuring OnlyOffice..."
ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json"
echo onlyoffice-documentserver onlyoffice/ds-port select $port | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-host string 127.0.0.1 | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-user string $db_user | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-pwd password $db_pwd | debconf-set-selections
echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-selections
#JWT options
#echo onlyoffice-documentserver onlyoffice/jwt-secret password $jwt_secret | debconf-set-selections
#=================================================
# UPGRADE ONLYOFFICE
#=================================================
ynh_script_progression --message="Upgrading OnlyOffice..."
ynh_remove_extra_repo --name="$app" # backward compat
ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json"
# keyserver.ubuntu.com response an error 500 regularly
# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
# ynh_remove_app_dependencies
ynh_install_extra_app_dependencies --repo="https://download.onlyoffice.com/repo/debian squeeze main" --package="onlyoffice-documentserver" --key="https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE"
_install_msfonts_deb
_install_onlyoffice_deb
#=================================================
# UPDATE A CONFIG FILE
@ -148,7 +32,9 @@ ynh_script_progression --message="Updating a configuration file..."
ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json"
ynh_replace_string --match_string="\"rejectUnauthorized\": true" --replace_string="\"rejectUnauthorized\": false" --target_file="/etc/onlyoffice/documentserver/default.json"
ynh_replace_string --target_file="/etc/onlyoffice/documentserver/default.json" \
--match_string="\"rejectUnauthorized\": true" \
--replace_string="\"rejectUnauthorized\": false"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="/etc/onlyoffice/documentserver/default.json"
@ -165,27 +51,23 @@ ynh_script_progression --message="Generating fonts..."
#=================================================
# Set permissions to app files
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R ds:ds "$final_path"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R ds:ds "$install_dir"
#=================================================
# GENERIC FINALIZATION
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
# START SYSTEMD SERVICE
#=================================================
# ynh_script_progression --message="Starting a systemd service..."
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# supervisorctl reload
if [ $path = "/" ]; then
path_no_slash=""
else
path_no_slash="$path"
fi
# sleep 30
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# END OF SCRIPT

16
tests.toml Normal file
View file

@ -0,0 +1,16 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0
[default]
args.nextclouddomain = "nextcloud.tld"
exclude = ["change_url"]
[default.test_upgrade_from.205cc12c26b46c57ba8459f449e835949be44096]
name = "7.3.3~ynh1"
args.domain = "domain.tld"
args.path = "/"
args.nextclouddomain = "nextcloud.tld"
args.admin = "package_checker"