mirror of
https://github.com/YunoHost-Apps/wikijs_ynh.git
synced 2024-09-03 20:36:09 +02:00
commit
5a0dcef89a
10 changed files with 57 additions and 79 deletions
|
@ -28,7 +28,7 @@ Wiki.js is a copylefted libre software, modern and powerful wiki app built on No
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
* Official documentation: https://docs-beta.requarks.io/
|
* Official documentation: https://docs-beta.requarks.io/
|
||||||
* YunoHost documentation: https://yunohost.org/#/app_wikijs
|
* YunoHost documentation: https://yunohost.org/en/app_wikijs
|
||||||
|
|
||||||
## YunoHost specific features
|
## YunoHost specific features
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
upgrade=1 from_commit=3c9ab32ee147ef1f39aff2773fc3be506164d873
|
upgrade=1 from_commit=3c9ab32ee147ef1f39aff2773fc3be506164d873
|
||||||
# 2.5.201~ynh1
|
# 2.5.201~ynh1
|
||||||
upgrade=1 from_commit=bce2bfa3f9f0e28ffdde79df17a34bd5302559ea
|
upgrade=1 from_commit=bce2bfa3f9f0e28ffdde79df17a34bd5302559ea
|
||||||
|
# 2.5.201~ynh2
|
||||||
|
upgrade=1 from_commit=17ee20b13ba56babe0231b3f9bd87e9118908838
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
@ -66,3 +68,5 @@ Notification=yes
|
||||||
name=2.5.197~ynh1
|
name=2.5.197~ynh1
|
||||||
; commit=bce2bfa3f9f0e28ffdde79df17a34bd5302559ea
|
; commit=bce2bfa3f9f0e28ffdde79df17a34bd5302559ea
|
||||||
name=2.5.201~ynh1
|
name=2.5.201~ynh1
|
||||||
|
; commit=17ee20b13ba56babe0231b3f9bd87e9118908838
|
||||||
|
name=2.5.201~ynh2
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
"id": "wikijs",
|
"id": "wikijs",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "An open source, modern and powerful wiki app built on Node.js, Git and Markdown.",
|
"en": "Open source, modern and powerful wiki app built on Node.js, Git and Markdown.",
|
||||||
"fr": "Un wiki moderne et open source propulsé Node.js, Git et Markdown."
|
"fr": "Wiki moderne et open source propulsé Node.js, Git et Markdown."
|
||||||
},
|
},
|
||||||
"version": "2.5.201~ynh2",
|
"version": "2.5.201~ynh3",
|
||||||
"url": "https://wiki.js.org/",
|
"url": "https://wiki.js.org/",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies="postgresql postgresql-contrib"
|
pkg_dependencies="postgresql postgresql-contrib"
|
||||||
|
|
||||||
NODEJS_VERSION=12
|
NODEJS_VERSION=14
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
|
|
@ -29,10 +29,6 @@ ynh_script_progression --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=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
# 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)
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -129,7 +129,7 @@ yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikij
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a config file..."
|
ynh_script_progression --message="Adding a configuration file..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml"
|
ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml"
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ chown $app:$app "$final_path/config.yml"
|
||||||
ynh_script_progression --message="Configuring a systemd service..."
|
ynh_script_progression --message="Configuring a systemd service..."
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH"
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -169,8 +169,6 @@ ynh_script_progression --message="Configuring permissions..."
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
then
|
then
|
||||||
# Everyone can access the app.
|
|
||||||
# The "main" permission is automatically created before the install script.
|
|
||||||
ynh_permission_update --permission="main" --add="visitors"
|
ynh_permission_update --permission="main" --add="visitors"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ ynh_remove_systemd_config
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database..."
|
ynh_script_progression --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_user="$db_user" --db_name="$db_name"
|
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
|
@ -77,16 +77,6 @@ ynh_script_progression --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_script_progression --message="Closing port $port..."
|
|
||||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -51,7 +51,7 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
ynh_script_progression --message="Restoring the NGINX configuration..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
|
|
@ -33,40 +33,6 @@ ynh_script_progression --message="Checking version..."
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
|
||||||
|
|
||||||
# If ldap_user doesn't exist, retrieve it or create it
|
|
||||||
if [[ -z "$ldap_user" ]]; then
|
|
||||||
ldap_user="svc_${app}_ldap"
|
|
||||||
ldap_password=$(ynh_string_random --length=8)
|
|
||||||
ynh_app_setting_set "$app" ldap_user "$ldap_user"
|
|
||||||
ynh_app_setting_set "$app" ldap_password "$ldap_password"
|
|
||||||
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove yarn repository
|
|
||||||
ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list"
|
|
||||||
|
|
||||||
# Remove old log file
|
|
||||||
ynh_secure_remove --file="/var/log/$app/"
|
|
||||||
|
|
||||||
# Create PostgreSQL User
|
|
||||||
ynh_psql_create_user $db_name $db_pwd
|
|
||||||
|
|
||||||
# Install pg_trgm extension to provide a PostgreSQL search solution
|
|
||||||
ynh_psql_test_if_first_run
|
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
|
||||||
if ynh_legacy_permissions_exists; then
|
|
||||||
ynh_legacy_permissions_delete_all
|
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -90,6 +56,47 @@ ynh_script_progression --message="Stopping a systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped wikijs service"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped wikijs service"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||||
|
|
||||||
|
# If ldap_user doesn't exist, retrieve it or create it
|
||||||
|
if [[ -z "$ldap_user" ]]; then
|
||||||
|
ldap_user="svc_${app}_ldap"
|
||||||
|
ldap_password=$(ynh_string_random --length=8)
|
||||||
|
ynh_app_setting_set "$app" ldap_user "$ldap_user"
|
||||||
|
ynh_app_setting_set "$app" ldap_password "$ldap_password"
|
||||||
|
yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0
|
||||||
|
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
|
||||||
|
|
||||||
|
# Remove yarn repository
|
||||||
|
ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list"
|
||||||
|
|
||||||
|
# Remove old log file
|
||||||
|
ynh_secure_remove --file="/var/log/$app/"
|
||||||
|
|
||||||
|
# Create PostgreSQL User
|
||||||
|
ynh_psql_create_user $db_name $db_pwd
|
||||||
|
|
||||||
|
# Install pg_trgm extension to provide a PostgreSQL search solution
|
||||||
|
ynh_psql_test_if_first_run
|
||||||
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
||||||
|
|
||||||
|
# Cleaning legacy permissions
|
||||||
|
if ynh_legacy_permissions_exists; then
|
||||||
|
ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -156,7 +163,7 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a config file..."
|
ynh_script_progression --message="Updating a configuration file..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml"
|
ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml"
|
||||||
|
|
||||||
|
@ -169,7 +176,7 @@ chown $app:$app "$final_path/config.yml"
|
||||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH"
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -72,17 +72,7 @@ ynh_send_readme_to_admin() {
|
||||||
|
|
||||||
Specific information for the application $app.
|
Specific information for the application $app.
|
||||||
|
|
||||||
$(if [ -n "$app_message" ]
|
$(cat "$app_message")"
|
||||||
then
|
|
||||||
cat "$app_message"
|
|
||||||
else
|
|
||||||
echo "...No specific information..."
|
|
||||||
fi)
|
|
||||||
|
|
||||||
---
|
|
||||||
Automatic diagnosis data from YunoHost
|
|
||||||
|
|
||||||
__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__"
|
|
||||||
|
|
||||||
# Store the message into a file for further modifications.
|
# Store the message into a file for further modifications.
|
||||||
echo "$mail_message" > mail_to_send
|
echo "$mail_message" > mail_to_send
|
||||||
|
@ -103,10 +93,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
||||||
# Insert url links tags
|
# Insert url links tags
|
||||||
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
|
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
|
||||||
|
|
||||||
# Insert pre tags
|
|
||||||
ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
|
|
||||||
ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
|
|
||||||
|
|
||||||
# Insert finishing HTML tags
|
# Insert finishing HTML tags
|
||||||
echo -e "\n</body>\n</html>" >> mail_to_send
|
echo -e "\n</body>\n</html>" >> mail_to_send
|
||||||
|
|
||||||
|
@ -115,9 +101,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
||||||
# Remove URL tags
|
# Remove URL tags
|
||||||
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
|
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
|
||||||
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
|
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
|
||||||
|
|
||||||
# Remove PRE tags
|
|
||||||
ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Define binary to use for mail command
|
# Define binary to use for mail command
|
||||||
|
|
Loading…
Reference in a new issue