install 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash
  2. # @@ install of flohmarkt still missing
  3. #=================================================
  4. # GENERIC START
  5. #=================================================
  6. # IMPORT GENERIC HELPERS
  7. #=================================================
  8. source _common.sh
  9. source /usr/share/yunohost/helpers
  10. #=================================================
  11. # INITIALIZE AND STORE SETTINGS
  12. #=================================================
  13. # Not stored by default
  14. ynh_app_setting_set --app=$app --key=password --value="$password"
  15. #=================================================
  16. # NGINX CONFIGURATION
  17. #=================================================
  18. ynh_script_progression --message="Configuring NGINX web server..." --weight=3
  19. # Create a dedicated NGINX config
  20. ynh_add_nginx_config
  21. #=================================================
  22. # SPECIFIC SETUP
  23. #=================================================
  24. # INSTALL COUCHDB
  25. #=================================================
  26. ynh_script_progression --message="Installing CouchDB..." --weight=60
  27. echo "\
  28. couchdb couchdb/mode select standalone
  29. couchdb couchdb/mode seen true
  30. couchdb couchdb/bindaddress string 127.0.0.1
  31. couchdb couchdb/bindaddress seen true
  32. couchdb couchdb/cookie string $password
  33. couchdb couchdb/adminpass password $password
  34. couchdb couchdb/adminpass seen true
  35. couchdb couchdb/adminpass_again password $password
  36. couchdb couchdb/adminpass_again seen true" | debconf-set-selections
  37. DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
  38. ynh_install_extra_app_dependencies \
  39. --repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" \
  40. --key="https://couchdb.apache.org/repo/keys.asc" \
  41. --package="couchdb"
  42. #=================================================
  43. # ADD A CONFIGURATION
  44. #=================================================
  45. ynh_script_progression --message="Adding a configuration file..." --weight=2
  46. # Customize a bit the couch config
  47. ynh_add_config --template="../conf/couch_ynh.ini" --destination="$install_dir/etc/local.d/couch_ynh.ini"
  48. chmod 750 "$install_dir"
  49. chmod -R o-rwx "$install_dir"
  50. chown -R "$app:$app" "$install_dir"
  51. #=================================================
  52. # GENERIC FINALIZATION
  53. #=================================================
  54. # SETUP LOGROTATE
  55. #=================================================
  56. ynh_script_progression --message="Configuring log rotation..." --weight=2
  57. # Use logrotate to manage application logfile(s)
  58. # @@ how does this know where the logfiles are?
  59. ynh_use_logrotate
  60. #=================================================
  61. # INTEGRATE SERVICE IN YUNOHOST
  62. #=================================================
  63. ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
  64. yunohost service add $app --description="Open-source document-oriented NoSQL database" --log="/var/log/$app/$app.log" --needs_exposed_ports "$port"
  65. #=================================================
  66. # SETUP FAIL2BAN
  67. #=================================================
  68. # no need for couchdb, because it will not listen externally
  69. # ynh_script_progression --message="Configuring Fail2Ban..." --weight=3
  70. #
  71. # # Create a dedicated Fail2Ban config
  72. # ynh_add_fail2ban_config --logpath="/var/log/couchdb/couchdb.log" --failregex="[warning] .*couch_httpd_auth: Authentication failed for user .+ from <HOST>" --max_retry=5
  73. #=================================================
  74. # END OF SCRIPT
  75. #=================================================
  76. ynh_script_progression --message="Installation of $app completed" --last