Add Apache CouchDB (#2473)

This commit is contained in:
JJ 2024-02-11 22:55:49 +01:00 committed by GitHub
parent 4164d42b7c
commit d5211aedec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 117 additions and 1 deletions

70
ct/apache-couchdb.sh Normal file
View file

@ -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"

View file

@ -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"

View file

@ -55,7 +55,6 @@ msg_info() {
SPINNER_PID=$! SPINNER_PID=$!
} }
# This function displays a success message with a green color. # This function displays a success message with a green color.
msg_ok() { msg_ok() {
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi