Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New permissions #51

Merged
merged 8 commits into from May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -6,7 +6,7 @@
*[Lire ce readme en français.](./README_fr.md)*

> *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.*
If you don't have YunoHost, please consult [the guide](https://yunohost.org/install) to learn how to install it.*

## Overview

Expand Down Expand Up @@ -88,8 +88,8 @@ Prerequisite: **OnlyOffice should be public**, see previous section.

#### Supported architectures

* 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/)
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/onlyoffice.svg)](https://ci-apps.yunohost.org/ci/apps/onlyoffice/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/onlyoffice.svg)](https://ci-apps-arm.yunohost.org/ci/apps/onlyoffice/)

## Links

Expand Down
6 changes: 3 additions & 3 deletions README_fr.md
Expand Up @@ -6,7 +6,7 @@
*[Read this readme in english.](./README.md)*

> *Ce package vous permet d'installer OnlyOffice rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/install) pour apprendre comment l'installer.*

## Vue d'ensemble

Expand Down Expand Up @@ -88,8 +88,8 @@ Prérequis : **OnlyOffice doit être public**, voir la section précédente.

#### Architectures supportées

* 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/)
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/onlyoffice.svg)](https://ci-apps.yunohost.org/ci/apps/onlyoffice/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/onlyoffice.svg)](https://ci-apps-arm.yunohost.org/ci/apps/onlyoffice/)

## Liens

Expand Down
2 changes: 0 additions & 2 deletions check_process
Expand Up @@ -19,8 +19,6 @@
upgrade=1
backup_restore=1
multi_instance=0
incorrect_path=1
port_already_use=0
change_url=1
;;; Options
Email=
Expand Down
16 changes: 2 additions & 14 deletions manifest.json
Expand Up @@ -6,15 +6,15 @@
"en": "Create and edit documents collaboratively",
"fr": "Créez et éditer des documents collaborativement"
},
"version": "6.1.0~ynh1",
"version": "6.1.0~ynh2",
"url": "https://www.onlyoffice.com",
"license": "GPL-3.0-or-later",
"maintainer": {
"name": "liberodark",
"email": "liberodark@gmail.com"
},
"requirements": {
"yunohost": ">= 3.8.4"
"yunohost": ">= 4.1.7"
},
"multi_instance": false,
"services": [
Expand All @@ -25,10 +25,6 @@
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name for OnlyOffice",
"fr": "Choisissez un nom de domaine pour OnlyOffice"
},
"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.",
Expand All @@ -38,10 +34,6 @@
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for OnlyOffice",
"fr": "Choisissez un chemin pour OnlyOffice"
},
"example": "/onlyoffice or /",
"help": {
"en": "Root path / if you chose a subdomain, e.g. office.yunohost.domain.",
Expand All @@ -66,10 +58,6 @@
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application? If you want to connect the app to Nextcloud: check/true!",
"fr": "Est-ce une application publique ? Si vous voulez connecter l'app à Nextcloud : cochez/true!"
},
"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 !"
Expand Down
4 changes: 1 addition & 3 deletions pull_request_template.md
Expand Up @@ -13,6 +13,4 @@

## 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)/)
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*
2 changes: 1 addition & 1 deletion scripts/_common.sh
Expand Up @@ -5,7 +5,7 @@
#=================================================

# dependencies used by the app
pkg_dependencies="postgresql libstdc++6 redis-server rabbitmq-server libcurl4-dev"
pkg_dependencies="postgresql postgresql-contrib libstdc++6 redis-server rabbitmq-server libcurl4-dev"

#=================================================
# PERSONAL HELPERS
Expand Down
5 changes: 0 additions & 5 deletions scripts/change_url
Expand Up @@ -30,11 +30,6 @@ ynh_script_progression --message="Loading installation settings..."
port=$(ynh_app_setting_get --app=$app --key=port)
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
#=================================================
Expand Down
40 changes: 14 additions & 26 deletions scripts/install
Expand Up @@ -45,8 +45,8 @@ 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=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=nextclouddomain --value=$nextclouddomain
ynh_app_setting_set --app=$app --key=final_path --value=$final_path

#=================================================
# STANDARD MODIFICATIONS
Expand All @@ -59,6 +59,14 @@ ynh_script_progression --message="Finding an available port..."
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port

#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."

# Create a system user
ynh_system_user_create --username=$app

