上传代码
This commit is contained in:
parent
5c730ef25a
commit
e121ebc791
88
Dockerfile
88
Dockerfile
@ -21,46 +21,62 @@ RUN go env -w GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
RUN go mod tidy
|
||||
|
||||
RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ezs_center ./servers/user
|
||||
RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ezs_event ./servers/event
|
||||
RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ezs_game ./servers/game
|
||||
RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ezs_gate ./servers/gate
|
||||
RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ecs_center ./servers/user
|
||||
RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ecs_event ./servers/event
|
||||
RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ecs_game ./servers/game
|
||||
RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ecs_gate ./servers/gate
|
||||
|
||||
|
||||
# Target user
|
||||
FROM alpine:latest AS ezs_user
|
||||
# Target ecs
|
||||
FROM alpine:latest AS ecs
|
||||
WORKDIR /app/ecs
|
||||
|
||||
WORKDIR /app/ecs/user
|
||||
COPY --from=builder /projects/go/ecs/app.sh app.sh
|
||||
|
||||
COPY --from=builder /projects/go/ecs/build/bin/ezs_user ./bin/ezs_user
|
||||
RUN chmod +x ./app.sh
|
||||
|
||||
CMD ./bin/ezs_user -help
|
||||
COPY --from=builder /projects/go/ecs/build/bin/ecs_user user/bin/ecs_user
|
||||
COPY --from=builder /projects/go/ecs/build/bin/ecs_event event/bin/ecs_event
|
||||
COPY --from=builder /projects/go/ecs/build/bin/ecs_game game/bin/ecs_game
|
||||
COPY --from=builder /projects/go/ecs/build/bin/ecs_gate gate/bin/ecs_gate
|
||||
|
||||
CMD ./app.sh help
|
||||
|
||||
|
||||
# Target event
|
||||
FROM alpine:latest AS ezs_event
|
||||
|
||||
WORKDIR /app/ecs/event
|
||||
|
||||
COPY --from=builder /projects/go/ecs/build/bin/ezs_event ./bin/ezs_event
|
||||
|
||||
CMD ./bin/ezs_event -help
|
||||
|
||||
|
||||
# Target game
|
||||
FROM alpine:latest AS ezs_game
|
||||
|
||||
WORKDIR /app/ecs/game
|
||||
|
||||
COPY --from=builder /projects/go/ecs/build/bin/ezs_game ./bin/ezs_game
|
||||
|
||||
CMD ./bin/ezs_game -help
|
||||
|
||||
# Target gate
|
||||
FROM alpine:latest AS ezs_gate
|
||||
|
||||
WORKDIR /app/ecs/gate
|
||||
|
||||
COPY --from=builder /projects/go/ecs/build/bin/ezs_gate ./bin/ezs_gate
|
||||
|
||||
CMD ./bin/ezs_gate -help
|
||||
## Target user
|
||||
#FROM alpine:latest AS ecs_user
|
||||
#
|
||||
#WORKDIR /app/ecs/user
|
||||
#
|
||||
#COPY --from=builder /projects/go/ecs/build/bin/ecs_user ./bin/ecs_user
|
||||
#
|
||||
#CMD ./bin/ecs_user -help
|
||||
#
|
||||
#
|
||||
## Target event
|
||||
#FROM alpine:latest AS ezs_event
|
||||
#
|
||||
#WORKDIR /app/ecs/event
|
||||
#
|
||||
#COPY --from=builder /projects/go/ecs/build/bin/ezs_event ./bin/ezs_event
|
||||
#
|
||||
#CMD ./bin/ezs_event -help
|
||||
#
|
||||
#
|
||||
## Target game
|
||||
#FROM alpine:latest AS ezs_game
|
||||
#
|
||||
#WORKDIR /app/ecs/game
|
||||
#
|
||||
#COPY --from=builder /projects/go/ecs/build/bin/ezs_game ./bin/ezs_game
|
||||
#
|
||||
#CMD ./bin/ezs_game -help
|
||||
#
|
||||
## Target gate
|
||||
#FROM alpine:latest AS ezs_gate
|
||||
#
|
||||
#WORKDIR /app/ecs/gate
|
||||
#
|
||||
#COPY --from=builder /projects/go/ecs/build/bin/ezs_gate ./bin/ezs_gate
|
||||
#
|
||||
#CMD ./bin/ezs_gate -help
|
||||
|
30
app.sh
30
app.sh
@ -1,10 +1,14 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if [[ $# != 3 ]]; then
|
||||
usage() {
|
||||
echo "Usage: app.sh \${command} \${server} \${id}"
|
||||
echo " command: start/stop/restart"
|
||||
echo " server: the name of the server"
|
||||
echo " id: the number greater than zero of the server id"
|
||||
}
|
||||
|
||||
if [[ $# != 3 ]]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -12,37 +16,39 @@ CMD=$1
|
||||
SVR=$2
|
||||
SID=$3
|
||||
|
||||
cd ${SVR}_${SID}
|
||||
|
||||
start_server() {
|
||||
pid=`ps -ef | grep ezs_${SVR} | grep ${SVR}_${SID}.json | awk '{print $2}'`
|
||||
cd ${SVR}
|
||||
|
||||
pid=`ps -ef | grep ecs_${SVR} | grep ${SVR}_${SID}.json | awk '{print $2}'`
|
||||
|
||||
if [ ! -z ${pid} ]; then
|
||||
echo "The server '${SVR}' with id:${SID} is running."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -x ./bin/ezs_${SVR} ]; then
|
||||
chmod +x ./bin/ezs_${SVR}
|
||||
if [ ! -x ./bin/ecs_${SVR} ]; then
|
||||
chmod +x ./bin/ecs_${SVR}
|
||||
fi
|
||||
|
||||
nohup ./bin/ezs_${SVR} -conf ./conf/${SVR}_${SID}.json > ./ezs_${SVR}_${SID}.out 2>&1 &
|
||||
nohup ./bin/ecs_${SVR} -conf ./conf/${SVR}_${SID}.json > ./ecs_${SVR}_${SID}.out 2>&1 &
|
||||
|
||||
sleep 2
|
||||
|
||||
pid=`ps -ef | grep ezs_${SVR} | grep ${SVR}_${SID}.json | awk '{print $2}'`
|
||||
pid=`ps -ef | grep ecs_${SVR} | grep ${SVR}_${SID}.json | awk '{print $2}'`
|
||||
|
||||
if [ -z ${pid} ]; then
|
||||
echo "The server '${SVR}' with id:${SID} start failed."
|
||||
tail -n30 ./bin/ezs_${SVR}_${SID}.out
|
||||
tail -n30 ./bin/ecs_${SVR}_${SID}.out
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "The server '${SVR}' with id:${SID} was started, pid: ${pid}"
|
||||
|
||||
cd ..
|
||||
}
|
||||
|
||||
stop_server() {
|
||||
pid=`ps -ef | grep ezs_${SVR} | grep ${SVR}_${SID}.json | awk '{print $2}'`
|
||||
pid=`ps -ef | grep ecs_${SVR} | grep ${SVR}_${SID}.json | awk '{print $2}'`
|
||||
|
||||
if [ ! -z ${pid} ]; then
|
||||
kill ${pid}
|
||||
@ -67,6 +73,10 @@ case ${CMD} in
|
||||
start_server
|
||||
exit 0
|
||||
;;
|
||||
help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command: ${CMD}"
|
||||
exit 1
|
||||
|
@ -21,8 +21,8 @@ SET /P VERSION=<./build.version
|
||||
SET /A VERSION+=1
|
||||
|
||||
FOR %%i IN (user event game gate) DO (
|
||||
ECHO go build -ldflags "-X 'github.com/oylshe1314/framework/server.buildVersion=%VERSION%' -X 'framework/profile.Active=test'" -o %OUT_DIR%/%%i_1/bin/ezs_%%i ./servers/%%i
|
||||
go build -ldflags "-X 'github.com/oylshe1314/framework/server.buildVersion=%VERSION%' -X 'framework/profile.Active=test'" -o %OUT_DIR%/%%i_1/bin/ezs_%%i ./servers/%%i
|
||||
ECHO go build -ldflags "-X 'github.com/oylshe1314/framework/server.buildVersion=%VERSION%' -X 'framework/profile.Active=test'" -o %OUT_DIR%/%%i_1/bin/ecs_%%i ./servers/%%i
|
||||
go build -ldflags "-X 'github.com/oylshe1314/framework/server.buildVersion=%VERSION%' -X 'framework/profile.Active=test'" -o %OUT_DIR%/%%i_1/bin/ecs_%%i ./servers/%%i
|
||||
)
|
||||
|
||||
IF %ERRORLEVEL% EQU 0 ECHO %VERSION% 1>./build.version
|
@ -12,7 +12,7 @@
|
||||
},
|
||||
"mongoClient": {
|
||||
"address": "mongodb://127.0.0.1:27017",
|
||||
"database": "ezs_event_dev_1"
|
||||
"database": "ecs_event_dev_1"
|
||||
},
|
||||
"sdConfig": {
|
||||
"servers": [
|
||||
|
@ -26,7 +26,7 @@
|
||||
},
|
||||
"mongoClient": {
|
||||
"address": "mongodb://127.0.0.1:27017",
|
||||
"database": "ezs_game_dev_1"
|
||||
"database": "ecs_game_dev_1"
|
||||
},
|
||||
"sdConfig": {
|
||||
"servers": [
|
||||
|
@ -17,7 +17,7 @@
|
||||
},
|
||||
"mongoClient": {
|
||||
"address": "mongodb://127.0.0.1:27017",
|
||||
"database": "ezs_gate_dev_1"
|
||||
"database": "ecs_gate_dev_1"
|
||||
},
|
||||
"sdConfig": {
|
||||
"servers": [
|
||||
|
@ -12,7 +12,7 @@
|
||||
},
|
||||
"mongoClient": {
|
||||
"address": "mongodb://127.0.0.1:27017",
|
||||
"database": "ezs_user_dev_1"
|
||||
"database": "ecs_user_dev_1"
|
||||
},
|
||||
"sdConfig": {
|
||||
"servers": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user