server running in background
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
# HearthMod Build Commands and Code Guidelines
|
||||||
|
|
||||||
|
## Build Commands
|
||||||
|
- `docker-compose up --build` - Build and start the project container
|
||||||
|
- `bash docker_ctl.sh compile` - Compile and install server stack
|
||||||
|
- `bash docker_ctl.sh start` - Start server stack
|
||||||
|
- `bash docker_ctl.sh stop` - Stop server stack
|
||||||
|
- Component-specific: `cd hm_gameserver && make`
|
||||||
|
- Base library: `make -C ../hm_base target=game`
|
||||||
|
|
||||||
|
## Code Style Guidelines
|
||||||
|
- **Indentation**: 4 spaces for C/C++/Python
|
||||||
|
- **Naming**:
|
||||||
|
- C: snake_case for functions/variables, UPPER_SNAKE_CASE for constants
|
||||||
|
- C++: camelCase for methods/variables, UPPER_SNAKE_CASE for constants
|
||||||
|
- Structs use _s suffix, enums use _e suffix
|
||||||
|
- **Headers**: System includes first, then project includes
|
||||||
|
- **Error handling**: Functions return int (0=success, negative=failure)
|
||||||
|
- **Logging**: Use `hm_log(LOG_LEVEL, log_instance, "message")`
|
||||||
|
- **Memory**: Always free allocated resources, use pooled allocation when possible
|
||||||
|
- **Initialization**: Follow component-specific init/cleanup patterns
|
||||||
+6
-6
@@ -21,15 +21,15 @@ case $1 in
|
|||||||
;;
|
;;
|
||||||
start)
|
start)
|
||||||
$CMD mkdir -p /app/hm_log
|
$CMD mkdir -p /app/hm_log
|
||||||
# Start the servers
|
# Start the servers in background with -d flag
|
||||||
$CMD /app/hm_gameserver/hm_gameserver --log=/app/hm_log/hm_gameserver_$(date +%s).log
|
docker exec -d hearthmod /app/hm_gameserver/hm_gameserver --log=/app/hm_log/hm_gameserver_$(date +%s).log
|
||||||
$CMD /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=104.131.186.231 --log=/app/hm_log/hm_lobbyserver_$(date +%s).log
|
||||||
# Start stud
|
# Start stud
|
||||||
$CMD /app/hm_stud/stud /app/hm_stud/cert/test.com.pem
|
docker exec -d hearthmod /app/hm_stud/stud /app/hm_stud/cert/test.com.pem
|
||||||
# Start fcgi
|
# Start fcgi
|
||||||
$CMD spawn-fcgi -d /app/hm_web/ -f /app/hm_web/app.py -a 127.0.0.1 -p 9002
|
docker exec -d hearthmod spawn-fcgi -d /app/hm_web/ -f /app/hm_web/app.py -a 127.0.0.1 -p 9002
|
||||||
# Start nginx
|
# Start nginx
|
||||||
$CMD /app/hm_nginx/objs/nginx
|
docker exec -d hearthmod /app/hm_nginx/objs/nginx
|
||||||
docker exec -d hearthmod /bin/bash -c 'cd /app/hm_sunwell && nodejs examples/server hm_sunwell > /app/hm_log/nodejs_server_$(date +%s).log 2>&1'
|
docker exec -d hearthmod /bin/bash -c 'cd /app/hm_sunwell && nodejs examples/server hm_sunwell > /app/hm_log/nodejs_server_$(date +%s).log 2>&1'
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
|
|||||||
+29
-10
@@ -1,15 +1,34 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Sleep for a few seconds (if needed)
|
# compiling
|
||||||
# sleep 5
|
|
||||||
|
|
||||||
# Start Couchbase Server
|
cd /app/hm_stud && make && rm -rf cert/test* && cd cert && sh gen_cert.sh
|
||||||
if [ "$(whoami)" = "couchbase" ]; then
|
make -C /app/hm_gameserver
|
||||||
exec /opt/couchbase/bin/couchbase-server -- -kernel global_enable_tracing false -noinput
|
make -C /app/hm_lobbyserver
|
||||||
else
|
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
|
||||||
exec chpst -ucouchbase /opt/couchbase/bin/couchbase-server -- -kernel global_enable_tracing false -noinput
|
cd /app/hm_sunwell/examples && npm install
|
||||||
fi
|
|
||||||
|
|
||||||
# Keep the script running to prevent the container from exiting
|
# start
|
||||||
# tail -f /dev/null
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Sleep for a few seconds (if needed)
|
||||||
|
# sleep 5
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Keep the script running to prevent the container from exiting
|
||||||
|
# tail -f /dev/null
|
||||||
|
|
||||||
Reference in New Issue
Block a user