1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/couchdb_ynh.git synced 2024-09-03 18:16:11 +02:00
couchdb_ynh/scripts/install

86 lines
3.1 KiB
Text
Raw Permalink Normal View History

2021-03-07 19:51:22 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=3
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL COUCHDB
#=================================================
2021-07-23 11:54:20 +02:00
ynh_script_progression --message="Installing CouchDB..." --weight=60
2021-03-07 19:51:22 +01:00
2023-12-12 15:25:59 +01:00
echo "\
couchdb couchdb/mode select standalone
2021-03-07 19:51:22 +01:00
couchdb couchdb/mode seen true
couchdb couchdb/bindaddress string 127.0.0.1
couchdb couchdb/bindaddress seen true
2023-12-12 15:25:59 +01:00
couchdb couchdb/cookie string $password
couchdb couchdb/adminpass password $password
2021-03-07 19:51:22 +01:00
couchdb couchdb/adminpass seen true
2023-12-12 15:25:59 +01:00
couchdb couchdb/adminpass_again password $password
2021-03-07 19:51:22 +01:00
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive # apt-get install -y --force-yes couchdb
2023-12-12 14:41:46 +01:00
ynh_install_extra_app_dependencies \
--repo="deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -c -s) main" \
--key="https://couchdb.apache.org/repo/keys.asc" \
--package="couchdb"
2021-07-23 09:50:32 +02:00
2021-03-07 19:51:22 +01:00
#=================================================
2022-02-04 01:28:16 +01:00
# ADD A CONFIGURATION
2021-03-07 19:51:22 +01:00
#=================================================
2022-02-04 01:28:16 +01:00
ynh_script_progression --message="Adding a configuration file..." --weight=2
2021-03-07 19:51:22 +01:00
2022-02-04 01:28:16 +01:00
# Customize a bit the couch config
2023-12-12 14:41:46 +01:00
ynh_add_config --template="../conf/couch_ynh.ini" --destination="$install_dir/etc/local.d/couch_ynh.ini"
2021-03-07 19:51:22 +01:00
2023-12-12 14:41:46 +01:00
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:$app" "$install_dir"
2021-05-19 01:53:08 +02:00
2022-02-04 01:28:16 +01:00
#=================================================
# GENERIC FINALIZATION
2021-03-07 19:51:22 +01:00
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=2
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Open-source document-oriented NoSQL database" --log="/var/log/$app/$app.log" --needs_exposed_ports "$port"
#=================================================
# SETUP FAIL2BAN
#=================================================
ynh_script_progression --message="Configuring Fail2Ban..." --weight=3
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/couchdb/couchdb.log" --failregex="[warning] .*couch_httpd_auth: Authentication failed for user .+ from <HOST>" --max_retry=5
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last