From d5211aedeccdb3f65f5b9bc98f6933d24c018fbe Mon Sep 17 00:00:00 2001 From: JJ Date: Sun, 11 Feb 2024 22:55:49 +0100 Subject: [PATCH] Add Apache CouchDB (#2473) --- ct/apache-couchdb.sh | 70 +++++++++++++++++++++++++++++++ install/apache-couchdb-install.sh | 47 +++++++++++++++++++++ misc/build.func | 1 - 3 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 ct/apache-couchdb.sh create mode 100644 install/apache-couchdb-install.sh diff --git a/ct/apache-couchdb.sh b/ct/apache-couchdb.sh new file mode 100644 index 00000000..cd2c00af --- /dev/null +++ b/ct/apache-couchdb.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ___ __ ______ __ ____ ____ + / | ____ ____ ______/ /_ ___ / ____/___ __ _______/ /_ / __ \/ __ ) + / /| | / __ \/ __ `/ ___/ __ \/ _ \ / / / __ \/ / / / ___/ __ \/ / / / __ | + / ___ |/ /_/ / /_/ / /__/ / / / __/ / /___/ /_/ / /_/ / /__/ / / / /_/ / /_/ / +/_/ |_/ .___/\__,_/\___/_/ /_/\___/ \____/\____/\__,_/\___/_/ /_/_____/_____/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="Apache-CouchDB" +var_disk="10" +var_cpu="2" +var_ram="4096" +var_os="debian" +var_version="12" +VERBOSE="yes" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} + +function update_script() { +header_info +if [[ ! -f /etc/systemd/system/couchdb.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi +msg_error "There is currently no update path available." +exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:5984/_utils/${CL} \n" diff --git a/install/apache-couchdb-install.sh b/install/apache-couchdb-install.sh new file mode 100644 index 00000000..41cfde57 --- /dev/null +++ b/install/apache-couchdb-install.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 tteck +# Author: tteck (tteckster) +# License: MIT +# https://github.com/tteck/Proxmox/raw/main/LICENSE + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y curl +$STD apt-get install -y sudo +$STD apt-get install -y mc +$STD apt-get install -y apt-transport-https +$STD apt-get install -y gnupg +msg_ok "Installed Dependencies" + +msg_info "Installing Apache CouchDB" +ERLANG_COOKIE=$(openssl rand -base64 32) +ADMIN_PASS="$(openssl rand -base64 18 | cut -c1-13)" +debconf-set-selections <<< "couchdb couchdb/cookie string $ERLANG_COOKIE" +debconf-set-selections <<< "couchdb couchdb/mode select standalone" +debconf-set-selections <<< "couchdb couchdb/bindaddress string 0.0.0.0" +debconf-set-selections <<< "couchdb couchdb/adminpass password $ADMIN_PASS" +debconf-set-selections <<< "couchdb couchdb/adminpass_again password $ADMIN_PASS" +curl -fsSL https://couchdb.apache.org/repo/keys.asc | gpg --dearmor -o /usr/share/keyrings/couchdb-archive-keyring.gpg +VERSION_CODENAME="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)" +echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ ${VERSION_CODENAME} main" >/etc/apt/sources.list.d/couchdb.sources.list +$STD apt-get update +$STD apt-get install -y couchdb +echo -e "CouchDB Erlang Cookie: \e[32m$ERLANG_COOKIE\e[0m" >>~/CouchDB.creds +echo -e "CouchDB Admin Password: \e[32m$ADMIN_PASS\e[0m" >>~/CouchDB.creds +msg_ok "Installed Apache CouchDB." + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get autoremove +$STD apt-get autoclean +msg_ok "Cleaned" diff --git a/misc/build.func b/misc/build.func index 77091c5c..6bc7738e 100644 --- a/misc/build.func +++ b/misc/build.func @@ -55,7 +55,6 @@ msg_info() { SPINNER_PID=$! } - # This function displays a success message with a green color. msg_ok() { if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi