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

Reapply example_ynh

This commit is contained in:
yalh76 2019-05-22 02:43:24 +02:00
parent 245314f508
commit ad4f3a2503
4 changed files with 38 additions and 21 deletions

View file

@ -5,13 +5,16 @@
#================================================= #=================================================
# dependencies used by the app # dependencies used by the app
pkg_dependencies="postgresql libstdc++6 redis-server rabbitmq-server" pkg_dependencies="postgresql libstdc++6 redis-server rabbitmq-server libcurl4-nss-dev"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
source="https://github.com/ONLYOFFICE/DocumentServer/releases/download/ONLYOFFICE-DocumentServer-5.2.8/onlyoffice-documentserver_amd64.deb"
version="5.2.8" onlyoffice_version="5.2.8"
onlyoffice_source="https://github.com/ONLYOFFICE/DocumentServer/releases/download/ONLYOFFICE-DocumentServer-$onlyoffice_version/onlyoffice-documentserver_amd64.deb"
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS

View file

@ -86,8 +86,8 @@ ynh_print_info --message="Creating a PostgreSQL database..."
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_string_random --length=32) db_pwd=$(ynh_string_random --length=32)
ynh_app_setting_set $app db_name $db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set $app db_pwd $db_pwd ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
@ -134,30 +134,28 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | sudo debconf
#================================================= #=================================================
ynh_print_info --message="Install OnlyOffice..." ynh_print_info --message="Install OnlyOffice..."
wget $source wget $onlyoffice_source
ynh_package_install ./onlyoffice-documentserver_amd64.deb ynh_package_install ./onlyoffice-documentserver_amd64.deb
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
#ynh_replace_string "match_string" "replace_string" "$final_path/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 # STORE THE CONFIG FILE CHECKSUM
#================================================= #=================================================
# 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 --file="$final_path/CONFIG_FILE" ynh_store_file_checksum --file="/etc/onlyoffice/documentserver/default.json"
#================================================= #=================================================
# RELOAD ONLYOFFICE # RELOAD ONLYOFFICE
#================================================= #=================================================
ynh_print_info --message="Reloading OnlyOffice..." ynh_print_info --message="Reloading OnlyOffice..."
supervisorctl stop all supervisorctl restart all
supervisorctl start all
sleep 30 sleep 30

View file

@ -109,8 +109,8 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | sudo debconf
#================================================= #=================================================
ynh_print_info --message="Reinstalling OnlyOffice..." ynh_print_info --message="Reinstalling OnlyOffice..."
wget $source wget $onlyoffice_source
apt install -y ./onlyoffice-documentserver_amd64.deb ynh_package_install ./onlyoffice-documentserver_amd64.deb
#================================================= #=================================================
# RESTORE THE CONFIGURATION # RESTORE THE CONFIGURATION
@ -133,8 +133,7 @@ ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
ynh_print_info --message="Reloading OnlyOffice..." ynh_print_info --message="Reloading OnlyOffice..."
supervisorctl stop all supervisorctl restart all
supervisorctl start all
sleep 30 sleep 30

View file

@ -51,6 +51,7 @@ 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
ynh_clean_setup () { ynh_clean_setup () {
read -p "key"
# restore it if the upgrade fails # restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
@ -73,7 +74,7 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url)
ynh_print_info --message="Configuring nginx web server..." ynh_print_info --message="Configuring nginx web server..."
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 --match_string="__SUB_PATH__" --replace_string="$path_url" --target_file="../conf/nginx.conf" ynh_replace_string --match_string="__SUB_PATH__" --replace_string="$path_url" --target_file="../conf/nginx.conf"
fi fi
@ -116,21 +117,38 @@ 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
#=================================================
# CONFIGURE ONLYOFFICE
#=================================================
ynh_print_info --message="Configuring Onlyoffice..."
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
#================================================= #=================================================
# UPGRADE ONLYOFFICE # UPGRADE ONLYOFFICE
#================================================= #=================================================
ynh_print_info --message="Upgrading OnlyOffice..." ynh_print_info --message="Upgrading OnlyOffice..."
wget $source wget $onlyoffice_source
ynh_package_install ./onlyoffice-documentserver_amd64.deb ynh_package_install ./onlyoffice-documentserver_amd64.deb
#=================================================
# MODIFY 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 # STORE THE CONFIG FILE CHECKSUM
#================================================= #=================================================
#ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json"
# 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 --file="/etc/onlyoffice/documentserver/default.json"
#================================================= #=================================================
@ -159,8 +177,7 @@ ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
ynh_print_info --message="Reloading OnlyOffice..." ynh_print_info --message="Reloading OnlyOffice..."
supervisorctl stop all supervisorctl restart all
supervisorctl start all
sleep 30 sleep 30