install 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. #=================================================
  3. # IMPORT GENERIC HELPERS
  4. #=================================================
  5. source _common.sh
  6. source /usr/share/yunohost/helpers
  7. mail=$(ynh_user_get_info --username=$admin --key=mail)
  8. #=================================================
  9. # INITIALIZE AND STORE SETTINGS
  10. #=================================================
  11. #=================================================
  12. # DOWNLOAD, CHECK AND UNPACK SOURCE
  13. #=================================================
  14. ynh_script_progression "Setting up source files..."
  15. ynh_setup_source --dest_dir="$install_dir"
  16. chown -R "$app:www-data" "$install_dir"
  17. pushd
  18. python3 -m venv venv
  19. pip install open-webui
  20. open-webui serve
  21. popd
  22. chown -R "$app:www-data" "$install_dir"
  23. #=================================================
  24. # APP INITIAL CONFIGURATION
  25. #=================================================
  26. ynh_script_progression "Adding $app's configuration files..."
  27. ynh_config_add --template=".env" --destination="$install_dir/.env"
  28. chmod 400 "$install_dir/.env"
  29. chown "$app:$app" "$install_dir/.env"
  30. #=================================================
  31. # SYSTEM CONFIGURATION
  32. #=================================================
  33. ynh_script_progression "Adding system configurations related to $app..."
  34. ynh_config_add_phpfpm
  35. ynh_config_add_nginx
  36. ynh_config_add_logrotate
  37. #ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
  38. #=================================================
  39. # END OF SCRIPT
  40. #=================================================
  41. ynh_script_progression "Installation of $app completed"