Skip to content

Commit afdbedb

Browse files
committed
chore: backfill 실행 설정 정리
- local backfill 실행 스크립트를 추가 - backfill profile에서 local initializer와 cleanup이 실행되지 않도록 조정 - backfill 실행 시 domain event relay bean 의존성은 유지하되 scheduler 실행은 지연
1 parent 2069b20 commit afdbedb

5 files changed

Lines changed: 31 additions & 4 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
5+
ENV_FILE="${ENV_FILE:-"$ROOT_DIR/infra/.local.env"}"
6+
7+
if [[ ! -f "$ENV_FILE" ]]; then
8+
echo "env file not found: $ENV_FILE" >&2
9+
exit 1
10+
fi
11+
12+
set -a
13+
# shellcheck disable=SC1090
14+
source "$ENV_FILE"
15+
set +a
16+
17+
export SPRING_PROFILES_ACTIVE="${BACKFILL_PROFILES:-local,backfill}"
18+
export DDL_AUTO="${BACKFILL_DDL_AUTO:-none}"
19+
export MONGO_LOCAL_CLEANUP_ENABLED="false"
20+
export PERF_SEED_USER_COUNT="0"
21+
export DOC_LIST_READ_MODEL_BACKFILL_BATCH_SIZE="${DOC_LIST_READ_MODEL_BACKFILL_BATCH_SIZE:-100}"
22+
23+
bash "$ROOT_DIR/gradlew" bootRun

src/main/java/io/ejangs/docsa/global/init/LocalMongoCleanup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@Slf4j
1717
@Component
18-
@Profile("local")
18+
@Profile("local & !backfill")
1919
@RequiredArgsConstructor
2020
@Order(Ordered.HIGHEST_PRECEDENCE)
2121
@ConditionalOnProperty(

src/main/java/io/ejangs/docsa/global/init/PerfDataInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@Slf4j
2828
@Component
2929
@RequiredArgsConstructor
30-
@Profile({"local", "stg"})
30+
@Profile({"local & !backfill", "stg & !backfill"})
3131
public class PerfDataInitializer implements ApplicationRunner {
3232

3333
private static final String PASSWORD = "Testtest1";

src/main/java/io/ejangs/docsa/global/init/TestUserInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.springframework.transaction.annotation.Transactional;
1111

1212
@Component
13-
@Profile({"local", "stg"})
13+
@Profile({"local & !backfill", "stg & !backfill"})
1414
@Transactional(rollbackFor = Exception.class)
1515
@RequiredArgsConstructor
1616
public class TestUserInitializer {

src/main/resources/application-backfill.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ spring:
33
web-application-type: none
44

55
mongo:
6+
local-cleanup:
7+
enabled: false
68
delete:
79
outbox:
810
worker:
@@ -18,7 +20,9 @@ domain:
1820
event:
1921
outbox:
2022
worker:
21-
enabled: false
23+
enabled: true
24+
fixed-delay: PT1M
25+
initial-delay: PT24H
2226

2327
backfill:
2428
doc-list:

0 commit comments

Comments
 (0)