upgrade 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. #=================================================
  3. # IMPORT GENERIC HELPERS
  4. #=================================================
  5. source _common.sh
  6. source /usr/share/yunohost/helpers
  7. #=================================================
  8. # STOP SYSTEMD SERVICE
  9. #=================================================
  10. ynh_script_progression "Stopping $app's systemd service..."
  11. ynh_systemctl --service="$app" --action="stop"
  12. #=================================================
  13. # DOWNLOAD, CHECK AND UNPACK SOURCE
  14. #=================================================
  15. pushd $install_dir
  16. source "$install_dir/venv/bin/activate"
  17. pip install -U open-webui
  18. deactivate
  19. popd
  20. chown -R "$app:www-data" "$install_dir"
  21. #=================================================
  22. # REAPPLY SYSTEM CONFIGURATION
  23. #=================================================
  24. ynh_script_progression "Upgrading system configurations related to $app..."
  25. ynh_config_add_nginx
  26. ynh_config_add_systemd
  27. yunohost service add "$app" --description="User-friendly AI Interface (Supports Ollama, OpenAI API, ...)" --log="/var/log/$app/$app.log"
  28. ynh_config_add_logrotate
  29. #ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
  30. #=================================================
  31. # START SYSTEMD SERVICE
  32. #=================================================
  33. ynh_script_progression "Starting $app's systemd service..."
  34. ynh_systemctl --service="$app" --action="start" --wait_until="No requirements found in frontmatter" --timeout=600
  35. #=================================================
  36. # END OF SCRIPT
  37. #=================================================
  38. ynh_script_progression "Upgrade of $app completed"