install 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. echo "source $install_dir/.venv/bin/activate" >> $install_dir/.bashrc
  20. pip install open-webui
  21. open-webui serve
  22. popd
  23. chown -R "$app:www-data" "$install_dir"
  24. #=================================================
  25. # APP INITIAL CONFIGURATION
  26. #=================================================
  27. ynh_script_progression "Adding $app's configuration files..."
  28. ynh_config_add --template=".env" --destination="$install_dir/.env"
  29. chmod 400 "$install_dir/.env"
  30. chown "$app:$app" "$install_dir/.env"
  31. #=================================================
  32. # SYSTEM CONFIGURATION
  33. #=================================================
  34. ynh_script_progression "Adding system configurations related to $app..."
  35. ynh_config_add_phpfpm
  36. ynh_config_add_nginx
  37. ynh_config_add_logrotate
  38. #ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
  39. #=================================================
  40. # END OF SCRIPT
  41. #=================================================
  42. ynh_script_progression "Installation of $app completed"