This commit is contained in:
parent
8df92fde73
commit
8faa23ac63
4 changed files with 23 additions and 15 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
#commons
|
#commons
|
||||||
APP_VERSION=2.0
|
APP_VERSION=2.0
|
||||||
DB_VERSION=2.0
|
|
||||||
REGISTRY_URL=10.230.238.56:5000
|
REGISTRY_URL=10.230.238.56:5000
|
||||||
JMX_MAIN_PORT=11001
|
JMX_MAIN_PORT=11001
|
||||||
JMX_MONITORING_PORT=11002
|
JMX_MONITORING_PORT=11002
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ${LOGS_DIR}:/opt/app/logs/app
|
- ${LOGS_DIR}:/opt/app/logs/app
|
||||||
- ${JSON_LOGS_DIR}:/opt/app/logs/json
|
- ${JSON_LOGS_DIR}:/opt/app/logs/json
|
||||||
|
- shared_data:/opt/app/reports
|
||||||
- ${REPORT_MAIN_DIR}:/opt/app/reports
|
- ${REPORT_MAIN_DIR}:/opt/app/reports
|
||||||
- ${ACCESS_LOGS_DIR}:/opt/app/logs/access
|
- ${ACCESS_LOGS_DIR}:/opt/app/logs/access
|
||||||
ports:
|
ports:
|
||||||
|
|
@ -15,7 +16,6 @@ services:
|
||||||
- XMX=4G
|
- XMX=4G
|
||||||
- XMS=1G
|
- XMS=1G
|
||||||
- TZ=Europe/Moscow
|
- TZ=Europe/Moscow
|
||||||
- DB_VERSION=${DB_VERSION}
|
|
||||||
- APM_SERVICE_NAME=${APM_SERVICE_NAME}-${APP_JAR}
|
- APM_SERVICE_NAME=${APM_SERVICE_NAME}-${APP_JAR}
|
||||||
- APM_SERVER_URLS=${APM_SERVER_URLS}
|
- APM_SERVER_URLS=${APM_SERVER_URLS}
|
||||||
- APM_ENVIRONMENT=${APM_ENVIRONMENT}
|
- APM_ENVIRONMENT=${APM_ENVIRONMENT}
|
||||||
|
|
@ -93,7 +93,7 @@ services:
|
||||||
container_name: credit-tracker-monitoring
|
container_name: credit-tracker-monitoring
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ${REPORT_MONITOR_DIR}:/opt/app/reports
|
- shared_data:/opt/app/reports
|
||||||
- ${LOGS_DIR}:/opt/app/logs/app
|
- ${LOGS_DIR}:/opt/app/logs/app
|
||||||
- ${JSON_LOGS_DIR}:/opt/app/logs/json
|
- ${JSON_LOGS_DIR}:/opt/app/logs/json
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -101,7 +101,6 @@ services:
|
||||||
- TZ=Europe/Moscow
|
- TZ=Europe/Moscow
|
||||||
- XMX=4G
|
- XMX=4G
|
||||||
- XMS=1G
|
- XMS=1G
|
||||||
- DB_VERSION=${DB_VERSION}
|
|
||||||
- APM_SERVICE_NAME=${APM_SERVICE_NAME}-${APP_JAR}
|
- APM_SERVICE_NAME=${APM_SERVICE_NAME}-${APP_JAR}
|
||||||
- APM_SERVER_URLS=${APM_SERVER_URLS}
|
- APM_SERVER_URLS=${APM_SERVER_URLS}
|
||||||
- APM_ENVIRONMENT=${APM_ENVIRONMENT}
|
- APM_ENVIRONMENT=${APM_ENVIRONMENT}
|
||||||
|
|
@ -147,3 +146,6 @@ services:
|
||||||
- SIGNALS_USER=${SIGNALS_USER}
|
- SIGNALS_USER=${SIGNALS_USER}
|
||||||
- MONITORING_INTERVAL=${MONITORING_INTERVAL}
|
- MONITORING_INTERVAL=${MONITORING_INTERVAL}
|
||||||
command: ["/opt/app/start-credit-tracker.sh"]
|
command: ["/opt/app/start-credit-tracker.sh"]
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
shared_data:
|
||||||
|
|
@ -37,6 +37,5 @@ public class CreditTrackerSettings {
|
||||||
private Integer daysToUpdateFlags;
|
private Integer daysToUpdateFlags;
|
||||||
private Long daysToUpdateFids;
|
private Long daysToUpdateFids;
|
||||||
private String encoding;
|
private String encoding;
|
||||||
private String dbVersion;
|
|
||||||
private Integer saverSubjectBatchSize;
|
private Integer saverSubjectBatchSize;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ public class DbVersionValidationService implements InitializingBean {
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
private final AppVersionMapper appVersionMapper;
|
private final AppVersionMapper appVersionMapper;
|
||||||
private final CreditTrackerSettings settings;
|
private final CreditTrackerSettings settings;
|
||||||
|
private final String expectedDbVersion = "2.21";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public DbVersionValidationService(AppVersionMapper appVersionMapper, CreditTrackerSettings settings) {
|
public DbVersionValidationService(AppVersionMapper appVersionMapper, CreditTrackerSettings settings) {
|
||||||
|
|
@ -25,9 +26,10 @@ public class DbVersionValidationService implements InitializingBean {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
String expectedDbVersion = settings.getDbVersion();
|
String[] expectedVersions = expectedDbVersion.split("\\.");
|
||||||
|
String expectedMajor = expectedVersions[0];
|
||||||
if (StringUtils.isEmpty(expectedDbVersion)) {
|
String expectedMinor = expectedVersions[1];
|
||||||
|
if (StringUtils.isEmpty(expectedMajor) || StringUtils.isEmpty(expectedMinor)) {
|
||||||
log.error("expected database version is not specified in the settings.");
|
log.error("expected database version is not specified in the settings.");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -35,20 +37,26 @@ public class DbVersionValidationService implements InitializingBean {
|
||||||
log.info("expected DB version: {}", expectedDbVersion);
|
log.info("expected DB version: {}", expectedDbVersion);
|
||||||
|
|
||||||
AppVersion appVersion = appVersionMapper.getAppVersion();
|
AppVersion appVersion = appVersionMapper.getAppVersion();
|
||||||
if (appVersion == null || StringUtils.isEmpty(appVersion.getDbVersion())) {
|
String[] actualVersions = appVersion.getDbVersion().split("\\.");
|
||||||
|
String actualMajor = actualVersions[0];
|
||||||
|
String actualMinor = actualVersions[1];
|
||||||
|
if (StringUtils.isEmpty(actualMajor) || StringUtils.isEmpty(actualMinor)) {
|
||||||
log.error("couldn't load version from APP_VERSION database table.");
|
log.error("couldn't load version from APP_VERSION database table.");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
String actualVersion = appVersion.getDbVersion();
|
log.info("actual DB version: {}", appVersion.getDbVersion());
|
||||||
|
|
||||||
log.info("actual DB version: {}", actualVersion);
|
if (!expectedMajor.equals(actualMajor)) {
|
||||||
|
|
||||||
if (!expectedDbVersion.equals(actualVersion)) {
|
|
||||||
log.error("expected database version does not match actual database version");
|
log.error("expected database version does not match actual database version");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Database version validation complete: {}", actualVersion);
|
if (Integer.parseInt(expectedMinor) < Integer.parseInt(actualMinor)) {
|
||||||
|
log.error("expected database version does not match actual database version");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Database version validation complete: {}", appVersion.getDbVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue