install 1.9 KB

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