Skip to content

Commit

Permalink
feat: init data first & update docker-compose.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
1995chen committed Mar 27, 2024
1 parent 72e5f35 commit 9ae97f4
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 84 deletions.
18 changes: 1 addition & 17 deletions Kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,10 @@ spec:
medium: Memory
sizeLimit: 8Gi
initContainers:
- name: init-data
env:
- name: TZ
value: "Asia/Shanghai"
image: 1995chen/dnf:centos7-2.0.2
imagePullPolicy: IfNotPresent
command: ["/bin/bash"]
args: ["/home/template/init/init.sh"]
volumeMounts:
- mountPath: /data
name: dnf
subPath: data
- mountPath: /var/lib/mysql
name: dnf
subPath: mysql
containers:
- name: dnf
imagePullPolicy: IfNotPresent
image: 1995chen/dnf:centos7-2.0.2
image: 1995chen/dnf:centos5-2.1.2
ports:
- name: mysql
containerPort: 3306
Expand Down
15 changes: 2 additions & 13 deletions build/Centos5-DNF/dnf.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
[program:init]
command=/bin/bash -c "/home/template/init/init.sh"
directory=/root
user=root
autostart=true
autorestart=false
stopasgroup=true
killasgroup=true

[program:gate]
command=/bin/bash -c "./DnfGateServer > gate.log"
directory=/root
Expand All @@ -15,7 +6,6 @@ autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
depend=init

[program:stun]
command=/bin/bash -c "killall -9 df_stun_r;rm -rf pid/*.pid && ./df_stun_r start && sleep 2 && cat pid/*.pid |xargs -n1 -I{} tail --pid={} -f /dev/null"
Expand All @@ -25,7 +15,6 @@ autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
depend=init

[program:monitor]
command=/bin/bash -c "killall -9 df_monitor_r;rm -rf pid/*.pid && ./df_monitor_r mnt_siroco start && sleep 2 && cat pid/*.pid |xargs -n1 -I{} tail --pid={} -f /dev/null"
Expand All @@ -36,7 +25,7 @@ autorestart=true
stopasgroup=true
killasgroup=true
environment=LD_PRELOAD=/lib/libhook.so
depend=init
depend=stun

[program:manager]
command=/bin/bash -c "killall -9 df_manager_r;rm -rf pid/*.pid && ./df_manager_r manager start && sleep 2 && cat pid/*.pid |xargs -n1 -I{} tail --pid={} -f /dev/null"
Expand Down Expand Up @@ -230,5 +219,5 @@ environment=LD_PRELOAD=/lib/libhook.so
depend=game_siroco11

