ci: 배포 쉘스트립트 반영

PID 이름 변경
dev
Jonguk. Lim 5 months ago
parent 1572b780ed
commit 3142aa48f7

@ -8,7 +8,7 @@
> adds-api 서버 stop 및 backup > adds-api 서버 stop 및 backup
```shell ```shell
$ ./backupApi.sh adds-api $ ./backupApi.sh
``` ```
### 2. application upload ### 2. application upload
@ -24,7 +24,7 @@ $ ./backupApi.sh adds-api
> adds-api.jar 파일 업로드 > adds-api.jar 파일 업로드
```shell ```shell
$ ./deployApi.sh adds-api $ ./deployApi.sh
``` ```
### 4. application run ### 4. application run
@ -32,7 +32,7 @@ $ ./deployApi.sh adds-api
> adds-api 서버 start > adds-api 서버 start
```shell ```shell
$ ./startApi.sh adds-api $ ./startApi.sh
``` ```
### shell script 실행시 에러 조치 ### shell script 실행시 에러 조치

@ -1,22 +1,22 @@
#!/bin/sh #!/bin/sh
if [ $# -ne 1 ]; then #if [ $# -ne 1 ]; then
echo "-----------------------------------" # echo "-----------------------------------"
echo " Undefined parameter" # echo " Undefined parameter"
echo "./backupApi.sh [application name]" # echo "./backupApi.sh [application name]"
echo "-----------------------------------" # echo "-----------------------------------"
exit 1 # exit 1
fi #fi
#
if [ ! -f "../$1.jar" ]; then #if [ ! -f "../$1.jar" ]; then
echo "===================================" # echo "==================================="
echo " $1.jar file not exist" # echo " $1.jar file not exist"
echo "===================================" # echo "==================================="
exit 1 # exit 1
fi #fi
source /applications/adds/bin/stopApi.sh $1 source /applications/adds/bin/stopApi.sh
echo "-----------------------------------" echo "-----------------------------------"
echo " $1 application backup success!" echo " adds-api application backup success!"
echo "-----------------------------------" echo "-----------------------------------"
mv /applications/adds/$1.jar /applications/adds/$1.jar_backup mv /applications/adds/adds-api.jar /applications/adds/adds-api.jar_backup

@ -14,6 +14,5 @@ if [ ! -f "../$1.jar" ]; then
exit 1 exit 1
fi fi
source /applications/adds/bin/stopApi.sh $1
mv /applications/adds/$1.jar /applications/adds/$1.jar_backup mv /applications/adds/$1.jar /applications/adds/$1.jar_backup
cp /var/lib/jenkins/workspace/ADDS-API/adds-api/target/$1.jar /applications/adds/$1.jar cp /var/lib/jenkins/workspace/ADDS-API/adds-api/target/$1.jar /applications/adds/$1.jar

@ -1,23 +1,23 @@
#!/bin/sh #!/bin/sh
if [ $# -ne 1 ]; then #if [ $# -ne 1 ]; then
echo "-----------------------------------" # echo "-----------------------------------"
echo " Undefined parameter" # echo " Undefined parameter"
echo "./startApi.sh [application name]" # echo "./startApi.sh [application name]"
echo "-----------------------------------" # echo "-----------------------------------"
exit 1 # exit 1
fi #fi
#
if [ ! -f "../$1.jar" ]; then #if [ ! -f "../$1.jar" ]; then
echo "===================================" # echo "==================================="
echo " $1.jar file not exist" # echo " $1.jar file not exist"
echo "===================================" # echo "==================================="
exit 1 # exit 1
fi #fi
#
echo "================================" echo "================================"
echo " $1 application start" echo " adds-api application start"
echo "================================" echo "================================"
JAVA_HOME=/lib/jvm/jdk-17.0.2 JAVA_HOME=/lib/jvm/jdk-17.0.2
export JAVA_HOME export JAVA_HOME
nohup $JAVA_HOME/bin/java -Dspring.profiles.active=prod -jar /applications/adds/$1.jar > /dev/null & nohup $JAVA_HOME/bin/java -Dspring.profiles.active=prod -jar /applications/adds/adds-api.jar > /dev/null &

@ -1,22 +1,22 @@
#!/bin/sh #!/bin/sh
if [ $# -ne 1 ]; then #if [ $# -ne 1 ]; then
echo "-----------------------------------" # echo "-----------------------------------"
echo " Undefined parameter" # echo " Undefined parameter"
echo "./stopApi.sh [application name]" # echo "./stopApi.sh [application name]"
echo "-----------------------------------" # echo "-----------------------------------"
exit 1 # exit 1
fi #fi
PID=`ps -ef | grep java | grep $1 | awk '{print $2}'` PID=`ps -ef | grep java | grep adds-api | awk '{print $2}'`
echo "Process ID: $PID" echo "Process ID: $PID"
if [ -z $PID ]; then if [ -z $PID ]; then
echo "==============================" echo "=============================="
echo " No $1 deamon is running" echo " No adds-api deamon is running"
echo "==============================" echo "=============================="
else else
echo "Kill $1[$PID] process" echo "Kill adds-api[$PID] process"
kill $PID kill $PID
echo "===============================" echo "==============================="
echo " $1[$PID] application stop" echo " adds-api[$PID] application stop"
echo "===============================" echo "==============================="
fi fi

@ -37,7 +37,6 @@ import lombok.extern.slf4j.Slf4j;
TransactionConfig.class TransactionConfig.class
}) })
public class XitAddsApplication { public class XitAddsApplication {
static final List<String> basePackages = new ArrayList<>( static final List<String> basePackages = new ArrayList<>(
Arrays.asList("egovframework", "kr.xit") Arrays.asList("egovframework", "kr.xit")
); );
@ -70,7 +69,7 @@ public class XitAddsApplication {
//TODO : 이벤트 실행 시점이 Application context 실행 이전인 경우 리스너 추가 //TODO : 이벤트 실행 시점이 Application context 실행 이전인 경우 리스너 추가
//PID(Process ID 작성) //PID(Process ID 작성)
application.addListeners(new ApplicationPidFileWriter()) ; application.addListeners(new ApplicationPidFileWriter("adds-api.pid"));
application.run(args); application.run(args);
log.info("========================================================================================="); log.info("=========================================================================================");

Loading…
Cancel
Save