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 #42 from YunoHost-Apps/testing

Testing
This commit is contained in:
Alexandre Aubin 2020-06-09 15:47:24 +02:00 committed by GitHub
commit 2c0fa86508
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 224 additions and 137 deletions

View file

@ -1,10 +1,10 @@
# OnlyOffice Server for YunoHost
[![Integration level](https://dash.yunohost.org/integration/onlyoffice.svg)](https://dash.yunohost.org/appci/app/onlyoffice)
[![Integration level](https://dash.yunohost.org/integration/onlyoffice.svg)](https://dash.yunohost.org/appci/app/onlyoffice) ![](https://ci-apps.yunohost.org/ci/badges/onlyoffice.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/onlyoffice.maintain.svg)
[![Install OnlyOffice with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=onlyoffice)
> *This package allows you to install OnlyOffice Document Server quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
> *This package allows you to install OnlyOffice quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
Online collaborative edition of OnlyOffice documents requires:
@ -22,7 +22,7 @@ The Nextcloud addicts may follow [this tutorial](https://github.com/YunoHost-App
## Screenshots
![](Link to a screenshot for this app)
![](https://static-www.onlyoffice.com/v9.5.0/images/mainpage/may2018/editors/document-short.jpg)
## Demo
@ -70,21 +70,13 @@ Prerequisite: **OnlyOffice should be public**, see previous section.
## Documentation
## YunoHost specific features
#### Multi-users support
#### Multi-user support
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/onlyoffice%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/onlyoffice/)
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/onlyoffice%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/onlyoffice/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/onlyoffice%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/onlyoffice/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/onlyoffice%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/onlyoffice/)
## Limitations
*
## Additional information
*
## Links
@ -92,15 +84,13 @@ Prerequisite: **OnlyOffice should be public**, see previous section.
* App website: https://www.onlyoffice.com
* Github App website: https://github.com/ONLYOFFICE/DocumentServer
* YunoHost website: https://yunohost.org/
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
---
Developers info
Developer info
----------------
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing).
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing).
To try the testing branch, please proceed like that.
```

View file

@ -10,6 +10,6 @@ location ^~ __PATH__/ {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
add_header X-Frame-Options "ALLOW-FROM https://__NEXTCLOUDDOMAIN__" always;
more_set_headers "X-Frame-Options : ALLOW-FROM https://__NEXTCLOUDDOMAIN__ always";
client_max_body_size 10M;
}

46
issue_template.md Normal file
View file

@ -0,0 +1,46 @@
---
name: Bug report
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!*
- *Otherwise, the issue may be due to onlyoffice itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
**Describe the bug**
*A clear and concise description of what the bug is.*
**Versions**
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
**To Reproduce**
*Steps to reproduce the behavior.*
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install onlyoffice
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '....'*
3. *Scroll down to '....'*
4. *See error*
**Expected behavior**
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
**Logs**
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
*If applicable and useful, add screenshots to help explain your problem.*

View file

@ -6,7 +6,7 @@
"en": "Create and edit documents collaboratively",
"fr": "Créez et éditer des documents collaborativement"
},
"version": "5.5.3~ynh1",
"version": "5.5.3~ynh2",
"url": "https://www.onlyoffice.com",
"license": "GPL-3.0-or-later",
"maintainer": {
@ -34,7 +34,7 @@
"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": "Evitez 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",
@ -48,7 +48,7 @@
"fr": "Choisissez le chemin racine / si vous avez choisi un sous-domaine, ex. office.yunohost.domain."
},
"default": "/onlyoffice"
},
},
{
"name": "nextclouddomain",
"type": "string",
@ -62,7 +62,7 @@
"fr": "Installez le connecteur OnlyOffice pour éditer des documents dans Nextcloud."
},
"default": "yunohost.domain/nextcloud"
},
},
{
"name": "is_public",
"type": "boolean",

18
pull_request_template.md Normal file
View file

@ -0,0 +1,18 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/onlyoffice_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/onlyoffice_ynh%20PR-NUM-%20(USERNAME)/)

View file

@ -24,19 +24,28 @@ ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
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..."
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
ynh_backup --src_path="/etc/onlyoffice"
#=================================================
# BACKUP THE POSTGRESQL DATABASE
#=================================================
@ -44,13 +53,6 @@ ynh_print_info --message="Backing up the PostgreSQL database..."
ynh_psql_dump_db --database="$db_name" > db.sql
#=================================================
# SPECIFIC BACKUP
#=================================================
ynh_print_info --message="Backing up the configuration..."
ynh_backup --src_path="/etc/onlyoffice"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
port=$(ynh_app_setting_get --app=$app --key=port)
@ -32,8 +32,26 @@ nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#=================================================
# BACKUP BEFORE UPGRADE 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
#=================================================
@ -55,7 +73,7 @@ fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_print_info --message="Updating nginx web server configuration..."
ynh_script_progression --message="Updating nginx web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -69,9 +87,9 @@ then
path_url="$new_path"
if [ $new_path = "/" ]; then
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf"
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"
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="$new_path" --target_file="../conf/nginx.conf"
fi
# Create a dedicated nginx config
@ -86,8 +104,6 @@ then
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"
ynh_replace_string --match_string="X-Frame-Options : ALLOW-FROM https://$nextclouddomain" --replace_string="X-Frame-Options : SAMEORIGIN" --target_file="/etc/nginx/conf.d/$old_domain.conf"
ynh_replace_string --match_string="X-Frame-Options : SAMEORIGIN" --replace_string="X-Frame-Options : ALLOW-FROM https://$nextclouddomain" --target_file="/etc/nginx/conf.d/$new_domain.conf"
fi
#=================================================
@ -95,7 +111,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -103,4 +119,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_print_info --message="Change of URL completed for $app"
ynh_script_progression --message="Change of URL completed for $app"

View file

@ -30,7 +30,10 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_print_info --message="Validating installation parameters..."
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"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
@ -38,7 +41,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_print_info --message="Storing installation settings..."
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
@ -50,23 +53,23 @@ ynh_app_setting_set --app=$app --key=nextclouddomain --value=$nextclouddomain
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_print_info --message="Configuring firewall..."
ynh_script_progression --message="Configuring firewall..."
# Find a free port
# Find an available port
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# ADD NODEJS REPOSITORY
#=================================================
ynh_print_info --message="Add nodejs repository..."
ynh_script_progression --message="Add nodejs repository..."
ynh_install_extra_repo --repo="deb https://deb.nodesource.com/node_8.x stretch main" --key="https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
ynh_install_extra_repo --repo="deb https://deb.nodesource.com/node_10.x stretch main" --key="https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
#=================================================
# ADD ONLYOFFICE REPOSITORY
#=================================================
ynh_print_info --message="Add OnlyOffice repository..."
ynh_script_progression --message="Add OnlyOffice repository..."
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian squeeze main" --append
@ -74,14 +77,14 @@ ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian sq
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info --message="Installing dependencies..."
ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_print_info --message="Creating a PostgreSQL database..."
ynh_script_progression --message="Creating a PostgreSQL database..."
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
@ -91,10 +94,19 @@ ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
#ynh_setup_source --dest_dir="$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Configuring nginx web server..."
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"
@ -105,13 +117,10 @@ fi
# Create a dedicated nginx config
ynh_add_nginx_config "nextclouddomain"
# Fix main domain X-Frame-Options
ynh_replace_string --match_string="X-Frame-Options : SAMEORIGIN" --replace_string="X-Frame-Options : ALLOW-FROM https://$nextclouddomain" --target_file="/etc/nginx/conf.d/$domain.conf"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info --message="Configuring system user..."
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app
@ -121,7 +130,7 @@ ynh_system_user_create --username=$app
#=================================================
# CONFIGURE ONLYOFFICE
#=================================================
ynh_print_info --message="Configuring 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
@ -132,7 +141,7 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-
#=================================================
# INSTALL ONLYOFFICE
#=================================================
ynh_print_info --message="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
@ -143,12 +152,14 @@ ynh_add_app_dependencies --package="onlyoffice-documentserver"
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config file..."
ynh_replace_string --match_string="\"rejectUnauthorized\": true" --replace_string="\"rejectUnauthorized\": false" --target_file="/etc/onlyoffice/documentserver/default.json"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_script_progression --message="Storing the config file checksum..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="/etc/onlyoffice/documentserver/default.json"
@ -156,26 +167,25 @@ ynh_store_file_checksum --file="/etc/onlyoffice/documentserver/default.json"
#=================================================
# RELOAD ONLYOFFICE
#=================================================
ynh_print_info --message="Reloading OnlyOffice..."
ynh_script_progression --message="Reloading OnlyOffice..."
supervisorctl restart all
supervisorctl reload
sleep 30
#=================================================
# REGENERATE FONTS
#=================================================
ynh_print_info --message="Generating fonts..."
ynh_script_progression --message="Generating fonts..."
/usr/bin/documentserver-generate-allfonts.sh
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info --message="Configuring SSOwat..."
ynh_script_progression --message="Configuring SSOwat..."
# Make app public if necessary
if [ $is_public -eq 1 ]
@ -187,7 +197,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -195,4 +205,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_print_info --message="Installation of $app completed"
ynh_script_progression --message="Installation of $app completed"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -20,20 +20,14 @@ 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
#=================================================
# STOP ONLYOFFICE
#=================================================
ynh_print_info --message="Stopping OnlyOffice..."
supervisorctl stop all
#=================================================
# REMOVE ONLYOFFICE
#=================================================
ynh_print_info --message="Removing OnlyOffice..."
ynh_script_progression --message="Removing OnlyOffice..."
ynh_secure_remove --file=/var/lib/dpkg/info/onlyoffice-documentserver.prerm
@ -45,31 +39,40 @@ ynh_secure_remove --file=/var/lib/dpkg/info/onlyoffice-documentserver.prerm
# right after.
ln -s /bin/true /usr/local/bin/supervisorctl
ynh_package_autopurge onlyoffice-documentserver
ynh_secure_remove /usr/local/bin/supervisorctl
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
ynh_print_info --message="Removing 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
ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name"
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info --message="Removing dependencies..."
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
ynh_remove_extra_repo
dpkg --configure -a
apt-key del "E09C A29F 6E17 8040 EF22 B409 8320 CA65 CB2D E8E5"
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Removing nginx web server configuration..."
ynh_script_progression --message="Removing nginx web server configuration..."
# Remove the dedicated nginx config
ynh_remove_nginx_config
@ -79,6 +82,7 @@ ynh_remove_nginx_config
#=================================================
# REMOVE FILE
#=================================================
ynh_script_progression --message="Removing file..."
# Remove a directory securely
ynh_secure_remove --file="/etc/onlyoffice"
@ -86,14 +90,14 @@ ynh_secure_remove --file="/var/lib/onlyoffice"
ynh_secure_remove --file="/var/cache/nginx/onlyoffice"
# Remove the log files
ynh_secure_remove --file="/var/log/$app/"
ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info --message="Removing the dedicated system user..."
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
gpasswd -d www-data onlyoffice
@ -103,4 +107,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT
#=================================================
ynh_print_info --message="Removal of $app completed"
ynh_script_progression --message="Removal of $app completed"

View file

@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -19,7 +20,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading settings..."
ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME
@ -35,7 +36,7 @@ nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info --message="Validating restoration parameters..."
ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
@ -45,16 +46,14 @@ ynh_webpath_available --domain=$domain --path_url=$path_url \
#=================================================
# 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"
# Fix main domain X-Frame-Options
ynh_replace_string --match_string="X-Frame-Options : SAMEORIGIN" --replace_string="X-Frame-Options : ALLOW-FROM https://$nextclouddomain" --target_file="/etc/nginx/conf.d/$domain.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info --message="Recreating the dedicated system user..."
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
@ -64,14 +63,14 @@ ynh_system_user_create --username=$app
#=================================================
# ADD NODEJS REPOSITORY
#=================================================
ynh_print_info --message="Add nodejs repository..."
ynh_script_progression --message="Add nodejs repository..."
ynh_install_extra_repo --repo="deb https://deb.nodesource.com/node_8.x stretch main" --key="https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
ynh_install_extra_repo --repo="deb https://deb.nodesource.com/node_10.x stretch main" --key="https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
#=================================================
# ADD ONLYOFFICE REPOSITORY
#=================================================
ynh_print_info --message="Add OnlyOffice repository..."
ynh_script_progression --message="Add OnlyOffice repository..."
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian squeeze main" --append
@ -79,7 +78,7 @@ ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian sq
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_print_info --message="Reinstalling dependencies..."
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
@ -87,7 +86,7 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_print_info --message="Restoring the PostgreSQL database..."
ynh_script_progression --message="Restoring the PostgreSQL database..."
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
@ -96,7 +95,7 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#=================================================
# CONFIGURE ONLYOFFICE
#=================================================
ynh_print_info --message="Configuring 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
@ -107,44 +106,44 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-
#=================================================
# REINSTALL ONLYOFFICE
#=================================================
ynh_print_info --message="Reinstalling OnlyOffice..."
ynh_script_progression --message="Reinstalling OnlyOffice..."
ynh_add_app_dependencies --package="onlyoffice-documentserver"
#=================================================
# RESTORE THE CONFIGURATION
#=================================================
ynh_print_info --message="Restoring the configuration..."
ynh_script_progression --message="Restoring the configuration..."
ynh_restore_file --origin_path="/etc/onlyoffice"
#=================================================
# REGENERATE FONTS
#=================================================
ynh_print_info --message="Generating fonts..."
ynh_script_progression --message="Generating fonts..."
/usr/bin/documentserver-generate-allfonts.sh
#=================================================
# RELOAD ONLYOFFICE
#=================================================
ynh_script_progression --message="Reloading OnlyOffice..."
supervisorctl reload
sleep 30
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# RELOAD ONLYOFFICE
#=================================================
ynh_print_info --message="Reloading OnlyOffice..."
supervisorctl restart all
sleep 30
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Restoration completed for $app"
ynh_script_progression --message="Restoration completed for $app"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -28,7 +28,7 @@ nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_print_info --message="Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
@ -45,13 +45,19 @@ if [ -z "$db_name" ]; then
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
ynh_secure_remove --file="/etc/apt/sources.list.d/onlyoffice.list"
ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list"
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info --message="Backing up the app before upgrading (may take a while)..."
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
@ -75,7 +81,7 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Configuring nginx web server..."
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"
@ -86,20 +92,17 @@ fi
# Create a dedicated nginx config
ynh_add_nginx_config "nextclouddomain"
# Fix main domain X-Frame-Options
ynh_replace_string --match_string="X-Frame-Options : SAMEORIGIN" --replace_string="X-Frame-Options : ALLOW-FROM https://$nextclouddomain" --target_file="/etc/nginx/conf.d/$domain.conf"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_print_info --message="Upgrading dependencies..."
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info --message="Making sure dedicated system user exists..."
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
@ -109,14 +112,14 @@ ynh_system_user_create --username=$app
#=================================================
# ADD NODEJS REPOSITORY
#=================================================
ynh_print_info --message="Add nodejs repository..."
ynh_script_progression --message="Add nodejs repository..."
ynh_install_extra_repo --repo="deb https://deb.nodesource.com/node_8.x stretch main" --key="https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
ynh_install_extra_repo --repo="deb https://deb.nodesource.com/node_10.x stretch main" --key="https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
#=================================================
# ADD ONLYOFFICE REPOSITORY
#=================================================
ynh_print_info --message="Add OnlyOffice repository..."
ynh_script_progression --message="Add OnlyOffice repository..."
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian squeeze main" --append
@ -124,7 +127,7 @@ ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian sq
#=================================================
# CONFIGURE ONLYOFFICE
#=================================================
ynh_print_info --message="Configuring 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
@ -136,27 +139,26 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-
#=================================================
# UPGRADE ONLYOFFICE
#=================================================
ynh_print_info --message="Upgrading OnlyOffice..."
ynh_script_progression --message="Upgrading OnlyOffice..."
ynh_add_app_dependencies --package="onlyoffice-documentserver"
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Modifying a config 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"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="/etc/onlyoffice/documentserver/default.json"
#=================================================
# REGENERATE FONTS
#=================================================
ynh_print_info --message="Generating fonts..."
ynh_script_progression --message="Generating fonts..."
/usr/bin/documentserver-generate-allfonts.sh
@ -165,7 +167,7 @@ ynh_print_info --message="Generating fonts..."
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info --message="Upgrading SSOwat configuration..."
ynh_script_progression --message="Upgrading SSOwat configuration..."
# Make app public if necessary
if [ $is_public -eq 1 ]
@ -174,24 +176,24 @@ then
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# RELOAD ONLYOFFICE
#=================================================
ynh_print_info --message="Reloading OnlyOffice..."
ynh_script_progression --message="Reloading OnlyOffice..."
supervisorctl restart all
supervisorctl reload
sleep 30
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Upgrade of $app completed"
ynh_script_progression --message="Upgrade of $app completed"