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

Merge pull request #47 from YunoHost-Apps/upgrade

Upgrade
This commit is contained in:
yalh76 2022-06-23 23:53:47 +02:00 committed by GitHub
commit 54c6ef9e93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 62 additions and 74 deletions

View file

@ -43,7 +43,7 @@ NocoDB has its own authentication system which does not rely on YunoHost's SSO o
## Documentation and resources
* Official app website: <https://www.nocodb.com/>
* Official app website: <https://www.nocodb.com>
* Upstream app code repository: <https://github.com/nocodb/nocodb>
* YunoHost documentation for this app: <https://yunohost.org/app_nocodb>
* Report a bug: <https://github.com/YunoHost-Apps/nocodb_ynh/issues>

View file

@ -43,7 +43,7 @@ NocoDB has its own authentication system which does not rely on YunoHost's SSO o
## Documentations et ressources
* Site officiel de l'app : <https://www.nocodb.com/>
* Site officiel de l'app : <https://www.nocodb.com>
* Dépôt de code officiel de l'app : <https://github.com/nocodb/nocodb>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_nocodb>
* Signaler un bug : <https://github.com/YunoHost-Apps/nocodb_ynh/issues>

View file

@ -1,10 +1,6 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
;; Test complet
; Manifest
domain="domain.tld"
path="/"
is_public=1
; Checks
pkg_linter=1
@ -16,14 +12,9 @@
upgrade=1
#upgrade=1 from_commit=CommitHash
backup_restore=1
multi_instance=1
multi_instance=0
port_already_use=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -2,5 +2,6 @@ SOURCE_URL=https://github.com/nocodb/nocodb-seed/archive/8400c313906da8293014fd5
SOURCE_SUM=9307888a5e21cb220280ca688bde6f71fafae4c3738df72e88a990d52c3c5544
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_EXTRACT=true
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -7,10 +7,10 @@
"fr": "Plateform sans code qui transforme toute base de données en un tableur intelligent."
},
"version": "0.90.11~ynh1",
"url": "https://www.nocodb.com/",
"url": "https://www.nocodb.com",
"upstream": {
"license": "AGPL-3.0-only",
"website": "https://www.nocodb.com/",
"website": "https://www.nocodb.com",
"demo": "https://www.nocodb.com/demos",
"code": "https://github.com/nocodb/nocodb"
},
@ -20,9 +20,9 @@
"email": "tituspijean@outlook.com"
},
"requirements": {
"yunohost": ">= 4.3"
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"multi_instance": false,
"services": [
"nginx",
"php7.3-fpm",

View file

@ -4,6 +4,7 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
nodejs_version=16
#=================================================

View file

@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================
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

View file

@ -17,14 +17,10 @@ old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
new_path="/"
app=$YNH_APP_INSTANCE_NAME
if [ $new_path != "/" ]; then
ynh_die --message="The app can only be installed at the root of a domain."
fi
#=================================================
# LOAD SETTINGS
#=================================================
@ -41,6 +37,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"
@ -117,7 +114,8 @@ fi
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Visit : localhost:"
#=================================================
# RELOAD NGINX

View file

@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -21,11 +24,13 @@ ynh_abort_if_errors
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url="/" #$YNH_APP_ARG_PATH
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
jwt_secret=$(ynh_string_random --length=20)
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
@ -50,6 +55,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=jwt_secret --value=$jwt_secret
#=================================================
# STANDARD MODIFICATIONS
@ -117,7 +123,6 @@ ynh_script_progression --message="Installing NocoDB..." --weight=5
ynh_use_nodejs
pushd $final_path
if [ $YNH_ARCH = "arm64" ]; then
ynh_print_info --message="Retrieving and building OracleDB for ARM64..."
ynh_exec_warn_less ynh_exec_as $app git clone --recursive https://github.com/oracle/node-oracledb.git oracledb
@ -136,9 +141,6 @@ popd
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
jwt_secret=$(ynh_string_random --length=20)
ynh_app_setting_set --app=$app --key=jwt_secret --value=$jwt_secret
ynh_add_config --template="env" --destination="$final_path/.env"
chmod 400 "$final_path/.env"
@ -175,7 +177,7 @@ yunohost service add $app --description="$app daemon, turns any database into a
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Visit : localhost:"
#=================================================
# SETUP SSOWAT

View file

@ -43,6 +43,14 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
@ -51,13 +59,6 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=1
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
ynh_remove_nodejs
#=================================================
# REMOVE APP MAIN DIR
#=================================================
@ -75,12 +76,11 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
ynh_remove_nginx_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
ynh_remove_nodejs
#=================================================
# SPECIFIC REMOVE

View file

@ -15,8 +15,7 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_clean_setup () {
#### Remove this function if there's nothing to clean before calling the remove script.
true
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -33,7 +32,6 @@ 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
nodejs_version=$(ynh_app_setting_get --app=$app --key=nodejs_version)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -45,13 +43,6 @@ test ! -d $final_path \
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
@ -80,6 +71,13 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=2
ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
@ -108,6 +106,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@ -120,19 +125,12 @@ yunohost service add $app --description="$app daemon, turns any database into a
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Visit : localhost:"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1

View file

@ -25,6 +25,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
@ -36,6 +37,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
}
@ -54,7 +56,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#=================================================
# CREATE DEDICATED USER
@ -80,14 +82,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -98,6 +92,14 @@ if [ $nodejs_version != $(ynh_app_setting_get --app=$app --key=nodejs_version) ]
ynh_install_nodejs --nodejs_version=$nodejs_version
fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
@ -149,7 +151,7 @@ yunohost service add $app --description="$app daemon, turns any database into a
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Visit : localhost:"
#=================================================
# RELOAD NGINX

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]