1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/navidrome_ynh.git synced 2024-09-03 19:46:30 +02:00

Merge pull request #52 from YunoHost-Apps/testing

Upgrade templates
This commit is contained in:
yalh76 2021-05-18 22:48:24 +02:00 committed by GitHub
commit e8359a66d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 104 additions and 99 deletions

View file

@ -1,6 +1,6 @@
---
name: Bug report
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all.
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
@ -8,28 +8,30 @@ about: Create a report to help us debug, it would be nice to fill the template a
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to Navidrome itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
**Describe the bug**
### Describe the bug
*A clear and concise description of what the bug is.*
**Versions**
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info navidrome`*
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
**To Reproduce**
*Steps to reproduce the behavior.*
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install navidrome
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
@ -38,9 +40,16 @@ about: Create a report to help us debug, it would be nice to fill the template a
3. *Scroll down to '...'*
4. *See error*
**Expected behavior**
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
**Logs**
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -1,16 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -31,9 +31,9 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up Navidrome before changing its URL..." --weight=1
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
@ -41,7 +41,7 @@ ynh_clean_setup () {
# 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"
# restore it if the upgrade fails
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
@ -70,7 +70,7 @@ fi
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# MODIFY URL IN NGINX CONF
@ -111,6 +111,9 @@ path_url="$new_path"
ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml"
chmod 600 "$config_path/navidrome.toml"
chown -R $app:$app "$config_path"
#=================================================
# GENERIC FINALISATION
#=================================================
@ -119,7 +122,7 @@ ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/n
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Version:"
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:"
#=================================================
# RELOAD NGINX

View file

@ -81,10 +81,13 @@ ynh_system_user_create --username=$app --home_dir=$final_path
ynh_script_progression --message="Setting up source files..." --weight=4
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path --source_id="$architecture"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -111,27 +114,19 @@ mkdir -p "$config_path"
# Main config File
ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml"
chmod 600 "$config_path/navidrome.toml"
chown -R $app:$app "$config_path"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_replace_string --match_string="__CONFIG_PATH__" --replace_string="$config_path" --target_file="../conf/systemd.service"
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions to app files
chown -R $app:$app "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$config_path"
chmod 600 "/var/lib/$app/navidrome.toml"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@ -145,16 +140,18 @@ yunohost service add $app --description "Web-based music collection server and s
ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Version:"
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi
@ -169,4 +166,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of Navidrome completed" --last
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -64,23 +64,9 @@ ynh_script_progression --message="Restoring Navidrome main directory..." --weigh
ynh_restore_file --origin_path="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring Navidrome config directory..." --weight=2
ynh_restore_file --origin_path="/var/lib/$app"
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app:$app "$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "/var/lib/$app"
chmod 600 "/var/lib/$app/navidrome.toml"
chown -R $app:$app "$final_path"
#=================================================
# SPECIFIC RESTORATION
@ -92,6 +78,16 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=7
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..." --weight=2
ynh_restore_file --origin_path="/var/lib/$app"
chmod 600 "/var/lib/$app/navidrome.toml"
chown -R $app:$app "/var/lib/$app"
#=================================================
# RESTORE SYSTEMD
#=================================================
@ -105,14 +101,14 @@ systemctl enable $app.service --quiet
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Web-based music collection server and streamer"
yunohost service add $app --description="Web-based music collection server and streamer"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Version:"
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:"
#=================================================
# GENERIC FINALIZATION

View file

@ -29,27 +29,15 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# 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
#=================================================
ynh_script_progression --message="Backing up Navidrome before upgrading..." --weight=4
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
@ -62,7 +50,19 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# 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
@ -87,12 +87,16 @@ then
ynh_setup_source --dest_dir=$final_path --source_id="$architecture"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
@ -103,32 +107,28 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=8
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SETUP SYSTEMD
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2
ynh_script_progression --message="Updating a configuration file..."
config_path="/var/lib/$app"
# Uncomment when there is new options added upstream
#ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml"
chmod 600 "$config_path/navidrome.toml"
chown -R $app:$app "$config_path"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
# Create a dedicated systemd config
ynh_replace_string --match_string="__CONFIG_PATH__" --replace_string="$config_path" --target_file="../conf/systemd.service"
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R $app:$app "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$config_path"
chmod 600 "/var/lib/$app/navidrome.toml"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@ -141,7 +141,7 @@ yunohost service add $app --description "Web-based music collection server and s
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Version:"
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:"
#=================================================
# RELOAD NGINX
@ -154,4 +154,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of Navidrome completed" --last
ynh_script_progression --message="Upgrade of $app completed" --last