1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wikijs_ynh.git synced 2024-09-03 20:36:09 +02:00

Merge pull request #193 from YunoHost-Apps/upgrade

Fix #178
This commit is contained in:
yalh76 2022-07-13 02:16:07 +02:00 committed by GitHub
commit 4bcb4a55ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 47 additions and 92 deletions

View file

@ -1,7 +0,0 @@
language: python
before_install:
- git clone https://github.com/YunoHost/package_linter /tmp/package_linter
script:
- /tmp/package_linter/package_linter.py ./

View file

@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Wiki.js is a copylefted libre software, modern and powerful wiki app built on Node.js, Git and Markdown for YunoHost.
**Shipped version:** 2.5.285~ynh1
**Shipped version:** 2.5.285~ynh2
**Demo:** https://docs-beta.requarks.io/

View file

@ -18,7 +18,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Wiki.js is a copylefted libre software, modern and powerful wiki app built on Node.js, Git and Markdown for YunoHost.
**Version incluse :** 2.5.285~ynh1
**Version incluse :** 2.5.285~ynh2
**Démo :** https://docs-beta.requarks.io/

View file

@ -53,44 +53,5 @@
port_already_use=0
change_url=1
;;; Options
Email=yalh@yahoo.com
Notification=yes
;;; Upgrade options
; commit=62db8a96750dfd28880126d3eb9228d4d71f0814
name=2.0.0-beta.303
; commit=90fb1a7cb3db812a8b2558673d5f1f22b39becec
name=2.0.12
; commit=f9dd286ff1d662e4ece78364230fc2fddef721cd
name=2.1.113
; commit=1898f27765068f49de23e7ba66b1fc23571799dc
name=2.2.51
; commit=8c74d870a550e99db4b6cac0a695f3155b28b514
name=2.3.77
; commit=ddb3a60b6f0f8024169db5a79ea07a9ac936b290
name=2.3.81~ynh1
; commit=164ef6bac3a65fe075850ec060edcd9c3249f83a
name=2.4.75~ynh1
; commit=ed3d16ea928155936ecf8753fcc6096a01971e6d
name=2.4.107~ynh1
; commit=6ee6878a94407749d768ee347f163904537dc945
name=2.5.170~ynh2
; commit=f241d2586694d9aff19ae6d67209142faa8b25ca
name=2.5.191~ynh1
; commit=3c9ab32ee147ef1f39aff2773fc3be506164d873
name=2.5.197~ynh1
; commit=bce2bfa3f9f0e28ffdde79df17a34bd5302559ea
name=2.5.201~ynh1
; commit=17ee20b13ba56babe0231b3f9bd87e9118908838
name=2.5.201~ynh2
; commit=16d047d802582d0d6db6d0d7343bd1fc0fb2eebf
name=2.5.201~ynh3
; commit=078ffc6ade0df8efd2e035c25e36218c163d158d
name=2.5.214~ynh1
; commit=8d478fadb941f2d8d4407f90cb3ae7e939ff8924
name=2.5.219~ynh1
; commit=b59ca572505eb6b4b4f29596100c68808ec143cd
name=2.5.219~ynh2
; commit=de01b48bfee4abff5edcf2fd288d3ff930ccc45a
name=2.5.268~ynh1
; commit=0721e06b03c1fa384adcade256b1d67c9462d61e
name=2.5.272~ynh1
Email=
Notification=none

View file

@ -1,9 +1,6 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location / {
# Path to source
#alias __FINALPATH__/ ;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
client_max_body_size 50M;
@ -17,5 +14,5 @@ location / {
proxy_next_upstream error timeout http_502 http_503 http_504;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
#include conf.d/yunohost_panel.conf.inc;
}

View file

@ -6,11 +6,11 @@ After=network.target
Type=simple
User=__APP__
Group=__APP__
Environment=__YNH_NODE_LOAD_PATH__
Environment=NODE_ENV=production
WorkingDirectory=__FINALPATH__
ExecStart=__YNH_NODE__ __FINALPATH__/server
Restart=always
Environment=__YNH_NODE_LOAD_PATH__
Environment=NODE_ENV=production
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these

View file

@ -6,7 +6,7 @@
"en": "Open source powerful wiki app built on Node.js, Git and Markdown",
"fr": "Wiki open source propulsé par Node.js, Git et Markdown"
},
"version": "2.5.285~ynh1",
"version": "2.5.285~ynh2",
"url": "https://wiki.js.org/",
"upstream": {
"license": "AGPL-3.0-or-later",

View file

@ -7,7 +7,7 @@
# dependencies used by the app
pkg_dependencies="postgresql postgresql-contrib"
NODEJS_VERSION=16
nodejs_version=16
#=================================================
# PERSONAL HELPERS

View file

@ -39,6 +39,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# 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"

View file

@ -71,7 +71,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
ynh_script_progression --message="Installing dependencies..."
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
#=================================================
@ -89,12 +89,11 @@ 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=30)
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
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -172,6 +171,8 @@ then
ynh_permission_update --permission="main" --add="visitors"
fi
ynh_permission_url --permission="main" --auth_header=false
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -32,7 +32,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
ldap_password=$(ynh_app_setting_get --app=$app --key=ldap_password)
@ -46,13 +46,6 @@ test ! -d $final_path \
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
@ -81,9 +74,16 @@ ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
@ -94,6 +94,13 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
#=================================================
# CREATE LDAP USER
#=================================================
ynh_script_progression --message="Creating LDAP user..."
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --domain $domain --password $ldap_password -q 0
#=================================================
# RESTORE SYSTEMD
#=================================================
@ -116,13 +123,6 @@ ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:"
#=================================================
# CREATE LDAP USER
#=================================================
ynh_script_progression --message="Creating LDAP user..."
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --domain $domain --password $ldap_password -q 0
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -21,7 +21,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_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)
ldap_user=$(ynh_app_setting_get --app=$app --key=ldap_user)
ldap_password=$(ynh_app_setting_get --app=$app --key=ldap_password)
@ -41,6 +41,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
@ -77,6 +78,8 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public
fi
ynh_permission_url --permission="main" --auth_header=false
# Remove yarn repository
ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list"
@ -103,7 +106,7 @@ fi
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -141,6 +144,15 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -149,16 +161,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_remove_nodejs
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs
#=================================================
# SPECIFIC UPGRADE
#=================================================