diff --git a/.run/DeploymentServiceApplication.run.xml b/.run/DeploymentServiceApplication.run.xml new file mode 100644 index 0000000..2b8b48d --- /dev/null +++ b/.run/DeploymentServiceApplication.run.xml @@ -0,0 +1,20 @@ + + + + + diff --git a/.run/Local.run.xml b/.run/Local.run.xml index 1dfe45f..926f41e 100644 --- a/.run/Local.run.xml +++ b/.run/Local.run.xml @@ -1,9 +1,10 @@ + - \ No newline at end of file + diff --git a/.run/PlatformStack.run.xml b/.run/PlatformStack.run.xml index a42fa11..8b2eca1 100644 --- a/.run/PlatformStack.run.xml +++ b/.run/PlatformStack.run.xml @@ -15,4 +15,20 @@ - \ No newline at end of file + + + + + + + + + diff --git a/.run/PlatformStackDev.run.xml b/.run/PlatformStackDev.run.xml index 965e53e..8638aea 100644 --- a/.run/PlatformStackDev.run.xml +++ b/.run/PlatformStackDev.run.xml @@ -1,8 +1,9 @@ - + - \ No newline at end of file + diff --git a/platform-stack/.env b/platform-stack/.env index f2e9be4..6272836 100644 --- a/platform-stack/.env +++ b/platform-stack/.env @@ -1,11 +1,14 @@ # -MIRANUM_PLATFORM_VERSION=0.3.0-SNAPSHOT +# General +# +MIRANUM_PLATFORM_VERSION=0.3.1-SNAPSHOT LOCAL_DATASOURCE_USERNAME=postgres LOCAL_DATASOURCE_PASSWORD=changeME!234 SSO_DATASOURCE_DB=keycloak +# # POSTGRES SETUP - +# LOCAL_DB_VENDOR=postgres LOCAL_KEYCLOAK_DB_VENDOR=postgres LOCAL_JDBC_BASE_URL=jdbc:postgresql://localhost:5432/ @@ -66,3 +69,16 @@ S3INTEGRATION_DATASOURCE_PASSWORD=${LOCAL_DATASOURCE_PASSWORD} S3INTEGRATION_DATASOURCE_URL=${LOCAL_JDBC_BASE_URL}${S3INTEGRATION_DATASOURCE_DB} S3INTEGRATION_DATASOURCE_DRIVERCLASSNAME=org.postgresql.Driver S3INTEGRATION_DATABASE_PLATFORM=io.miranum.integration.s3.infrastructure.dialect.NoToastPostgresSQLDialect + +# +# Deployment +# +MIRANUM_DEPLOYMENT_SERVICE_PORT=8092 +MIRANUM_DEPLOYMENT_SERVER_BPMN_TEST_URL=http://localhost +MIRANUM_DEPLOYMENT_SERVER_BPMN_TEST_PORT=8090 +MIRANUM_DEPLOYMENT_SERVER_DMN_TEST_URL=http://localhost +MIRANUM_DEPLOYMENT_SERVER_DMN_TEST_PORT=8090 +MIRANUM_DEPLOYMENT_SERVER_FORM_TEST_URL=http://localhost +MIRANUM_DEPLOYMENT_SERVER_FORM_TEST_PORT=8091 +MIRANUM_DEPLOYMENT_SERVER_CONFIG_TEST_URL=http://localhost +MIRANUM_DEPLOYMENT_SERVER_CONFIG_TEST_PORT=8091 diff --git a/platform-stack/docker-compose.yml b/platform-stack/docker-compose.yml index 72a1fe5..c3033da 100644 --- a/platform-stack/docker-compose.yml +++ b/platform-stack/docker-compose.yml @@ -82,6 +82,8 @@ services: deployment: image: miragon/miranum-platform-deployment-service:${MIRANUM_PLATFORM_VERSION} container_name: miranum-deployment + profiles: + - engine ports: - "8092:8080" restart: unless-stopped @@ -90,8 +92,8 @@ services: environment: IO_MIRANUM_DEPLOYMENTSERVER_REST_TARGETS_TEST_BPMN: http://host.docker.internal:8090/rest/deployment IO_MIRANUM_DEPLOYMENTSERVER_REST_TARGETS_TEST_DMN: http://host.docker.internal:8090/rest/deployment - IO_MIRANUM_DEPLOYMENTSERVER_REST_TARGETS_TEST_FORM: http://host.docker.internal:8090/rest/deployment - IO_MIRANUM_DEPLOYMENTSERVER_REST_TARGETS_TEST_CONFIG: http://host.docker.internal:8090/rest/deployment + IO_MIRANUM_DEPLOYMENTSERVER_REST_TARGETS_TEST_FORM: http://host.docker.internal:8091/deployment + IO_MIRANUM_DEPLOYMENTSERVER_REST_TARGETS_TEST_CONFIG: http://host.docker.internal:8091/deployment extra_hosts: - "host.docker.internal:host-gateway" networks: @@ -161,7 +163,6 @@ services: container_name: postgres volumes: - ./postgres/:/docker-entrypoint-initdb.d/ - - ./data:/var/lib/postgresql/data ports: - "5432:5432" restart: unless-stopped diff --git a/pom.xml b/pom.xml index a36d98e..63a5363 100644 --- a/pom.xml +++ b/pom.xml @@ -9,10 +9,10 @@ miranum-platform pom Miranum Platform - https://github.com/FlowSquad/miranum-platform + https://github.com/Miragon/miranum-platform - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT 17 17 17 diff --git a/services/deployment-service/src/main/resources/application.yml b/services/deployment-service/src/main/resources/application.yml index 4dfb3b5..6bb3708 100644 --- a/services/deployment-service/src/main/resources/application.yml +++ b/services/deployment-service/src/main/resources/application.yml @@ -1,5 +1,21 @@ -io: - miranum: - deploymentserver: - rest: +server: + port: '${MIRANUM_DEPLOYMENT_SERVICE_PORT:8080}' + +io.miranum.deploymentserver.rest: enabled: true + targets: + dev: + bpmn: '${MIRANUM_DEPLOYMENT_SERVER_BPMN_DEV_URL}:${MIRANUM_DEPLOYMENT_SERVER_BPMN_DEV_PORT}/rest/deployment' + dmn: '${MIRANUM_DEPLOYMENT_SERVER_DMN_DEV_URL}:${MIRANUM_DEPLOYMENT_SERVER_DMN_DEV_PORT}/rest/deployment' + form: '${MIRANUM_DEPLOYMENT_SERVER_FORM_DEV_URL}:${MIRANUM_DEPLOYMENT_SERVER_FORM_DEV_PORT}/rest/deployment' + config: '${MIRANUM_DEPLOYMENT_SERVER_CONFIG_DEV_URL}:${MIRANUM_DEPLOYMENT_SERVER_CONFIG_DEV_PORT}/rest/deployment' + test: + bpmn: '${MIRANUM_DEPLOYMENT_SERVER_BPMN_TEST_URL}:${MIRANUM_DEPLOYMENT_SERVER_BPMN_TEST_PORT}/rest/deployment' + dmn: '${MIRANUM_DEPLOYMENT_SERVER_DMN_TEST_URL}:${MIRANUM_DEPLOYMENT_SERVER_DMN_TEST_PORT}/rest/deployment' + form: '${MIRANUM_DEPLOYMENT_SERVER_FORM_TEST_URL}:${MIRANUM_DEPLOYMENT_SERVER_FORM_TEST_PORT}/rest/deployment' + config: '${MIRANUM_DEPLOYMENT_SERVER_CONFIG_TEST_URL}:${MIRANUM_DEPLOYMENT_SERVER_CONFIG_TEST_PORT}/rest/deployment' + prod: + bpmn: '${MIRANUM_DEPLOYMENT_SERVER_BPMN_PROD_URL}:${MIRANUM_DEPLOYMENT_SERVER_BPMN_PROD_PORT}/rest/deployment' + dmn: '${MIRANUM_DEPLOYMENT_SERVER_DMN_PROD_URL}:${MIRANUM_DEPLOYMENT_SERVER_DMN_PROD_PORT}/rest/deployment' + form: '${MIRANUM_DEPLOYMENT_SERVER_FORM_PROD_URL}:${MIRANUM_DEPLOYMENT_SERVER_FORM_PROD_PORT}/rest/deployment' + config: '${MIRANUM_DEPLOYMENT_SERVER_CONFIG_PROD_URL}:${MIRANUM_DEPLOYMENT_SERVER_CONFIG_PROD_PORT}/rest/deployment' diff --git a/services/schema-registry-service/src/main/java/io/miranum/platform/schemaregistry/deployment/SchemaDeploymentReceiver.java b/services/schema-registry-service/src/main/java/io/miranum/platform/schemaregistry/deployment/SchemaDeploymentReceiver.java index 8f152a9..42ac3dc 100644 --- a/services/schema-registry-service/src/main/java/io/miranum/platform/schemaregistry/deployment/SchemaDeploymentReceiver.java +++ b/services/schema-registry-service/src/main/java/io/miranum/platform/schemaregistry/deployment/SchemaDeploymentReceiver.java @@ -25,23 +25,27 @@ public class SchemaDeploymentReceiver implements MiranumDeploymentReceiver { @Override public void deploy(final Deployment deployment, final List tags) { - // process configs and forms are both json schemas and saved the same way - if (deployment.getType().equalsIgnoreCase("form") || deployment.getType().equalsIgnoreCase("config")) { - try { - final JsonNode jsonSchema = this.objectMapper.readTree(deployment.getFile()); - this.deployJsonSchema(jsonSchema, deployment.getNamespace(), tags); - log.info("Deployed json schema {} of type {}", deployment.getFilename(), deployment.getType()); - } catch (final IOException e) { - log.error("Could not parse schema {}", deployment.getFilename(), e); - throw new DeploymentFailedException("Could not parse schema " + deployment.getFilename()); + try { + final String namespace = deployment.getNamespace(); + final JsonNode jsonNode = this.objectMapper.readTree(deployment.getFile()); + final String schemaRef = Optional.of(jsonNode.get("key")).map(JsonNode::asText) + .orElseThrow(() -> new DeploymentFailedException("No key found in schema " + jsonNode.get("key"))); + + switch (deployment.getType().toLowerCase()) { + case "form": + final JsonNode schema = jsonNode.get("schema"); + this.saveSchemaUseCase.saveSchema(new SaveSchemaInCommand(namespace, schemaRef, tags, schema)); + break; + case "config": + this.saveSchemaUseCase.saveSchema(new SaveSchemaInCommand(namespace, schemaRef, tags, jsonNode)); + break; + default: + log.info("Ignoring deployment of type {}", deployment.getType().toLowerCase()); } + } catch (final IOException e) { + log.error("Could not parse schema {}", deployment.getFilename(), e); + throw new DeploymentFailedException("Could not parse schema " + deployment.getFilename()); } } - private void deployJsonSchema(final JsonNode schema, final String namespace, final List tags) { - final String schemaRef = Optional.of(schema.get("key")).map(JsonNode::asText) - .orElseThrow(() -> new DeploymentFailedException("No key found in schema " + schema.get("key"))); - final SaveSchemaInCommand saveSchemaInCommand = new SaveSchemaInCommand(namespace, schemaRef, tags, schema); - this.saveSchemaUseCase.saveSchema(saveSchemaInCommand); - } }