mirror of
https://github.com/YunoHost-Apps/onlyoffice_ynh.git
synced 2024-09-03 19:56:11 +02:00
Apply example_ynh
This commit is contained in:
parent
b5a04d7214
commit
b17f0b1128
9 changed files with 168 additions and 306 deletions
|
@ -1,7 +1,7 @@
|
||||||
# OnlyOffice for YunoHost
|
# OnlyOffice for YunoHost
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/onlyoffice)
|
[](https://dash.yunohost.org/appci/app/onlyoffice)
|
||||||
[](https://install-app.yunohost.org/?app=onlyoffice)
|
[](https://install-app.yunohost.org/?app=onlyoffice)
|
||||||
|
|
||||||
> *This package allow you to install OnlyOffice quickly and simply on a YunoHost server.
|
> *This package allow you to install OnlyOffice 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.*
|
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||||
|
@ -15,9 +15,9 @@ OnlyOffice Document Server
|
||||||
|
|
||||||
#### Supported architectures
|
#### Supported architectures
|
||||||
|
|
||||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/onlyoffice/)
|
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/onlyoffice/)
|
||||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/onlyoffice/)
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/onlyoffice/)
|
||||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/onlyoffice/)
|
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/onlyoffice/)
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"email": "liberodark@gmail.com"
|
"email": "liberodark@gmail.com"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.4"
|
"yunohost": ">= 3.5"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# COMMON VARIABLES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# dependencies used by the app
|
||||||
|
pkg_dependencies="postgresql libstdc++6 redis-server rabbitmq-server"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -14,56 +14,45 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
### Remove this function if there's nothing to clean before calling the remove script.
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading installation settings..."
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
#=================================================
|
|
||||||
# BACKUP THE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info "Backing up the main app directory..."
|
|
||||||
|
|
||||||
ynh_backup "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up nginx web server configuration..."
|
ynh_print_info --message="Backing up nginx web server configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE POSTGRESQL DATABASE
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up the PostgreSQL database..."
|
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||||
|
|
||||||
ynh_psql_dump_db "$db_name" > db.sql
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up the configuration..."
|
ynh_print_info --message="Backing up the configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/onlyoffice"
|
ynh_backup --src_path="/etc/onlyoffice"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -24,25 +24,15 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading installation settings..."
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
port=$(ynh_app_setting_get $app port)
|
nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
|
||||||
nextclouddomain=$(ynh_app_setting_get $app nextclouddomain)
|
|
||||||
|
|
||||||
# Add settings here as needed by your application
|
# Add settings here as needed by your application
|
||||||
#db_name=$(ynh_app_setting_get "$app" db_name)
|
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
#db_pwd=$(ynh_app_setting_get $app db_pwd)
|
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK THE SYNTAX OF THE PATHS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
test -n "$old_path" || old_path="/"
|
|
||||||
test -n "$new_path" || new_path="/"
|
|
||||||
new_path=$(ynh_normalize_url_path $new_path)
|
|
||||||
old_path=$(ynh_normalize_url_path $old_path)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
|
@ -65,7 +55,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Updating nginx web server configuration..."
|
ynh_print_info --message="Updating nginx web server configuration..."
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
@ -73,16 +63,15 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
if [ $change_path -eq 1 ]
|
if [ $change_path -eq 1 ]
|
||||||
then
|
then
|
||||||
# Make a backup of the original nginx config file if modified
|
# Make a backup of the original nginx config file if modified
|
||||||
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||||
# Set global variables for nginx helper
|
# Set global variables for nginx helper
|
||||||
domain="$old_domain"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
|
|
||||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
|
||||||
if [ $new_path = "/" ]; then
|
if [ $new_path = "/" ]; then
|
||||||
ynh_replace_string "__SUB_PATH__" "" "../conf/nginx.conf"
|
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf"
|
||||||
else
|
else
|
||||||
ynh_replace_string "__SUB_PATH__" "$new_path" "../conf/nginx.conf"
|
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="$new_path" --target_file="../conf/nginx.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
|
@ -93,31 +82,25 @@ fi
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
ynh_delete_file_checksum "$nginx_conf_path"
|
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
# Store file checksum for the new config file location
|
# Store file checksum for the new config file location
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
ynh_replace_string "X-Frame-Options : ALLOW-FROM https://$nextclouddomain" "X-Frame-Options : SAMEORIGIN" "/etc/nginx/conf.d/$old_domain.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 "X-Frame-Options : SAMEORIGIN" "X-Frame-Options : ALLOW-FROM https://$nextclouddomain" "/etc/nginx/conf.d/$new_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
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# ...
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading nginx web server..."
|
ynh_print_info --message="Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Change of URL completed for $app"
|
ynh_print_info --message="Change of URL completed for $app"
|
||||||
|
|
186
scripts/install
186
scripts/install
|
@ -13,10 +13,6 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
### Remove this function if there's nothing to clean before calling the remove script.
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -29,73 +25,48 @@ path_url=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
nextclouddomain=$YNH_APP_ARG_NEXTCLOUDDOMAIN
|
nextclouddomain=$YNH_APP_ARG_NEXTCLOUDDOMAIN
|
||||||
|
|
||||||
### If it's a multi-instance app, meaning it can be installed several times independently
|
|
||||||
### The id of the app as stated in the manifest is available as $YNH_APP_ID
|
|
||||||
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
|
||||||
### The app instance name is available as $YNH_APP_INSTANCE_NAME
|
|
||||||
### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
|
||||||
### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
|
||||||
### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
|
||||||
### The app instance name is probably what interests you most, since this is
|
|
||||||
### guaranteed to be unique. This is a good unique identifier to define installation path,
|
|
||||||
### db names, ...
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Validating installation parameters..."
|
ynh_print_info --message="Validating installation parameters..."
|
||||||
|
|
||||||
### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app".
|
|
||||||
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
|
||||||
final_path=/var/www/$app
|
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
|
||||||
|
|
||||||
# Normalize the url path syntax
|
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Storing installation settings..."
|
ynh_print_info --message="Storing installation settings..."
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||||
ynh_app_setting_set $app nextclouddomain $nextclouddomain
|
ynh_app_setting_set --app=$app --key=nextclouddomain --value=$nextclouddomain
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configuring firewall..."
|
ynh_print_info --message="Configuring firewall..."
|
||||||
|
|
||||||
### Use these lines if you have to open a port for the application
|
|
||||||
### `ynh_find_port` will find the first available port starting from the given port.
|
|
||||||
### If you're not using these lines:
|
|
||||||
### - Remove the section "CLOSE A PORT" in the remove script
|
|
||||||
|
|
||||||
# Find a free port
|
# Find a free port
|
||||||
port=$(ynh_find_port 8095)
|
port=$(ynh_find_port --port=8095)
|
||||||
# Open this port
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
|
||||||
ynh_app_setting_set $app port $port
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD NODEJS REPOSITORY
|
# ADD NODEJS REPOSITORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Add nodejs repository..."
|
ynh_print_info --message="Add nodejs repository..."
|
||||||
|
|
||||||
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
|
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD ONLYOFFICE REPOSITORY
|
# ADD ONLYOFFICE REPOSITORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Add OnlyOffice repository..."
|
ynh_print_info --message="Add OnlyOffice repository..."
|
||||||
|
|
||||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
||||||
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
|
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
|
||||||
|
@ -103,90 +74,65 @@ echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /e
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Installing dependencies..."
|
ynh_print_info --message="Installing dependencies..."
|
||||||
|
|
||||||
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
### Those deb packages will be installed as dependencies of this package.
|
|
||||||
### If you're not using this helper:
|
|
||||||
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
|
||||||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
|
||||||
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
|
||||||
|
|
||||||
ynh_install_app_dependencies postgresql libstdc++6 redis-server rabbitmq-server
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A POSTGRESQL DATABASE
|
# CREATE A POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Creating a PostgreSQL database..."
|
ynh_print_info --message="Creating a PostgreSQL database..."
|
||||||
|
|
||||||
### Use these lines if you need a database for the application.
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password.
|
db_user=$db_name
|
||||||
### The password will be stored as 'mysqlpwd' into the app settings,
|
db_pwd=$(ynh_string_random --length=32)
|
||||||
### and will be available as $db_pwd
|
|
||||||
### If you're not using these lines:
|
|
||||||
### - Remove the section "BACKUP THE POSTGRESQL DATABASE" in the backup script
|
|
||||||
### - Remove also the section "REMOVE THE POSTGRESQL DATABASE" in the remove script
|
|
||||||
### - As well as the section "RESTORE THE POSTGRESQL DATABASE" in the restore script
|
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
|
||||||
db_pwd="onlyoffice"
|
|
||||||
ynh_app_setting_set $app db_name $db_name
|
ynh_app_setting_set $app db_name $db_name
|
||||||
ynh_app_setting_set $app db_pwd $db_pwd
|
ynh_app_setting_set $app db_pwd $db_pwd
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_create_db $db_name $db_name $db_pwd
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info "Setting up source files..."
|
|
||||||
|
|
||||||
### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
|
|
||||||
### downloaded from an upstream source, like a git repository.
|
|
||||||
### `ynh_setup_source` use the file conf/app.src
|
|
||||||
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
|
||||||
#ynh_setup_source "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configuring nginx web server..."
|
ynh_print_info --message="Configuring nginx web server..."
|
||||||
|
|
||||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
|
||||||
if [ $path_url = "/" ]; then
|
if [ $path_url = "/" ]; then
|
||||||
ynh_replace_string "__SUB_PATH__" "" "../conf/nginx.conf"
|
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf"
|
||||||
else
|
else
|
||||||
ynh_replace_string "__SUB_PATH__" "$path_url" "../conf/nginx.conf"
|
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="$path_url" --target_file="../conf/nginx.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config "nextclouddomain"
|
ynh_add_nginx_config "nextclouddomain"
|
||||||
|
|
||||||
# Fix main domain X-Frame-Options
|
# Fix main domain X-Frame-Options
|
||||||
ynh_replace_string "X-Frame-Options : SAMEORIGIN" "X-Frame-Options : ALLOW-FROM https://$nextclouddomain" "/etc/nginx/conf.d/$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/$domain.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configuring system user..."
|
ynh_print_info --message="Configuring system user..."
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create $app $final_path
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEFINE PORT
|
# CONFIGURE ONLYOFFICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Define OnlyOffice server port..."
|
ynh_print_info --message="Configuring Onlyoffice..."
|
||||||
|
|
||||||
echo onlyoffice-documentserver onlyoffice/ds-port select ${port} | sudo debconf-set-selections
|
echo onlyoffice-documentserver onlyoffice/ds-port select $port | sudo debconf-set-selections
|
||||||
|
echo onlyoffice-documentserver onlyoffice/db-host string 127.0.0.1 | sudo debconf-set-selections
|
||||||
|
echo onlyoffice-documentserver onlyoffice/db-user string $db_user | sudo debconf-set-selections
|
||||||
|
echo onlyoffice-documentserver onlyoffice/db-pwd password $db_pwd | debconf-set-selections
|
||||||
|
echo onlyoffice-documentserver onlyoffice/db-name string $db_name | sudo debconf-set-selections
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL ONLYOFFICE
|
# INSTALL ONLYOFFICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Install OnlyOffice..."
|
ynh_print_info --message="Install OnlyOffice..."
|
||||||
|
|
||||||
wget $source
|
wget $source
|
||||||
ynh_package_install ./onlyoffice-documentserver_amd64.deb
|
ynh_package_install ./onlyoffice-documentserver_amd64.deb
|
||||||
|
@ -195,67 +141,49 @@ ynh_package_install ./onlyoffice-documentserver_amd64.deb
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
### `ynh_replace_string` is used to replace a string in a file.
|
|
||||||
### (It's compatible with sed regular expressions syntax)
|
|
||||||
|
|
||||||
#ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE"
|
#ynh_replace_string "match_string" "replace_string" "$final_path/CONFIG_FILE"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE THE CONFIG FILE CHECKSUM
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
### `ynh_store_file_checksum` is used to store the checksum of a file.
|
|
||||||
### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`,
|
|
||||||
### you can make a backup of this file before modifying it again if the admin had modified it.
|
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
#ynh_store_file_checksum "/etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver.conf"
|
#ynh_store_file_checksum --file="$final_path/CONFIG_FILE"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
### For security reason, any app should set the permissions to root: before anything else.
|
|
||||||
### Then, if write authorization is needed, any access should be given only to directories
|
|
||||||
### that really need such authorization.
|
|
||||||
|
|
||||||
# Set permissions to app files
|
|
||||||
#chown -R $app: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info "Configuring SSOwat..."
|
|
||||||
|
|
||||||
# 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 unprotected_uris "/"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info "Reloading nginx web server..."
|
|
||||||
|
|
||||||
systemctl reload nginx
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD ONLYOFFICE
|
# RELOAD ONLYOFFICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading OnlyOffice..."
|
ynh_print_info --message="Reloading OnlyOffice..."
|
||||||
|
|
||||||
supervisorctl stop all
|
supervisorctl stop all
|
||||||
supervisorctl start all
|
supervisorctl start all
|
||||||
|
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSOWAT
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Configuring SSOwat..."
|
||||||
|
|
||||||
|
# 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 NGINX
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Reloading nginx web server..."
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Installation of $app completed"
|
ynh_print_info --message="Installation of $app completed"
|
||||||
|
|
|
@ -12,106 +12,85 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading installation settings..."
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
port=$(ynh_app_setting_get $app port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
db_user=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP ONLYOFFICE
|
# STOP ONLYOFFICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Stopping OnlyOffice"
|
ynh_print_info --message="Stopping OnlyOffice..."
|
||||||
|
|
||||||
supervisorctl stop all
|
supervisorctl stop all
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE ONLYOFFICE
|
# REMOVE ONLYOFFICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing OnlyOffice"
|
ynh_print_info --message="Removing OnlyOffice..."
|
||||||
|
|
||||||
ynh_secure_remove /var/lib/dpkg/info/onlyoffice-documentserver.prerm
|
ynh_secure_remove --file=/var/lib/dpkg/info/onlyoffice-documentserver.prerm
|
||||||
ynh_package_autopurge onlyoffice-documentserver
|
ynh_package_autopurge onlyoffice-documentserver
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE POSTGRESQL DATABASE
|
# REMOVE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing the PostgreSQL database"
|
ynh_print_info --message="Removing the PostgreSQL database..."
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_psql_remove_db $db_name $db_name
|
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing dependencies"
|
ynh_print_info --message="Removing dependencies..."
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info "Removing app main directory"
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
|
||||||
ynh_secure_remove "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing nginx web server configuration"
|
ynh_print_info --message="Removing nginx web server configuration..."
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CLOSE A PORT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if yunohost firewall list | grep -q "\- $port$"
|
|
||||||
then
|
|
||||||
ynh_print_info "Closing port $port"
|
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE CRON FILE
|
# REMOVE FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove a cron file
|
|
||||||
#ynh_secure_remove "/etc/cron.d/$app"
|
|
||||||
|
|
||||||
# Remove a directory securely
|
# Remove a directory securely
|
||||||
ynh_secure_remove "/etc/apt/sources.list.d/onlyoffice.list"
|
ynh_secure_remove --file="/etc/apt/sources.list.d/onlyoffice.list"
|
||||||
ynh_secure_remove "/etc/apt/sources.list.d/nodesource.list"
|
ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list"
|
||||||
ynh_secure_remove "/etc/onlyoffice"
|
ynh_secure_remove --file="/etc/onlyoffice"
|
||||||
ynh_secure_remove "/var/lib/onlyoffice"
|
ynh_secure_remove --file="/var/lib/onlyoffice"
|
||||||
ynh_secure_remove "/var/cache/nginx/onlyoffice"
|
ynh_secure_remove --file="/var/cache/nginx/onlyoffice"
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
ynh_secure_remove "/var/log/$app/"
|
ynh_secure_remove --file="/var/log/$app/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing the dedicated system user"
|
ynh_print_info --message="Removing the dedicated system user..."
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
gpasswd -d www-data onlyoffice
|
gpasswd -d www-data onlyoffice
|
||||||
ynh_system_user_delete $app
|
ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Removal of $app completed"
|
ynh_print_info --message="Removal of $app completed"
|
||||||
|
|
|
@ -13,37 +13,32 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
#### Remove this function if there's nothing to clean before calling the remove script.
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading settings..."
|
ynh_print_info --message="Loading settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_pwd=$(ynh_app_setting_get $app db_pwd)
|
db_user=$db_name
|
||||||
port=$(ynh_app_setting_get $app port)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||||
nextclouddomain=$(ynh_app_setting_get $app nextclouddomain)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Validating restoration parameters..."
|
ynh_print_info --message="Validating restoration parameters..."
|
||||||
|
|
||||||
ynh_webpath_available $domain $path_url \
|
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||||
test ! -d $final_path \
|
|
||||||
|| ynh_die "There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
|
@ -51,53 +46,39 @@ test ! -d $final_path \
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
# Fix main domain X-Frame-Options
|
# Fix main domain X-Frame-Options
|
||||||
ynh_replace_string "X-Frame-Options : SAMEORIGIN" "X-Frame-Options : ALLOW-FROM https://$nextclouddomain" "/etc/nginx/conf.d/$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/$domain.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info "Restoring the app main directory..."
|
|
||||||
|
|
||||||
ynh_restore_file "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Recreating the dedicated system user..."
|
ynh_print_info --message="Recreating the dedicated system user..."
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create $app $final_path
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE USER RIGHTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Restore permissions on app files
|
|
||||||
chown -R $app: $final_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE CONFIGURATION
|
# RESTORE THE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Restoring the configuration..."
|
ynh_print_info --message="Restoring the configuration..."
|
||||||
|
|
||||||
ynh_restore_file "/etc/onlyoffice"
|
ynh_restore_file --origin_path="/etc/onlyoffice"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD NODEJS REPOSITORY
|
# ADD NODEJS REPOSITORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Add nodejs repository..."
|
ynh_print_info --message="Add nodejs repository..."
|
||||||
|
|
||||||
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
|
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD ONLYOFFICE REPOSITORY
|
# ADD ONLYOFFICE REPOSITORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Add OnlyOffice repository..."
|
ynh_print_info --message="Add OnlyOffice repository..."
|
||||||
|
|
||||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
||||||
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
|
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
|
||||||
|
@ -105,31 +86,35 @@ echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /e
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reinstalling dependencies..."
|
ynh_print_info --message="Reinstalling dependencies..."
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies postgresql libstdc++6 redis-server rabbitmq-server
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE POSTGRESQL DATABASE
|
# RESTORE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Restoring the PostgreSQL database..."
|
ynh_print_info --message="Restoring the PostgreSQL database..."
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_create_db $db_name $db_name $db_pwd
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
ynh_psql_execute_file_as_root ./db.sql "$db_name"
|
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEFINE PORT
|
# CONFIGURE ONLYOFFICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Define OnlyOffice server port..."
|
ynh_print_info --message="Configuring Onlyoffice..."
|
||||||
|
|
||||||
echo onlyoffice-documentserver onlyoffice/ds-port select ${port} | sudo debconf-set-selections
|
echo onlyoffice-documentserver onlyoffice/ds-port select $port | sudo debconf-set-selections
|
||||||
|
echo onlyoffice-documentserver onlyoffice/db-host string 127.0.0.1 | sudo debconf-set-selections
|
||||||
|
echo onlyoffice-documentserver onlyoffice/db-user string $db_user | sudo debconf-set-selections
|
||||||
|
echo onlyoffice-documentserver onlyoffice/db-pwd password $db_pwd | debconf-set-selections
|
||||||
|
echo onlyoffice-documentserver onlyoffice/db-name string $db_name | sudo debconf-set-selections
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL ONLYOFFICE
|
# REINSTALL ONLYOFFICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reinstalling OnlyOffice..."
|
ynh_print_info --message="Reinstalling OnlyOffice..."
|
||||||
|
|
||||||
wget $source
|
wget $source
|
||||||
apt install -y ./onlyoffice-documentserver_amd64.deb
|
apt install -y ./onlyoffice-documentserver_amd64.deb
|
||||||
|
@ -139,14 +124,14 @@ apt install -y ./onlyoffice-documentserver_amd64.deb
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading nginx web server..."
|
ynh_print_info --message="Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD ONLYOFFICE
|
# RELOAD ONLYOFFICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading OnlyOffice..."
|
ynh_print_info --message="Reloading OnlyOffice..."
|
||||||
|
|
||||||
supervisorctl stop all
|
supervisorctl stop all
|
||||||
supervisorctl start all
|
supervisorctl start all
|
||||||
|
@ -157,4 +142,4 @@ sleep 30
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Restoration completed for $app"
|
ynh_print_info --message="Restoration completed for $app"
|
||||||
|
|
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Loading installation settings..."
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ nextclouddomain=$(ynh_app_setting_get $app nextclouddomain)
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Ensuring downward compatibility..."
|
ynh_print_info --message="Ensuring downward compatibility..."
|
||||||
|
|
||||||
# Fix is_public as a boolean value
|
# Fix is_public as a boolean value
|
||||||
if [ "$is_public" = "Yes" ]; then
|
if [ "$is_public" = "Yes" ]; then
|
||||||
|
@ -43,16 +43,10 @@ if [ -z $db_name ]; then
|
||||||
ynh_app_setting_set $app db_name $db_name
|
ynh_app_setting_set $app db_name $db_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If final_path doesn't exist, create it
|
|
||||||
if [ -z $final_path ]; then
|
|
||||||
final_path=/var/www/$app
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up the app before upgrading (may take a while)..."
|
ynh_print_info --message="Backing up the app before upgrading (may take a while)..."
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -75,9 +69,8 @@ path_url=$(ynh_normalize_url_path $path_url)
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configuring nginx web server..."
|
ynh_print_info --message="Configuring nginx web server..."
|
||||||
|
|
||||||
### `ynh_add_nginx_config` will use the file conf/nginx.conf
|
|
||||||
if [ $path_url = "/" ]; then
|
if [ $path_url = "/" ]; then
|
||||||
ynh_replace_string "__SUB_PATH__" "" "../conf/nginx.conf"
|
ynh_replace_string "__SUB_PATH__" "" "../conf/nginx.conf"
|
||||||
else
|
else
|
||||||
|
@ -93,14 +86,14 @@ ynh_replace_string "X-Frame-Options : SAMEORIGIN" "X-Frame-Options : ALLOW-FROM
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading dependencies..."
|
ynh_print_info --message="Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies postgresql libstdc++6 redis-server rabbitmq-server
|
ynh_install_app_dependencies postgresql libstdc++6 redis-server rabbitmq-server
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Making sure dedicated system user exists..."
|
ynh_print_info --message="Making sure dedicated system user exists..."
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create $app $final_path
|
ynh_system_user_create $app $final_path
|
||||||
|
@ -110,14 +103,14 @@ ynh_system_user_create $app $final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD NODEJS REPOSITORY
|
# ADD NODEJS REPOSITORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Add nodejs repository..."
|
ynh_print_info --message="Add nodejs repository..."
|
||||||
|
|
||||||
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
|
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD ONLYOFFICE REPOSITORY
|
# ADD ONLYOFFICE REPOSITORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Add OnlyOffice repository..."
|
ynh_print_info --message="Add OnlyOffice repository..."
|
||||||
|
|
||||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
|
||||||
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
|
echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
|
||||||
|
@ -125,13 +118,11 @@ echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /e
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE ONLYOFFICE
|
# UPGRADE ONLYOFFICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading OnlyOffice..."
|
ynh_print_info --message="Upgrading OnlyOffice..."
|
||||||
|
|
||||||
wget $source
|
wget $source
|
||||||
apt install -y ./onlyoffice-documentserver_amd64.deb
|
apt install -y ./onlyoffice-documentserver_amd64.deb
|
||||||
|
|
||||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
|
||||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
|
||||||
#ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE"
|
#ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE"
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
# Recalculate and store the checksum of the file for the next upgrade.
|
||||||
#ynh_store_file_checksum "$final_path/CONFIG_FILE"
|
#ynh_store_file_checksum "$final_path/CONFIG_FILE"
|
||||||
|
@ -149,7 +140,7 @@ apt install -y ./onlyoffice-documentserver_amd64.deb
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading SSOwat configuration..."
|
ynh_print_info --message="Upgrading SSOwat configuration..."
|
||||||
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
|
@ -161,14 +152,14 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading nginx web server..."
|
ynh_print_info --message="Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD ONLYOFFICE
|
# RELOAD ONLYOFFICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reloading OnlyOffice..."
|
ynh_print_info --message="Reloading OnlyOffice..."
|
||||||
|
|
||||||
supervisorctl stop all
|
supervisorctl stop all
|
||||||
supervisorctl start all
|
supervisorctl start all
|
||||||
|
@ -179,4 +170,4 @@ sleep 30
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info "Upgrade of $app completed"
|
ynh_print_info --message="Upgrade of $app completed"
|
||||||
|
|
Loading…
Add table
Reference in a new issue