#=================================================
# ADD ONLYOFFICE REPOSITORY
#=================================================
Expand All @@ -72,7 +80,7 @@ ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian sq
#=================================================
ynh_script_progression --message="Installing dependencies..."

ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies

#=================================================
# CREATE A POSTGRESQL DATABASE
Expand All @@ -81,20 +89,9 @@ ynh_script_progression --message="Creating a PostgreSQL database..."

db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
db_pwd=$(ynh_string_random --length=32)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
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"
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name

#=================================================
# NGINX CONFIGURATION
Expand All @@ -110,14 +107,6 @@ fi
# Create a dedicated NGINX config
ynh_add_nginx_config "nextclouddomain"

#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."

# Create a system user
ynh_system_user_create --username=$app

#=================================================
# SPECIFIC SETUP
#=================================================
Expand All @@ -140,7 +129,7 @@ ynh_script_progression --message="Install OnlyOffice..."
# 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_add_app_dependencies --package="onlyoffice-documentserver"
ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver"

#=================================================
# MODIFY A CONFIG FILE
Expand Down Expand Up @@ -178,13 +167,12 @@ ynh_script_progression --message="Generating fonts..."
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..."
ynh_script_progression --message="Configuring permissions..."

# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
ynh_permission_update --permission="main" --add="visitors"
fi

#=================================================
Expand Down
4 changes: 2 additions & 2 deletions scripts/remove
Expand Up @@ -87,7 +87,7 @@ ynh_script_progression --message="Removing file..."
# Remove a directory securely
ynh_secure_remove --file="/etc/onlyoffice"
ynh_secure_remove --file="/var/lib/onlyoffice"
ynh_secure_remove --file="/var/cache/nginx/onlyoffice"
#ynh_secure_remove --file="/var/cache/nginx/onlyoffice"

# Remove the log files
ynh_secure_remove --file="/var/log/$app"
Expand All @@ -100,7 +100,7 @@ ynh_secure_remove --file="/var/log/$app"
ynh_script_progression --message="Removing the dedicated system user..."

# Delete a system user
gpasswd -d www-data onlyoffice
#gpasswd -d www-data onlyoffice
ynh_system_user_delete --username=$app

#=================================================
Expand Down
7 changes: 3 additions & 4 deletions scripts/restore
Expand Up @@ -26,10 +26,9 @@ app=$YNH_APP_INSTANCE_NAME

domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=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=db_pwd)
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)

Expand Down Expand Up @@ -74,7 +73,7 @@ ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian sq
ynh_script_progression --message="Reinstalling dependencies..."

# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies

#=================================================
# RESTORE THE POSTGRESQL DATABASE
Expand All @@ -101,7 +100,7 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-
#=================================================
ynh_script_progression --message="Reinstalling OnlyOffice..."

ynh_add_app_dependencies --package="onlyoffice-documentserver"
ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver"

#=================================================
# RESTORE THE CONFIGURATION
Expand Down
51 changes: 18 additions & 33 deletions scripts/upgrade
Expand Up @@ -18,10 +18,9 @@ app=$YNH_APP_INSTANCE_NAME

domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
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)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ericgaspar marked this conversation as resolved.
Show resolved Hide resolved
port=$(ynh_app_setting_get --app=$app --key=port)
nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)

Expand All @@ -30,15 +29,6 @@ nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."

# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi

# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
Expand All @@ -51,6 +41,13 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
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"

Expand All @@ -68,6 +65,14 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors

#=================================================
# 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

#=================================================
# STANDARD UPGRADE STEPS
#=================================================
Expand All @@ -89,15 +94,7 @@ ynh_add_nginx_config "nextclouddomain"
#=================================================
ynh_script_progression --message="Upgrading dependencies..."

ynh_install_app_dependencies $pkg_dependencies

#=================================================
# 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
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies

#=================================================
# SPECIFIC UPGRADE
Expand Down Expand Up @@ -126,7 +123,7 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-
#=================================================
ynh_script_progression --message="Upgrading OnlyOffice..."

ynh_add_app_dependencies --package="onlyoffice-documentserver"
ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver"

#=================================================
# MODIFY A CONFIG FILE
Expand All @@ -149,18 +146,6 @@ ynh_script_progression --message="Generating fonts..."

#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..."

# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi

#=================================================
# RELOAD ONLYOFFICE
#=================================================
Expand Down