[group:dnf]
programs=init,gate,stun,monitor,manager,relay,bridge,channel,dbmw_guild,dbmw_mnt,dbmw_stat,auction,point,guild,statics,coserver,community,gunnersvr,zergsvr_secagent,zergsvr,game_siroco11,game_siroco52
programs=gate,stun,monitor,manager,relay,bridge,channel,dbmw_guild,dbmw_mnt,dbmw_stat,auction,point,guild,statics,coserver,community,gunnersvr,zergsvr_secagent,zergsvr,game_siroco11,game_siroco52
priority=999
4 changes: 3 additions & 1 deletion build/Centos5-DNF/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 初始化数据
./home/template/init/init.sh
# 删除无用文件
rm -rf /home/template/neople-tmp
rm -rf /home/template/root-tmp
Expand Down Expand Up @@ -34,7 +36,7 @@ find /home/template/neople-tmp -type f -name "*.cfg" -print0 | xargs -0 sed -i "
find /home/template/neople-tmp -type f -name "*.cfg" -print0 | xargs -0 sed -i "s/DEC_GAME_PWD/$DEC_GAME_PWD/g"
find /home/template/neople-tmp -type f -name "*.cfg" -print0 | xargs -0 sed -i "s/PUBLIC_IP/$PUBLIC_IP/g"
find /home/template/neople-tmp -type f -name "*.tbl" -print0 | xargs -0 sed -i "s/PUBLIC_IP/$PUBLIC_IP/g"
# 将结果文件拷贝到对应目录[这里是为了保住日志文件目录,将日志文件挂载到宿主机外,因此采用覆盖而不是mv]
# 将结果文件拷贝到对应目录[这里是为了保住日志文件目录,将日志文件挂载到宿主机外,因此采用复制而不是mv]
cp -rf /home/template/neople-tmp/* /home/neople
rm -rf /home/template/neople-tmp
# 复制版本文件
Expand Down
15 changes: 2 additions & 13 deletions build/Centos6-DNF/dnf.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
[program:init]
command=/bin/bash -c "/home/template/init/init.sh"
directory=/root
user=root
autostart=true
autorestart=false
stopasgroup=true
killasgroup=true

[program:gate]
command=/bin/bash -c "./DnfGateServer > gate.log"
directory=/root
Expand All @@ -15,7 +6,6 @@ autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
depend=init

[program:stun]
command=/bin/bash -c "killall -9 df_stun_r;rm -rf pid/*.pid && ./df_stun_r start && sleep 2 && cat pid/*.pid |xargs -n1 -I{} tail --pid={} -f /dev/null"
Expand All @@ -25,7 +15,6 @@ autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
depend=init

[program:monitor]
command=/bin/bash -c "killall -9 df_monitor_r;rm -rf pid/*.pid && ./df_monitor_r mnt_siroco start && sleep 2 && cat pid/*.pid |xargs -n1 -I{} tail --pid={} -f /dev/null"
Expand All @@ -36,7 +25,7 @@ autorestart=true
stopasgroup=true
killasgroup=true
environment=LD_PRELOAD=/lib/libhook.so
depend=init
depend=stun

[program:manager]
command=/bin/bash -c "killall -9 df_manager_r;rm -rf pid/*.pid && ./df_manager_r manager start && sleep 2 && cat pid/*.pid |xargs -n1 -I{} tail --pid={} -f /dev/null"
Expand Down Expand Up @@ -230,5 +219,5 @@ environment=LD_PRELOAD=/lib/libhook.so
depend=game_siroco11

[group:dnf]
programs=init,gate,stun,monitor,manager,relay,bridge,channel,dbmw_guild,dbmw_mnt,dbmw_stat,auction,point,guild,statics,coserver,community,gunnersvr,zergsvr_secagent,zergsvr,game_siroco11,game_siroco52
programs=gate,stun,monitor,manager,relay,bridge,channel,dbmw_guild,dbmw_mnt,dbmw_stat,auction,point,guild,statics,coserver,community,gunnersvr,zergsvr_secagent,zergsvr,game_siroco11,game_siroco52
priority=999
4 changes: 3 additions & 1 deletion build/Centos6-DNF/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 初始化数据
./home/template/init/init.sh
# 删除无用文件
rm -rf /home/template/neople-tmp
rm -rf /home/template/root-tmp
Expand Down Expand Up @@ -34,7 +36,7 @@ find /home/template/neople-tmp -type f -name "*.cfg" -print0 | xargs -0 sed -i "
find /home/template/neople-tmp -type f -name "*.cfg" -print0 | xargs -0 sed -i "s/DEC_GAME_PWD/$DEC_GAME_PWD/g"
find /home/template/neople-tmp -type f -name "*.cfg" -print0 | xargs -0 sed -i "s/PUBLIC_IP/$PUBLIC_IP/g"
find /home/template/neople-tmp -type f -name "*.tbl" -print0 | xargs -0 sed -i "s/PUBLIC_IP/$PUBLIC_IP/g"
# 将结果文件拷贝到对应目录[这里是为了保住日志文件目录,将日志文件挂载到宿主机外,因此采用覆盖而不是mv]
# 将结果文件拷贝到对应目录[这里是为了保住日志文件目录,将日志文件挂载到宿主机外,因此采用复制而不是mv]
cp -rf /home/template/neople-tmp/* /home/neople
rm -rf /home/template/neople-tmp
# 复制版本文件
Expand Down
15 changes: 2 additions & 13 deletions build/Centos7-DNF/dnf.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
[program:init]
command=/bin/bash -c "/home/template/init/init.sh"
directory=/root
user=root
autostart=true
autorestart=false
stopasgroup=true
killasgroup=true

[program:gate]
command=/bin/bash -c "./DnfGateServer > gate.log"
directory=/root
Expand All @@ -15,7 +6,6 @@ autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
depend=init

[program:stun]
command=/bin/bash -c "killall -9 df_stun_r;rm -rf pid/*.pid && ./df_stun_r start && sleep 2 && cat pid/*.pid |xargs -n1 -I{} tail --pid={} -f /dev/null"
Expand All @@ -25,7 +15,6 @@ autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
depend=init

[program:monitor]
command=/bin/bash -c "killall -9 df_monitor_r;rm -rf pid/*.pid && ./df_monitor_r mnt_siroco start && sleep 2 && cat pid/*.pid |xargs -n1 -I{} tail --pid={} -f /dev/null"
Expand All @@ -36,7 +25,7 @@ autorestart=true
stopasgroup=true
killasgroup=true
environment=LD_PRELOAD=/lib/libhook.so
depend=init
depend=stun

[program:manager]
command=/bin/bash -c "killall -9 df_manager_r;rm -rf pid/*.pid && ./df_manager_r manager start && sleep 2 && cat pid/*.pid |xargs -n1 -I{} tail --pid={} -f /dev/null"
Expand Down Expand Up @@ -230,5 +219,5 @@ environment=LD_PRELOAD=/lib/libhook.so
depend=game_siroco11

[group:dnf]
programs=init,gate,stun,monitor,manager,relay,bridge,channel,dbmw_guild,dbmw_mnt,dbmw_stat,auction,point,guild,statics,coserver,community,gunnersvr,zergsvr_secagent,zergsvr,game_siroco11,game_siroco52
programs=gate,stun,monitor,manager,relay,bridge,channel,dbmw_guild,dbmw_mnt,dbmw_stat,auction,point,guild,statics,coserver,community,gunnersvr,zergsvr_secagent,zergsvr,game_siroco11,game_siroco52
priority=999
4 changes: 3 additions & 1 deletion build/Centos7-DNF/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 初始化数据
./home/template/init/init.sh
# 删除无用文件
rm -rf /home/template/neople-tmp
rm -rf /home/template/root-tmp
Expand Down Expand Up @@ -34,7 +36,7 @@ find /home/template/neople-tmp -type f -name "*.cfg" -print0 | xargs -0 sed -i "
find /home/template/neople-tmp -type f -name "*.cfg" -print0 | xargs -0 sed -i "s/DEC_GAME_PWD/$DEC_GAME_PWD/g"
find /home/template/neople-tmp -type f -name "*.cfg" -print0 | xargs -0 sed -i "s/PUBLIC_IP/$PUBLIC_IP/g"
find /home/template/neople-tmp -type f -name "*.tbl" -print0 | xargs -0 sed -i "s/PUBLIC_IP/$PUBLIC_IP/g"
# 将结果文件拷贝到对应目录[这里是为了保住日志文件目录,将日志文件挂载到宿主机外,因此采用覆盖而不是mv]
# 将结果文件拷贝到对应目录[这里是为了保住日志文件目录,将日志文件挂载到宿主机外,因此采用复制而不是mv]
cp -rf /home/template/neople-tmp/* /home/neople
rm -rf /home/template/neople-tmp
# 复制版本文件
Expand Down
29 changes: 4 additions & 25 deletions deploy/dnf/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
version: "2.3"

networks:
local:
ipam:
config:
- subnet: 172.20.0.0/16

services:
init-dnf:
image: 1995chen/dnf:centos6-2.0.2
environment:
- TZ=Asia/Shanghai
command: ['/bin/bash', '/home/template/init/init.sh']
networks:
- local
restart: "no"
volumes:
- ./data:/data
- ./mysql:/var/lib/mysql

dnf:
image: 1995chen/dnf:centos6-2.0.2
depends_on:
- init-dnf
image: 1995chen/dnf:centos5-2.1.2
environment:
- TZ=Asia/Shanghai
# 这里填写你的IP地址
Expand All @@ -35,12 +17,9 @@ services:
shm_size: 8g
memswap_limit: -1
mem_limit: 1g
# windows下生效
cpu_count: 1
# 占用1个cpu
cpus: 1.0
networks:
- local
# cpus: 1.0
restart: always
ports:
- 3000:3306/tcp # mysql 数据库
Expand Down Expand Up @@ -76,4 +55,4 @@ services:
volumes:
- ./data:/data
- ./mysql:/var/lib/mysql
- ./log:/home/neople/game/log
- ./log:/home/neople/game/log

0 comments on commit 9ae97f4

Please sign in to comment.