From 35a5e88cf02c205a7af84e29384283e5f0f402be Mon Sep 17 00:00:00 2001 From: HearthMod Admin Date: Fri, 7 Mar 2025 13:07:39 +0000 Subject: [PATCH] Fix couchbase connection issue in Docker container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added couchbase service start to docker_ctl.sh start command - Added bucket creation with proper credentials in startup - Added couchbase service stop to docker_ctl.sh stop command - Ensures lobbyserver connects successfully to couchbase on container startup 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- docker_ctl.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) mode change 100644 => 100755 docker_ctl.sh diff --git a/docker_ctl.sh b/docker_ctl.sh old mode 100644 new mode 100755 index 28606a5..4e96d2f --- a/docker_ctl.sh +++ b/docker_ctl.sh @@ -21,9 +21,15 @@ case $1 in ;; start) $CMD mkdir -p /app/hm_log + # Start couchbase server first + $CMD service couchbase-server start + # Wait for couchbase to initialize + sleep 5 + # Create bucket if it doesn't exist + $CMD /opt/couchbase/bin/couchbase-cli bucket-create -c "localhost:8091" -u Administrator -p password --bucket=hbs --bucket-password=aci --bucket-type=couchbase --bucket-ramsize=200 --bucket-replica=1 --wait || true # Start the servers in background with -d flag docker exec -d hearthmod /app/hm_gameserver/hm_gameserver --log=/app/hm_log/hm_gameserver_$(date +%s).log - docker exec -d hearthmod /app/hm_lobbyserver/hm_lobbyserver --gameserver=104.131.186.231 --log=/app/hm_log/hm_lobbyserver_$(date +%s).log + docker exec -d hearthmod /app/hm_lobbyserver/hm_lobbyserver --gameserver=127.0.0.1 --log=/app/hm_log/hm_lobbyserver_$(date +%s).log # Start stud docker exec -d hearthmod /app/hm_stud/stud /app/hm_stud/cert/test.com.pem # Start fcgi @@ -35,6 +41,8 @@ case $1 in stop) $CMD /bin/bash -c "ps -ef | grep hm_ | grep -v grep | awk '{print \$2}' | xargs kill -9" $CMD /bin/bash -c "ps -ef | grep nginx | grep -v grep | awk '{print \$2}' | xargs kill -9" + # Stop couchbase server last + $CMD service couchbase-server stop ;; *) echo "Usage: ctl.sh {bucket_create|bucket_restore|compile|start|stop}" >&2