upgrade 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. ynh_exec_as_app $install_dir/pip install -U open-webui
  17. popd
  18. chown -R "$app:www-data" "$install_dir"
  19. #=================================================
  20. # REAPPLY SYSTEM CONFIGURATION
  21. #=================================================
  22. ynh_script_progression "Upgrading system configurations related to $app..."
  23. ynh_config_add_nginx
  24. ynh_config_add_systemd
  25. yunohost service add "$app" --description="User-friendly AI Interface (Supports Ollama, OpenAI API, ...)" --log="/var/log/$app/$app.log"
  26. ynh_config_add_logrotate
  27. #ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
  28. #=================================================
  29. # START SYSTEMD SERVICE
  30. #=================================================
  31. ynh_script_progression "Starting $app's systemd service..."
  32. ynh_systemctl --service="$app" --action="start" --wait_until="No requirements found in frontmatter"
  33. #=================================================
  34. # END OF SCRIPT
  35. #=================================================
  36. ynh_script_progression "Upgrade of $app completed"