1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libremdb_ynh.git synced 2024-09-03 19:36:22 +02:00
This commit is contained in:
Éric Gaspar 2024-09-02 16:09:09 +02:00
parent 9fe8be1884
commit 729bb00406
7 changed files with 10 additions and 59 deletions

View file

@ -16,7 +16,7 @@ demo = "https://libremdb.iket.me/about"
code = "https://github.com/zyachel/libremdb" code = "https://github.com/zyachel/libremdb"
[integration] [integration]
yunohost = ">= 11.2.18" yunohost = ">= 11.2.29"
helpers_version = "2.1" helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true

View file

@ -18,10 +18,6 @@ ynh_backup "$install_dir"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/$app.service" ynh_backup "/etc/systemd/system/$app.service"
#================================================= #=================================================

View file

@ -26,9 +26,6 @@ domain="$old_domain"
ynh_config_add --template=".env.local.example" --destination="$install_dir/.env.local" ynh_config_add --template=".env.local.example" --destination="$install_dir/.env.local"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env.local"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env.local"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================

View file

@ -16,11 +16,8 @@ ynh_nodejs_install
#================================================= #=================================================
ynh_script_progression "Setting up source files..." ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -43,9 +40,6 @@ ynh_script_progression "Adding $app's configuration..."
ynh_config_add --template=".env.local.example" --destination="$install_dir/.env.local" ynh_config_add --template=".env.local.example" --destination="$install_dir/.env.local"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env.local"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env.local"
#================================================= #=================================================
# INSTALL LIBREMDB # INSTALL LIBREMDB
#================================================= #=================================================
@ -54,8 +48,8 @@ ynh_script_progression "Building $app..."
pushd $install_dir pushd $install_dir
ynh_hide_warnings npm install pnpm -g ynh_hide_warnings npm install pnpm -g
ynh_hide_warnings ynh_exec_as_app node_load_PATH pnpm install ynh_hide_warnings ynh_exec_as_app pnpm install
ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_ENV=production pnpm build ynh_hide_warnings ynh_exec_as_app NODE_ENV=production pnpm build
popd popd
#================================================= #=================================================
@ -73,7 +67,6 @@ yunohost service add $app --description="IMDb front-end" --log="/var/log/$app/$a
#================================================= #=================================================
ynh_script_progression "Starting $app's systemd service..." ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service
ynh_systemctl --service=$app --action="start" ynh_systemctl --service=$app --action="start"
#================================================= #=================================================

View file

@ -9,22 +9,18 @@ source /usr/share/yunohost/helpers
# REMOVE SERVICE INTEGRATION IN YUNOHOST # REMOVE SERVICE INTEGRATION IN YUNOHOST
#================================================= #=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_hide_warnings yunohost service status $app >/dev/null if ynh_hide_warnings yunohost service status $app >/dev/null
then then
ynh_script_progression "Removing $app service integration..." ynh_script_progression "Removing $app service integration..."
yunohost service remove $app yunohost service remove $app
fi fi
# Remove the dedicated systemd config
ynh_config_remove_systemd ynh_config_remove_systemd
# Remove the dedicated NGINX config
ynh_config_remove_nginx ynh_config_remove_nginx
ynh_redis_remove_db "$redis_db" ynh_redis_remove_db "$redis_db"
# Remove NodeJS
ynh_nodejs_remove ynh_nodejs_remove
#================================================= #=================================================

View file

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -11,10 +10,6 @@ ynh_script_progression "Restoring the app main directory..."
ynh_restore "$install_dir" ynh_restore "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# SPECIFIC RESTORATION
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================

View file

@ -26,32 +26,21 @@ fi
#================================================= #=================================================
ynh_script_progression "Upgrading dependencies..." ynh_script_progression "Upgrading dependencies..."
# Install Nodejs
ynh_nodejs_install ynh_nodejs_install
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression "Upgrading source files..."
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed ynh_setup_source --dest_dir="$install_dir"
if ynh_app_upstream_version_changed
then
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
pushd $install_dir pushd $install_dir
ynh_hide_warnings npm install pnpm -g ynh_hide_warnings npm install pnpm -g
ynh_hide_warnings ynh_exec_as_app node_load_PATH pnpm install ynh_hide_warnings ynh_exec_as_app pnpm install
ynh_hide_warnings ynh_exec_as_app node_load_PATH NODE_ENV=production pnpm build ynh_hide_warnings ynh_exec_as_app NODE_ENV=production pnpm build
popd popd
fi
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
@ -59,30 +48,15 @@ ynh_script_progression "Adding $app's configuration..."
ynh_config_add --template=".env.local.example" --destination="$install_dir/.env.local" ynh_config_add --template=".env.local.example" --destination="$install_dir/.env.local"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env.local"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/.env.local"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression "Upgrading NGINX web server configuration..." ynh_script_progression "Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_config_add_nginx ynh_config_add_nginx
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression "Upgrading systemd configuration..."
# Create a dedicated systemd config
ynh_config_add_systemd ynh_config_add_systemd
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression "Integrating service in YunoHost..."
yunohost service add $app --description="IMDb front-end" --log="/var/log/$app/$app.log" yunohost service add $app --description="IMDb front-end" --log="/var/log/$app/$app.log"
#================================================= #=================================================