Skip to content

Commit

Permalink
Merge pull request #1252 from wangyu096/feature/rolling
Browse files Browse the repository at this point in the history
bugfix: 容器环境,停止微服务没有触发shutdown hook #1251
  • Loading branch information
jsonwan authored Sep 5, 2022
2 parents 5acc165 + 057d46e commit 64338a5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ spec:
- name: job-gse-tls-password
mountPath: /etc/secrets
readOnly: true
terminationGracePeriodSeconds: 120
volumes:
- name: job-storage
persistentVolumeClaim:
Expand Down
7 changes: 5 additions & 2 deletions support-files/kubernetes/images/backend/backend.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ ENV BK_JOB_HOME=/data/job/exec
COPY ./ /data/job/exec/
RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo 'Asia/Shanghai' > /etc/timezone && \
chmod +x /data/job/exec/startup.sh
chmod +x /data/job/exec/startup.sh && \
chmod +x /data/job/exec/tini


ENV LANG en_US.utf8
ENV LANGUAGE en_US.utf8
ENV LC_ALL en_US.utf8

WORKDIR /data/job/exec
CMD /data/job/exec/startup.sh

ENTRYPOINT ["./tini", "--", "/data/job/exec/startup.sh"]
5 changes: 3 additions & 2 deletions support-files/kubernetes/images/backend/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if [[ "$OTEL_TRACE_ENABLED" == "true" ]];then
fi
fi

java -server \
exec java -server \
$OTEL_OPTS \
-Dfile.encoding=UTF-8 \
-Djob.log.dir=$BK_JOB_LOG_BASE_DIR \
Expand All @@ -69,4 +69,5 @@ java -server \
-XX:ErrorFile=$BK_JOB_LOG_DIR/error_sys.log \
-Dspring.profiles.active=$BK_JOB_PROFILE \
$BK_JOB_JVM_OPTION \
-jar /data/job/exec/$BK_JOB_JAR
-jar /data/job/exec/$BK_JOB_JAR \
"$@"
Binary file added support-files/kubernetes/images/backend/tini
Binary file not shown.
2 changes: 1 addition & 1 deletion support-files/kubernetes/images/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ build_backend_module () {
rm -rf tmp/*
cp $BACKEND_DIR/release/$SERVICE-$VERSION.jar tmp/$SERVICE.jar
cp $SUPPORT_FILES_DIR/javaagent/opentelemetry-javaagent.jar tmp/
cp backend/startup.sh tmp/
cp backend/startup.sh backend/tini tmp/
docker build -f backend/backend.Dockerfile -t $REGISTRY/$SERVICE:$VERSION tmp --network=host
if [[ $PUSH -eq 1 ]] ; then
docker push $REGISTRY/$SERVICE:$VERSION
Expand Down

0 comments on commit 64338a5

Please sign in to comment.