Skip to content

Commit

Permalink
fix start.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Dec 11, 2024
1 parent 3a1d0b9 commit 7a61a59
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docker-files/site/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ COPY --from=builder /WeDPR/wedpr-site/dist/ /data/home/wedpr/wedpr-site
# copy the web package
COPY --from=web_builder /WeDPR/wedpr-web/dist /data/home/wedpr/wedpr-site/web

ENTRYPOINT ["/bin/bash", "/data/home/wedpr/wedpr-site/start.sh", "true", "&&", "/usr/sbin/nginx"]
ENTRYPOINT ["/usr/sbin/nginx","&&", "/bin/bash", "/data/home/wedpr/wedpr-site/start.sh", "true"]
3 changes: 2 additions & 1 deletion wedpr-builder/wedpr_builder/config/wedpr_deploy_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ def to_nginx_properties(self, nginx_listen_port):
def to_properties(self, deploy_ip, node_index: int) -> {}:
props = {}
server_start_port = self.server_start_port + 3 * node_index
self.server_backend_list.append(f"{deploy_ip}:{server_start_port}")
self.server_backend_list.append(
f"server {deploy_ip}:{server_start_port}")
# nodeid
node_id = f"{self.service_type}-{self.env_config.zone}-node{node_index}"
props.update({constant.ConfigProperities.WEDPR_NODE_ID: node_id})
Expand Down
4 changes: 1 addition & 3 deletions wedpr-builder/wedpr_builder/tpl/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,4 @@ server {
error_log /var/log/nginx/error.log;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

daemon off;
}
17 changes: 14 additions & 3 deletions wedpr-pir/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ STATUS_STARTING="Starting"
STATUS_RUNNING="Running"
STATUS_STOPPED="Stopped"
start_success_log="start.*success"
ENABLE_DOCKER_MODE="false"

start_log="start.out"
if [ "$ENABLE_DOCKER_MODE" = "true" ]; then
start_log="logs/start.out"
fi


JAVA_CMD=$JAVA_HOME/bin/java
if [ ! -f "${JAVA_HOME}" ];then
Expand Down Expand Up @@ -46,13 +53,17 @@ JAVA_OPTS+=" -DserviceConfigPath=${CONFIG_PATH}"

run_app()
{
nohup $JAVA_CMD $JAVA_OPTS -cp $CLASSPATH $APP_MAIN > start.out 2>&1 &
if [ "$ENABLE_DOCKER_MODE" = "true" ]; then
exec ${JAVA_CMD} $JAVA_OPTS -cp $CLASSPATH $APP_MAIN > ${start_log} 2>&1
else
nohup $JAVA_CMD $JAVA_OPTS -cp $CLASSPATH $APP_MAIN > ${start_log} 2>&1 &
fi
}

app_status()
{
if [ ! -z "$(app_pid)" ]; then
if [ ! -z "$(grep -i "${start_success_log}" start.out)" ]; then
if [ ! -z "$(grep -i "${start_success_log}" ${start_log})" ]; then
echo ${STATUS_RUNNING}
else
echo ${STATUS_STARTING}
Expand Down Expand Up @@ -84,7 +95,7 @@ before_start()
}

start(){
rm -f start.out
rm -f ${start_log}
run_app
LOG_INFO "${APP_MAIN} booting up .."
try_times=45
Expand Down
16 changes: 13 additions & 3 deletions wedpr-site/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ STATUS_STARTING="Starting"
STATUS_RUNNING="Running"
STATUS_STOPPED="Stopped"
start_success_log="start.*success"
ENABLE_DOCKER_MODE="false"

start_log="start.out"
if [ "$ENABLE_DOCKER_MODE" = "true" ]; then
start_log="logs/start.out"
fi


JAVA_CMD=$JAVA_HOME/bin/java
Expand Down Expand Up @@ -44,13 +50,17 @@ JAVA_OPTS+=" -DserviceName=${SERVER_NAME}"
JAVA_OPTS+=" -DserviceConfigPath=${CONFIG_PATH}"
run_app()
{
nohup ${JAVA_CMD} $JAVA_OPTS -cp $CLASSPATH $APP_MAIN > start.out 2>&1 &
if [ "$ENABLE_DOCKER_MODE" = "true" ]; then
exec ${JAVA_CMD} $JAVA_OPTS -cp $CLASSPATH $APP_MAIN > ${start_log} 2>&1
else
nohup ${JAVA_CMD} $JAVA_OPTS -cp $CLASSPATH $APP_MAIN > ${start_log} 2>&1 &
fi
}

app_status()
{
if [ ! -z "$(app_pid)" ]; then
if [ ! -z "$(grep -i "${start_success_log}" start.out)" ]; then
if [ ! -z "$(grep -i "${start_success_log}" ${start_log})" ]; then
echo ${STATUS_RUNNING}
else
echo ${STATUS_STARTING}
Expand Down Expand Up @@ -82,7 +92,7 @@ before_start()
}

start(){
rm -f start.out
rm -f ${start_log}
run_app
LOG_INFO "${APP_MAIN} booting up .."
try_times=45
Expand Down
17 changes: 9 additions & 8 deletions wedpr-worker/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ STATUS_STOPPED="Stopped"
start_success_log="start.*success"
ENABLE_DOCKER_MODE="false"

#if [ "${JAVA_HOME}" = "" ];then
# JAVA_HOME=/nemo/jdk8u382-b05
# echo "JAVA_HOME has not been configured, set to default: ${JAVA_HOME}"
#fi
start_log="start.out"
if [ "$ENABLE_DOCKER_MODE" = "true" ]; then
start_log="logs/start.out"
fi


JAVA_CMD=$JAVA_HOME/bin/java
if [ ! -f "${JAVA_HOME}" ];then
Expand Down Expand Up @@ -51,16 +52,16 @@ JAVA_OPTS+=" -DserviceConfigPath=${CONFIG_PATH}"
run_app()
{
if [ "$ENABLE_DOCKER_MODE" = "true" ]; then
exec ${JAVA_CMD} $JAVA_OPTS -cp $CLASSPATH $APP_MAIN > start.out 2>&1
exec ${JAVA_CMD} $JAVA_OPTS -cp $CLASSPATH $APP_MAIN > ${start_log} 2>&1
else
nohup ${JAVA_CMD} $JAVA_OPTS -cp $CLASSPATH $APP_MAIN > start.out 2>&1 &
nohup ${JAVA_CMD} $JAVA_OPTS -cp $CLASSPATH $APP_MAIN > ${start_log} 2>&1 &
fi
}

app_status()
{
if [ ! -z "$(app_pid)" ]; then
if [ ! -z "$(grep -i "${start_success_log}" start.out)" ]; then
if [ ! -z "$(grep -i "${start_success_log}" ${start_log})" ]; then
echo ${STATUS_RUNNING}
else
echo ${STATUS_STARTING}
Expand Down Expand Up @@ -92,7 +93,7 @@ before_start()
}

start(){
rm -f start.out
rm -f ${start_log}
run_app
LOG_INFO "${APP_MAIN} booting up .."
try_times=45
Expand Down

0 comments on commit 7a61a59

Please sign in to comment.