mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 15:55:49 +00:00
v1 conversion to couchbase
This commit is contained in:
parent
28a2d2c9b6
commit
3bf1fbe95d
4 changed files with 80 additions and 0 deletions
4
scripts/dummy.sh
Executable file
4
scripts/dummy.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Running in Docker container - $0 not available"
|
||||
|
59
scripts/entrypoint.sh
Executable file
59
scripts/entrypoint.sh
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
staticConfigFile=/opt/couchbase/etc/couchbase/static_config
|
||||
restPortValue=8091
|
||||
|
||||
# see https://developer.couchbase.com/documentation/server/current/install/install-ports.html
|
||||
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"
|
||||
|
||||
|
||||
[[ "$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/sbin/runsvdir-start
|
||||
}
|
||||
|
||||
exec "$@"
|
10
scripts/run
Executable file
10
scripts/run
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
exec 2>&1
|
||||
# Create directories where couchbase stores its data
|
||||
|
||||
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
|
7
scripts/start-cb.sh
Normal file
7
scripts/start-cb.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
exec /opt/couchbase/bin/couchbase-server -- -kernel global_enable_tracing false -noinput &
|
||||
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8091)" != "301" ]]; do sleep 5; done
|
||||
cd /opt/couchbase/bin
|
||||
./couchbase-cli cluster-init -c localhost --cluster-username Administrator --cluster-password password --services data,index,query --cluster-ramsize 512
|
||||
./couchbase-cli bucket-create -c localhost:8091 --username Administrator --password password --bucket default --bucket-type couchbase --bucket-ramsize 256
|
||||
/bin/bash
|
Loading…
Reference in a new issue