Skip to content

Commit

Permalink
Merge pull request #883 from dangdangwalk/backend/DANG-1247
Browse files Browse the repository at this point in the history
backend/DANG-1247: 레디스 도커 실행 안되는 문제 수정
  • Loading branch information
opehn authored Aug 24, 2024
2 parents 160025e + 4958938 commit 5d00a07
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/backend_weather_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,19 @@ jobs:
REDIS_PORT=$(grep REDIS_PORT ./backend/weather-api-module/.env.prod | cut -d '=' -f2)
REDIS_PORT=${REDIS_PORT:-6379}
echo ${REDIS_PORT}
if ! docker ps -a | grep -q redis-container; then
echo "Redis container does not exist, creating new one..."
IS_REDIS_RUNNING=$(docker inspect -f'{{.State.Status}}' redis-container 2>/dev/null | grep running)
if [ -z "$IS_REDIS_RUNNING" ]; then
docker rm -f redis-container 2>/dev/null
docker volume create redis_data
docker run -d --name redis-container \
-v redis_data:/data \
-p ${REDIS_PORT}:6379 \
redis:7.0.15 \
redis-server --appendonly yes --dir /data
echo "Redis 컨테이너가 생성되었습니다."
else
echo "Redis 컨테이너가 이미 실행중입니다."
fi
- name: run module
run: |
Expand Down
13 changes: 10 additions & 3 deletions backend/weather-api-module/src/init.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import { loadConfig } from './config/config';
import { getServerInstance } from './http/http-server';
import { getLogger } from './logger/logger-factory';
import { initializeScheduler } from './scheduler/scheduler';

async function init() {
const logger = getLogger();
try {
logger.info('config를 로드합니다');
await loadConfig();
logger.info('config가 성공적으로 로드되었습니다');

logger.info('Server를 실행합니다');
const server = await getServerInstance();

await server.initServer();
logger.info('Server가 성공적으로 실행되었습니다');

initializeScheduler();
logger.info('Scheduler를 실행합니다');
await initializeScheduler();
logger.info('Scheduler가 성공적으로 실행되었습니다');
} catch (error) {
console.error('초기화 중 오류 발생. 프로세스를 종료합니다. Error: ', error.message);
console.error(`초기화 중 오류 발생. 프로세스를 종료합니다. Error: ${error.message}`, error.stack);
process.exit(1);
}
}
Expand Down

0 comments on commit 5d00a07

Please sign in to comment.