-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/docker-revision' into feature/eds-revolution
- Loading branch information
Showing
5 changed files
with
87 additions
and
35 deletions.
There are no files selected for viewing
82 changes: 61 additions & 21 deletions
82
src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/config/DockerSetup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,84 @@ | ||
package it.finanze.sanita.fse2.ms.gtw.rulesmanager.config; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.context.event.ApplicationStartedEvent; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.context.event.EventListener; | ||
|
||
import it.finanze.sanita.fse2.ms.gtw.rulesmanager.config.eds.changeset.impl.DictionaryCFG; | ||
import it.finanze.sanita.fse2.ms.gtw.rulesmanager.config.eds.changeset.impl.EngineCFG; | ||
import it.finanze.sanita.fse2.ms.gtw.rulesmanager.config.eds.changeset.impl.FhirStructuresCFG; | ||
import it.finanze.sanita.fse2.ms.gtw.rulesmanager.config.eds.changeset.impl.TerminologyCFG; | ||
import it.finanze.sanita.fse2.ms.gtw.rulesmanager.exceptions.eds.EdsDbException; | ||
import it.finanze.sanita.fse2.ms.gtw.rulesmanager.repository.IExecutorRepo; | ||
import it.finanze.sanita.fse2.ms.gtw.rulesmanager.scheduler.executors.impl.DictionaryExecutor; | ||
import it.finanze.sanita.fse2.ms.gtw.rulesmanager.scheduler.executors.impl.EnginesExecutor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.context.event.ApplicationStartedEvent; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.context.event.EventListener; | ||
|
||
@Profile(value = Constants.Profile.DOCKER) | ||
import static it.finanze.sanita.fse2.ms.gtw.rulesmanager.config.Constants.Profile.DOCKER; | ||
|
||
@Profile(value = DOCKER) | ||
@Configuration | ||
@Slf4j | ||
public class DockerSetup { | ||
|
||
// Executors | ||
@Autowired | ||
private EnginesExecutor engineExecutors; | ||
private EnginesExecutor engineExecutor; | ||
|
||
@Autowired | ||
private IExecutorRepo executorRepo; | ||
|
||
private DictionaryExecutor dictionaryExecutor; | ||
|
||
// Data-layer | ||
@Autowired | ||
private FhirStructuresCFG fhirStructuresCFG; | ||
private IExecutorRepo repository; | ||
|
||
// Configurations | ||
@Autowired | ||
private FhirStructuresCFG transforms; | ||
|
||
@Autowired | ||
private EngineCFG engineCFG; | ||
private EngineCFG engine; | ||
|
||
@Autowired | ||
private DictionaryCFG dictionary; | ||
|
||
@Autowired | ||
private TerminologyCFG terminology; | ||
|
||
@EventListener(value = ApplicationStartedEvent.class) | ||
public void dockerInit() throws EdsDbException { | ||
log.info("Docker init engines start"); | ||
executorRepo.drop(engineCFG.getProduction()); | ||
log.info("Delete collection engine production"); | ||
executorRepo.clone(fhirStructuresCFG.getProduction(), fhirStructuresCFG.getStaging()); | ||
engineExecutors.execute(); | ||
executorRepo.drop(fhirStructuresCFG.getStaging()); | ||
log.info("Delete collection transform-staging"); | ||
public void init() throws EdsDbException { | ||
log.info("[DOCKER] Setup has started"); | ||
setupEngine(); | ||
setupDictionary(); | ||
log.info("[DOCKER] Setup has finished"); | ||
} | ||
|
||
|
||
private void setupEngine() throws EdsDbException { | ||
log.info("[DOCKER] Starting docker-routine to initialize engine"); | ||
repository.drop(engine.getProduction()); | ||
log.info("[DOCKER] Clean-up previous engines, if they exist"); | ||
repository.clone(transforms.getProduction(), transforms.getStaging()); | ||
log.info("[DOCKER] Spawning engine ..."); | ||
engineExecutor.execute(); | ||
log.info("[DOCKER] Engine spawned!"); | ||
repository.drop(transforms.getStaging()); | ||
repository.drop(engine.getBackup()); | ||
log.info("[DOCKER] Cleaning-up"); | ||
} | ||
|
||
private void setupDictionary() throws EdsDbException { | ||
log.info("[DOCKER] Starting docker-routine to initialize dictionary"); | ||
repository.drop(dictionary.getProduction()); | ||
log.info("[DOCKER] Clean-up previous dictionaries, if they exist"); | ||
repository.clone(terminology.getProduction(), terminology.getStaging()); | ||
log.info("[DOCKER] Creating dictionaries ..."); | ||
dictionaryExecutor.execute(); | ||
log.info("[DOCKER] Dictionaries created!"); | ||
repository.drop(terminology.getStaging()); | ||
repository.drop(dictionary.getBackup()); | ||
log.info("[DOCKER] Cleaning-up"); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ server.port=8011 | |
management.server.port=8011 | ||
|
||
### MONGODB ### | ||
data.mongodb.uri=mongodb://mongoadmin:[email protected]:27888/fse | ||
data.mongodb.uri=mongodb://mongoadmin:secret@mongo:27017 | ||
data.mongodb.schema-name=FSE_GTW | ||
|
||
### EDS CLIENT (REST) ### | ||
eds.rest.secured=false | ||
|
@@ -18,7 +19,7 @@ log.output.format=console | |
log.level=trace | ||
log.kafka-log.enable=true | ||
kafka.log.base-topic=MDS-SA-0004_FU_001_LOG | ||
kafka.bootstrap-servers=host.docker.internal:29092 | ||
kafka.bootstrap-servers=kafka:29092 | ||
spring.sleuth.messaging.kafka.enabled=false | ||
kafka.properties.security.protocol=PLAINTEXT | ||
kafka.properties.sasl.mechanism=PLAINTEXT | ||
|
@@ -28,17 +29,17 @@ kafka.properties.ssl.truststore.password=PLAINTEXT | |
kafka.enablessl=false | ||
|
||
### EDS CLIENT (CHANGESET) ### | ||
eds.changeset.schema.status=http://host.docker.internal:9100/v1/changeset/schema/status | ||
eds.changeset.schema.data=http://host.docker.internal:9100/v1/schema/id/ | ||
eds.changeset.schema.status=http://it-fse-srv-syntax-rules-manager:9100/v1/changeset/schema/status | ||
eds.changeset.schema.data=http://it-fse-srv-syntax-rules-manager:9100/v1/schema/id/ | ||
# Schematron | ||
eds.changeset.schematron.status=http://host.docker.internal:9085/v1/changeset/schematron/status | ||
eds.changeset.schematron.data=http://host.docker.internal:9085/v1/schematron/id/ | ||
eds.changeset.schematron.status=http://it-fse-srv-semantic-rules-manager:9085/v1/changeset/schematron/status | ||
eds.changeset.schematron.data=http://it-fse-srv-semantic-rules-manager:9085/v1/schematron/id/ | ||
# Fhir Structures | ||
eds.changeset.fhir.status=http://host.docker.internal:9086/v1/changeset/transform/status | ||
eds.changeset.fhir.data=http://host.docker.internal:9086/v1/transform/id/ | ||
eds.changeset.fhir.status=http://it-fse-srv-fhir:9086/v1/changeset/transform/status | ||
eds.changeset.fhir.data=http://it-fse-srv-fhir:9086/v1/transform/id/ | ||
# Terminology (Chunked) | ||
eds.changeset.terminology.chunks.status=http://host.docker.internal:9088/v1/changeset/terminology/chunks | ||
eds.changeset.terminology.chunks.ins=http://host.docker.internal:9088/v1/changeset/terminology/chunks/ins | ||
eds.changeset.terminology.chunks.del=http://host.docker.internal:9088/v1/changeset/terminology/chunks/del | ||
eds.changeset.terminology.chunks.status=http://it-fse-srv-dictionary:9088/v1/changeset/terminology/chunks | ||
eds.changeset.terminology.chunks.ins=http://it-fse-srv-dictionary:9088/v1/changeset/terminology/chunks/ins | ||
eds.changeset.terminology.chunks.del=http://it-fse-srv-dictionary:9088/v1/changeset/terminology/chunks/del | ||
|
||
ms.url.gtw-config=http://host.docker.internal:8018 | ||
ms.url.gtw-config=http://it-fse-gtw-config:8018 |