feat(couchbase): fix

This commit is contained in:
tiennm99 committed 2025-10-07 22:31:55 +07:00
1 parent eb028c8ee1
commit a141b1db39
7 files changed
+36 -165

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
set -e
cd /opt/couchbase
mkdir -p var/lib/couchbase \
var/lib/couchbase/config \
var/lib/couchbase/data \
var/lib/couchbase/stats \
var/lib/couchbase/logs \
var/lib/moxi
chown -R couchbase:couchbase var
su - couchbase -c "/opt/couchbase/bin/couchbase-server -- -noinput"
-4
View File
@@ -1,4 +0,0 @@
#!/bin/sh
echo "Running in Docker container - $0 not available"
-62
View File
@@ -1,62 +0,0 @@
#!/bin/bash
set -ex
staticConfigFile=/opt/couchbase/etc/couchbase/static_config
restPortValue=8091
# see https://developer.couchbase.com/documentation/server/current/install/install-ports.html
# https://docs.couchbase.com/couchbase-manual-2.5/cb-install/#network-ports
function overridePort() {
portName=$1
portNameUpper=$(echo $portName | awk '{print toupper($0)}')
portValue=${!portNameUpper}
# only override port if value available AND not already contained in static_config
if [ "$portValue" != "" ]; then
if grep -Fq "{${portName}," ${staticConfigFile}
then
echo "Don't override port ${portName} because already available in $staticConfigFile"
else
echo "Override port '$portName' with value '$portValue'"
echo "{$portName, $portValue}." >> ${staticConfigFile}
if [ ${portName} == "rest_port" ]; then
restPortValue=${portValue}
fi
fi
fi
}
overridePort "rest_port"
overridePort "mccouch_port"
overridePort "memcached_port"
overridePort "query_port"
overridePort "ssl_query_port"
overridePort "fts_http_port"
overridePort "moxi_port"
overridePort "ssl_rest_port"
overridePort "ssl_capi_port"
overridePort "ssl_proxy_downstream_port"
overridePort "ssl_proxy_upstream_port"
# if [ "$1" == "couchbase-server" ] && [ ! -d "/etc/service" ]; then
[[ "$1" == "couchbase-server" ]] && {
if [ "$(whoami)" = "couchbase" ]; then
# Ensure that /opt/couchbase/var is owned by user 'couchbase' and
# is writable
if [ ! -w /opt/couchbase/var -o \
$(find /opt/couchbase/var -maxdepth 0 -printf '%u') != "couchbase" ]; then
echo "/opt/couchbase/var is not owned and writable by UID 1000"
echo "Aborting as Couchbase Server will likely not run"
exit 1
fi
fi
echo "Starting Couchbase Server -- Web UI available at http://<ip>:$restPortValue"
echo "and logs available in /opt/couchbase/var/lib/couchbase/logs"
exec /usr/bin/runsvdir -P /etc/service
}
# fi
exec "$@"
-21
View File
@@ -1,21 +0,0 @@
#!/bin/sh
unset HOME
exec 2>&1
# Create directories where couchbase stores its data
cd /opt/couchbase
mkdir -p var/lib/couchbase \
var/lib/couchbase/config \
var/lib/couchbase/data \
var/lib/couchbase/stats \
var/lib/couchbase/logs \
var/lib/moxi
chown -R couchbase:couchbase var
if [ $(whoami) = "couchbase" ]; then
exec /opt/couchbase/bin/couchbase-server -- -kernel global_enable_tracing false -noinput
else
exec chpst -ucouchbase /opt/couchbase/bin/couchbase-server -- -kernel global_enable_tracing false -noinput
fi