server running in background

This commit is contained in:
Mohd-
2025-03-07 15:11:34 +03:00
parent 33a2253e3d
commit 9678b1222e
4 changed files with 71 additions and 16 deletions
+29 -10
View File
@@ -1,15 +1,34 @@
#!/bin/bash
# Sleep for a few seconds (if needed)
# sleep 5
# compiling
# Start Couchbase Server
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
cd /app/hm_stud && make && rm -rf cert/test* && cd cert && sh gen_cert.sh
make -C /app/hm_gameserver
make -C /app/hm_lobbyserver
cd /app/hm_nginx && sed "s@\/usr\/local\/web@$(pwd)\/..\/hm_web\/@" conf/hm_nginx.conf > conf/nginx.conf && ./configure --with-http_ssl_module && make && make install
cd /app/hm_sunwell/examples && npm install
# Keep the script running to prevent the container from exiting
# tail -f /dev/null
# start
mkdir -p /app/hm_log
# Start the servers
/app/hm_gameserver/hm_gameserver --log=/app/hm_log/hm_gameserver_$(date +%s).log
/app/hm_lobbyserver/hm_lobbyserver --gameserver=104.131.186.231 --log=/app/hm_log/hm_lobbyserver_$(date +%s).log
# Start stud
/app/hm_stud/stud /app/hm_stud/cert/test.com.pem
# Start fcgi
spawn-fcgi -d /app/hm_web/ -f /app/hm_web/app.py -a 127.0.0.1 -p 9002
# Start nginx
/app/hm_nginx/objs/nginx
/bin/bash -c 'cd /app/hm_sunwell && nodejs examples/server hm_sunwell > /app/hm_log/nodejs_server_$(date +%s).log 2>&1' &
# bucket create
/opt/couchbase/bin/couchbase-cli bucket-create -c "localhost:8091" --bucket=hbs --bucket-password=aci --bucket-type=couchbase --bucket-ramsize=200 --bucket-replica=1 --wait
# bucket restore
/opt/couchbase/bin/cbrestore /app/hm_database/hbs http://localhost:8091/ --bucket-source=hbs
tail -f /dev/null