Add containerization and make this bad boy work on Windows and MacOS

This commit is contained in:
omer
2024-02-28 19:08:07 -06:00
parent d58a0543eb
commit df7a63e047
557 changed files with 6647 additions and 5493 deletions
+24 -8
View File
@@ -1,23 +1,39 @@
#!/bin/sh
CMD="docker exec -it hearthmod"
case $1 in
bucket_create)
/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
$CMD /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 ~/hm_database/ http://localhost:8091/ --bucket-source=hbs
$CMD /opt/couchbase/bin/cbrestore /app/hm_database/hbs http://localhost:8091/ --bucket-source=hbs
;;
compile)
make -C ~/hm_gameserver
make -C ~/hm_lobbyserver
$CMD /bin/bash -c 'cd /app/hm_stud && make && rm -rf cert/test* && cd cert && sh gen_cert.sh'
$CMD make -C /app/hm_gameserver
$CMD make -C /app/hm_lobbyserver
$CMD /bin/bash -c 'cd /app/hm_nginx && sed "s@\/usr\/local\/web@$(pwd)\/..\/hm_web\/@" conf/hm_nginx.conf > conf/nginx.conf && ./configure && make && make install'
$CMD /bin/bash -c 'cd /app/hm_sunwell/examples && npm install'
;;
build_client)
$CMD /bin/bash -c 'cd /app/hm_client/src && qmake hearthmod.pro && make'
;;
start)
mkdir -p ~/hm_log
valgrind --log-file=/root/hm_log/hm_gameserver_valgrind_$(date +%s) --trace-children=yes ~/hm_gameserver/hm_gameserver --log=/root/hm_log/hm_gameserver_$(date +%s)
valgrind --log-file=/root/hm_log/hm_lobbyserver_valgrind_$(date +%s) --trace-children=yes ~/hm_lobbyserver/hm_lobbyserver --log=/root/hm_log/hm_lobbyserver_$(date +%s)
$CMD mkdir -p /app/hm_log
# Start the servers
$CMD /app/hm_gameserver/hm_gameserver --log=/app/hm_log/hm_gameserver_$(date +%s)
$CMD /app/hm_lobbyserver/hm_lobbyserver --gameserver=127.0.0.1 --log=/app/hm_log/hm_lobbyserver_$(date +%s)
# Start stud
$CMD /app/hm_stud/stud /app/hm_stud/cert/test.com.pem
# Start fcgi
$CMD spawn-fcgi -d /app/hm_web/ -f /app/hm_web/app.py -a 127.0.0.1 -p 9002
# Start nginx
$CMD /app/hm_nginx/objs/nginx
;;
stop)
ps -ef | grep hm_ | grep -v grep | awk '{print $2}' | xargs kill -9
$CMD ps -ef | grep hm_ | grep -v grep | awk '{print $2}' | xargs kill -9
$CMD ps -ef | grep nginx | grep -v grep | awk '{print $2}' | xargs sudo kill -9
;;
*)
echo "Usage: ctl.sh {bucket_create|bucket_restore|compile|start|stop}" >&2