eapim-portal CI 워크플로 및 JNDI 전환
- gitea actions self-hosted runner 워크플로 - EMS/Gateway 데이터소스 JNDI 적용 및 보강 - 부팅/로깅 경로 /prod/eapim, /logs/eapim 으로 정리
This commit is contained in:
@@ -0,0 +1,130 @@
|
|||||||
|
name: eapim-portal CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- feats/ci-test
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: [self-hosted, linux, eapim-portal]
|
||||||
|
env:
|
||||||
|
JAVA_HOME: /apps/opts/jdk8
|
||||||
|
JAVA_HOME_TOMCAT: /apps/opts/jdk17
|
||||||
|
CATALINA_BASE: /prod/eapim/devportal
|
||||||
|
CATALINA_HOME: /prod/eapim/apache-tomcat-9.0.116
|
||||||
|
CATALINA_PID: /prod/eapim/devportal/temp/catalina.pid
|
||||||
|
DEPLOY_HTTP_PORT: "39130"
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: eapim-portal
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout eapim-portal (trigger SHA)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
path: eapim-portal
|
||||||
|
|
||||||
|
- name: Checkout elink-portal-common (master)
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
|
run: |
|
||||||
|
rm -rf elink-portal-common
|
||||||
|
git clone --depth=1 --branch master \
|
||||||
|
http://oauth2:${{ secrets.CI_TOKEN }}@172.30.1.50:3000/djb-eapim/elink-portal-common.git \
|
||||||
|
elink-portal-common
|
||||||
|
|
||||||
|
- name: Checkout elink-online-core-jpa (master)
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
|
run: |
|
||||||
|
mkdir -p eapim-online
|
||||||
|
rm -rf eapim-online/elink-online-core-jpa
|
||||||
|
git clone --depth=1 --branch master \
|
||||||
|
http://oauth2:${{ secrets.CI_TOKEN }}@172.30.1.50:3000/djb-eapim/elink-online-core-jpa.git \
|
||||||
|
eapim-online/elink-online-core-jpa
|
||||||
|
|
||||||
|
- name: Verify toolchain
|
||||||
|
run: |
|
||||||
|
java -version
|
||||||
|
gradle --version
|
||||||
|
|
||||||
|
- name: Gradle build (no tests)
|
||||||
|
run: gradle clean build -x test --no-daemon
|
||||||
|
|
||||||
|
- name: Upload WAR artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: eapim-portal-wars-${{ github.sha }}
|
||||||
|
path: |
|
||||||
|
eapim-portal/build/libs/eapim-portal.war
|
||||||
|
eapim-portal/build/libs/eapim-portal-boot.war
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Stop tomcat (pre-clean)
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
|
run: |
|
||||||
|
if [ -f "$CATALINA_PID" ] && kill -0 "$(cat $CATALINA_PID)" 2>/dev/null; then
|
||||||
|
JAVA_HOME=$JAVA_HOME_TOMCAT "$CATALINA_HOME/bin/shutdown.sh" 30 -force || true
|
||||||
|
for i in $(seq 1 30); do
|
||||||
|
[ -f "$CATALINA_PID" ] && kill -0 "$(cat $CATALINA_PID)" 2>/dev/null || break
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
rm -f "$CATALINA_PID"
|
||||||
|
|
||||||
|
- name: Deploy war as ROOT
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
|
run: |
|
||||||
|
DEPLOY_DIR="$CATALINA_BASE/webapps"
|
||||||
|
rm -rf "$DEPLOY_DIR/ROOT" "$DEPLOY_DIR/ROOT.war"
|
||||||
|
cp eapim-portal/build/libs/eapim-portal.war "$DEPLOY_DIR/ROOT.war"
|
||||||
|
ls -la "$DEPLOY_DIR"
|
||||||
|
|
||||||
|
- name: Start tomcat and health check (timeout 90s)
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
|
run: |
|
||||||
|
LOG="$CATALINA_BASE/logs/catalina.$(date +%Y-%m-%d).log"
|
||||||
|
BEFORE=0
|
||||||
|
[ -f "$LOG" ] && BEFORE=$(stat -c %s "$LOG")
|
||||||
|
|
||||||
|
mkdir -p "$(dirname $CATALINA_PID)"
|
||||||
|
JAVA_HOME=$JAVA_HOME_TOMCAT "$CATALINA_HOME/bin/startup.sh"
|
||||||
|
|
||||||
|
DEADLINE=$(($(date +%s) + 90))
|
||||||
|
STATUS=000
|
||||||
|
while [ $(date +%s) -lt $DEADLINE ]; do
|
||||||
|
STATUS=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 3 http://localhost:$DEPLOY_HTTP_PORT/ 2>/dev/null || echo "000")
|
||||||
|
if [ "$STATUS" = "200" ]; then
|
||||||
|
echo "HTTP 200 received from /"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [ -f "$LOG" ] && tail -c +$((BEFORE+1)) "$LOG" | grep -qE "Application listener .* Exception|SEVERE.*startup.Catalina"; then
|
||||||
|
echo "::error::Startup error detected in log"
|
||||||
|
tail -c +$((BEFORE+1)) "$LOG" | tail -80
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$STATUS" != "200" ]; then
|
||||||
|
echo "::error::Health check failed within 90s (last HTTP status: $STATUS)"
|
||||||
|
[ -f "$LOG" ] && tail -c +$((BEFORE+1)) "$LOG" | tail -100
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "--- key boot log lines ---"
|
||||||
|
tail -c +$((BEFORE+1)) "$LOG" | grep -E "Server startup|Deployment of web" | head -10 || true
|
||||||
|
|
||||||
|
- name: Stop tomcat (post-clean)
|
||||||
|
if: always()
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
|
run: |
|
||||||
|
if [ -f "$CATALINA_PID" ] && kill -0 "$(cat $CATALINA_PID)" 2>/dev/null; then
|
||||||
|
JAVA_HOME=$JAVA_HOME_TOMCAT "$CATALINA_HOME/bin/shutdown.sh" 30 -force || true
|
||||||
|
for i in $(seq 1 30); do
|
||||||
|
[ -f "$CATALINA_PID" ] && kill -0 "$(cat $CATALINA_PID)" 2>/dev/null || break
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
[ -f "$CATALINA_PID" ] && kill -9 "$(cat $CATALINA_PID)" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
rm -f "$CATALINA_PID"
|
||||||
+1
-5
@@ -4,8 +4,4 @@ include 'elink-online-core-jpa'
|
|||||||
include 'elink-portal-common'
|
include 'elink-portal-common'
|
||||||
|
|
||||||
project (':elink-online-core-jpa').projectDir = new File(settingsDir, "../eapim-online/elink-online-core-jpa")
|
project (':elink-online-core-jpa').projectDir = new File(settingsDir, "../eapim-online/elink-online-core-jpa")
|
||||||
project (':elink-portal-common').projectDir = new File(settingsDir, "../elink-portal-common")
|
project (':elink-portal-common').projectDir = new File(settingsDir, "../elink-portal-common")
|
||||||
|
|
||||||
|
|
||||||
//include 'kjb-safedb'
|
|
||||||
//project (':kjb-safedb').projectDir = new File(settingsDir, "../kjb-safedb")
|
|
||||||
@@ -27,6 +27,7 @@ public class BaseDatasourceConfiguration {
|
|||||||
protected DataSource jndiLookup(String jndiName) throws NamingException {
|
protected DataSource jndiLookup(String jndiName) throws NamingException {
|
||||||
JndiObjectFactoryBean bean = new JndiObjectFactoryBean();
|
JndiObjectFactoryBean bean = new JndiObjectFactoryBean();
|
||||||
bean.setJndiName(jndiName);
|
bean.setJndiName(jndiName);
|
||||||
|
bean.setResourceRef(true);
|
||||||
bean.setProxyInterface(DataSource.class);
|
bean.setProxyInterface(DataSource.class);
|
||||||
bean.afterPropertiesSet();
|
bean.afterPropertiesSet();
|
||||||
return (DataSource) bean.getObject();
|
return (DataSource) bean.getObject();
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ public class GatewayDatasourceConfiguration extends BaseDatasourceConfiguration
|
|||||||
} catch (NamingException e) {
|
} catch (NamingException e) {
|
||||||
log.warn("JNDI lookup failed.", e);
|
log.warn("JNDI lookup failed.", e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.warn("gateway.datasource.jndi-name 이 설정되어 있지 않음 - 직접 접속 모드로 진행");
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("개발환경을 위해 JNDI 대신 직접 DB 접속 시도");
|
log.info("개발환경을 위해 JNDI 대신 직접 DB 접속 시도");
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ public class PortalDatasourceConfiguration extends BaseDatasourceConfiguration {
|
|||||||
} catch (NamingException e) {
|
} catch (NamingException e) {
|
||||||
log.warn("JNDI lookup failed.", e);
|
log.warn("JNDI lookup failed.", e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.warn("ems.datasource.jndi-name 이 설정되어 있지 않음 - 직접 접속 모드로 진행");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataSource == null) {
|
if (dataSource == null) {
|
||||||
|
|||||||
@@ -21,41 +21,23 @@ spring:
|
|||||||
|
|
||||||
ems:
|
ems:
|
||||||
datasource:
|
datasource:
|
||||||
jdbc-url: jdbc:oracle:thin:@//192.168.240.177:1598/DAPM
|
jndi-name: jdbc/dsOBP_EMS
|
||||||
# jdbc-url: jdbc:oracle:thin:@//localhost:1599/DAPM
|
schema: EMSAPP
|
||||||
# jdbc-url: jdbc:oracle:thin:@//192.168.240.177:1599/DAPM
|
|
||||||
# jdbc-url: jdbc:oracle:thin:@//192.168.240.177:1599/PAPM
|
|
||||||
driver-class-name: oracle.jdbc.OracleDriver
|
|
||||||
username: EMSAPP
|
|
||||||
password: elink1234
|
|
||||||
|
|
||||||
|
hibernate-dialect: org.hibernate.dialect.Oracle12cDialect
|
||||||
|
hibernate-physical-naming-strategy: com.eactive.apim.portal.common.entity.CustomPhysicalNamingStrategy
|
||||||
|
entity-package: com.eactive.apim.portal
|
||||||
|
|
||||||
gateway:
|
gateway:
|
||||||
datasource:
|
datasource:
|
||||||
jdbc-url: jdbc:oracle:thin:@//192.168.240.177:1598/DAPM
|
jndi-name: jdbc/dsOBP_AGW
|
||||||
# jdbc-url: jdbc:oracle:thin:@//localhost:1599/DAPM
|
schema: AGWAPP
|
||||||
# jdbc-url: jdbc:oracle:thin:@//192.168.240.177:1599/DAPM
|
|
||||||
# jdbc-url: jdbc:oracle:thin:@//192.168.240.177:1599/PAPM
|
hibernate-dialect: org.hibernate.dialect.Oracle12cDialect
|
||||||
driver-class-name: oracle.jdbc.OracleDriver
|
hibernate-physical-naming-strategy: com.eactive.apim.portal.common.entity.CustomPhysicalNamingStrategy
|
||||||
username: AGWAPP
|
entity-package: com.eactive.eai.data.entity.onl
|
||||||
password: elink1234
|
|
||||||
|
|
||||||
portal:
|
portal:
|
||||||
auth-virtual-code: 654321
|
auth-virtual-code: 654321
|
||||||
test-auth-notice-enabled: true
|
test-auth-notice-enabled: true
|
||||||
|
|
||||||
logging:
|
|
||||||
level:
|
|
||||||
org.hibernate.SQL: DEBUG
|
|
||||||
org.hibernate.type.descriptor.sql.BasicBinder: TRACE
|
|
||||||
|
|
||||||
proxy:
|
|
||||||
targets:
|
|
||||||
stg: http://localhost:10000/monitoring
|
|
||||||
prod: http://localhost:10000/monitoring
|
|
||||||
|
|
||||||
# stg: http://inter-ndapiap01.k-bank.com:7090/monitoring
|
|
||||||
# prod: http://inter-ndapiap01.k-bank.com:7090/monitoring
|
|
||||||
timeout:
|
|
||||||
connect: 5000
|
|
||||||
read: 5000
|
|
||||||
@@ -38,7 +38,7 @@ spring:
|
|||||||
enabled: true
|
enabled: true
|
||||||
atomikos:
|
atomikos:
|
||||||
properties:
|
properties:
|
||||||
log-base-dir: /Log/eapim/portal
|
log-base-dir: /logs/atomikos
|
||||||
log-base-name: adp_tx
|
log-base-name: adp_tx
|
||||||
|
|
||||||
thymeleaf:
|
thymeleaf:
|
||||||
@@ -82,7 +82,7 @@ portal:
|
|||||||
allowed-extensions: pdf,doc,docx,xls,xlsx,ppt,pptx,hwp,gif,jpg,jpeg,png
|
allowed-extensions: pdf,doc,docx,xls,xlsx,ppt,pptx,hwp,gif,jpg,jpeg,png
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
log-path: /Log/App/eapim/
|
log-path: /logs/eapim
|
||||||
|
|
||||||
auth-ttl: 300
|
auth-ttl: 300
|
||||||
auth:
|
auth:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<configuration scan="true" scanPeriod="5 seconds">
|
<configuration scan="true" scanPeriod="5 seconds">
|
||||||
<property name="LOG_PATH" value="/Log/App/eapim//${inst.Name:-devSvrUD}"/>
|
<property name="LOG_PATH" value="/logs/eapim/${inst.Name:-devSvrUD}"/>
|
||||||
|
|
||||||
<property name="PATTERN" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n" />
|
<property name="PATTERN" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n" />
|
||||||
<property name="PATTERN_DATE" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-15thread] %-5level %logger - %msg%n" />
|
<property name="PATTERN_DATE" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-15thread] %-5level %logger - %msg%n" />
|
||||||
|
|||||||
Reference in New Issue
Block a user