From f707769e1110dece253b61bc10a02f088df0e3a3 Mon Sep 17 00:00:00 2001 From: Bogdan Alov Date: Fri, 26 Jul 2019 13:17:28 +0300 Subject: [PATCH 01/16] updating virtualservice to include exposed headers --- charts/account-service/Chart.yaml | 2 +- charts/account-service/templates/virtualservice.yaml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/charts/account-service/Chart.yaml b/charts/account-service/Chart.yaml index b0c2b63..5f041fe 100644 --- a/charts/account-service/Chart.yaml +++ b/charts/account-service/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v1 appVersion: "1.0" description: Deployment of the nynja account service. name: account-service -version: 0.1.7 +version: 0.1.8 diff --git a/charts/account-service/templates/virtualservice.yaml b/charts/account-service/templates/virtualservice.yaml index d3301e8..1eda2ba 100644 --- a/charts/account-service/templates/virtualservice.yaml +++ b/charts/account-service/templates/virtualservice.yaml @@ -39,4 +39,8 @@ spec: {{- range .Values.corsPolicy.allowHeaders }} - {{ . }} {{- end }} + exposeHeaders: + {{- range .Values.corsPolicy.exposeHeaders }} + - {{ . }} + {{- end }} maxAge: {{ .Values.corsPolicy.maxAge }} -- GitLab From 6b8544658260f53a1643a27d4c8150eb801c21d8 Mon Sep 17 00:00:00 2001 From: Bogdan Alov Date: Fri, 26 Jul 2019 13:22:16 +0300 Subject: [PATCH 02/16] updating releases for all environments with the new version --- releases/dev/account-service.yaml | 2 +- releases/prod/account-service.yaml | 2 +- releases/staging/account-service.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/releases/dev/account-service.yaml b/releases/dev/account-service.yaml index 4effbf5..4ef7c81 100644 --- a/releases/dev/account-service.yaml +++ b/releases/dev/account-service.yaml @@ -8,7 +8,7 @@ spec: chart: repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ name: account-service - version: 0.1.7 + version: 0.1.8 values: replicaCount: 1 diff --git a/releases/prod/account-service.yaml b/releases/prod/account-service.yaml index 8662098..fb3d06f 100644 --- a/releases/prod/account-service.yaml +++ b/releases/prod/account-service.yaml @@ -8,7 +8,7 @@ spec: chart: repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ name: account-service - version: 0.1.7 + version: 0.1.8 values: replicaCount: 2 diff --git a/releases/staging/account-service.yaml b/releases/staging/account-service.yaml index 17d4d94..913f070 100644 --- a/releases/staging/account-service.yaml +++ b/releases/staging/account-service.yaml @@ -8,7 +8,7 @@ spec: chart: repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ name: account-service - version: 0.1.7 + version: 0.1.8 values: replicaCount: 2 -- GitLab From fe84b28211adcb6afabd124992d009557daba1e5 Mon Sep 17 00:00:00 2001 From: Angel Botev Date: Thu, 25 Jul 2019 16:10:45 +0300 Subject: [PATCH 03/16] NY-7892_publicsh_kafka_event - add kafka config, constants and template; - add send event in complete pending account; - add configurations; Signed-off-by: Angel Botev --- pom.xml | 5 ++ .../java/biz/nynja/account/Application.java | 3 +- .../biz/nynja/account/kafka/Constants.java | 11 ++++ .../account/kafka/KafkaProducerConfig.java | 54 +++++++++++++++++++ .../kafka/UserEventsMessageTemplate.java | 47 ++++++++++++++++ .../account/kafka/UserEventsProducer.java | 31 +++++++++++ .../account/services/AccountServiceImpl.java | 17 +++++- src/main/resources/application-dev.yml | 5 ++ src/main/resources/application-production.yml | 5 ++ 9 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 src/main/java/biz/nynja/account/kafka/Constants.java create mode 100644 src/main/java/biz/nynja/account/kafka/KafkaProducerConfig.java create mode 100644 src/main/java/biz/nynja/account/kafka/UserEventsMessageTemplate.java create mode 100644 src/main/java/biz/nynja/account/kafka/UserEventsProducer.java diff --git a/pom.xml b/pom.xml index bca6168..e3c914b 100644 --- a/pom.xml +++ b/pom.xml @@ -184,6 +184,11 @@ 1.4.0 + + org.springframework.kafka + spring-kafka + 2.2.7.RELEASE + diff --git a/src/main/java/biz/nynja/account/Application.java b/src/main/java/biz/nynja/account/Application.java index cffdaaf..135dda1 100644 --- a/src/main/java/biz/nynja/account/Application.java +++ b/src/main/java/biz/nynja/account/Application.java @@ -8,11 +8,12 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration; /** * Main entry point class. */ -@SpringBootApplication +@SpringBootApplication(exclude = KafkaAutoConfiguration.class) public class Application { private static final Logger LOGGER = LogManager.getLogger(Application.class); diff --git a/src/main/java/biz/nynja/account/kafka/Constants.java b/src/main/java/biz/nynja/account/kafka/Constants.java new file mode 100644 index 0000000..0205d5c --- /dev/null +++ b/src/main/java/biz/nynja/account/kafka/Constants.java @@ -0,0 +1,11 @@ +/** + * Copyright (C) 2018 Nynja Inc. All rights reserved. + */ +package biz.nynja.account.kafka; + +public interface Constants { + + interface EventType { + String SIGN_UP = "signup"; + } +} diff --git a/src/main/java/biz/nynja/account/kafka/KafkaProducerConfig.java b/src/main/java/biz/nynja/account/kafka/KafkaProducerConfig.java new file mode 100644 index 0000000..b9f2ebc --- /dev/null +++ b/src/main/java/biz/nynja/account/kafka/KafkaProducerConfig.java @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2018 Nynja Inc. All rights reserved. + */ +package biz.nynja.account.kafka; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.kafka.clients.producer.ProducerConfig; +import org.apache.kafka.common.serialization.StringSerializer; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.kafka.core.DefaultKafkaProducerFactory; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.kafka.core.ProducerFactory; +import org.springframework.kafka.support.serializer.JsonSerializer; + +@Configuration +public class KafkaProducerConfig { + + @Value("${kafka.host}") + private String KAFKA_HOST; + @Value("${kafka.port}") + private String KAFKA_PORT; + @Value("${kafka.topic}") + private String KAFKA_TOPIC; + + @Bean(name = "kafkaTopic") + public String kafkaTopic() { + return KAFKA_TOPIC; + } + + // ======= KAFKA PRODUCER CONFIGURATION =========== + + @Bean + public ProducerFactory producerFactory() { + + Map configProps = new HashMap(3); + + configProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, KAFKA_HOST + ":" + KAFKA_PORT); + configProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class); + configProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class); + + return new DefaultKafkaProducerFactory(configProps); + + } + + @Bean + public KafkaTemplate kafkaTemplate() { + return new KafkaTemplate(producerFactory()); + } + +} diff --git a/src/main/java/biz/nynja/account/kafka/UserEventsMessageTemplate.java b/src/main/java/biz/nynja/account/kafka/UserEventsMessageTemplate.java new file mode 100644 index 0000000..0572237 --- /dev/null +++ b/src/main/java/biz/nynja/account/kafka/UserEventsMessageTemplate.java @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2018 Nynja Inc. All rights reserved. + */ +package biz.nynja.account.kafka; + +public class UserEventsMessageTemplate { + + private String account_id; + private String event_type; + private String refercode; + + public UserEventsMessageTemplate(String account_id, String event_type, String refercode) { + this.account_id = account_id; + this.event_type = event_type; + this.refercode = refercode; + } + + public String getRefercode() { + return refercode; + } + + public void setRefercode(String refercode) { + this.refercode = refercode; + } + + public String getAccount_id() { + return account_id; + } + + public void setAccount_id(String account_id) { + this.account_id = account_id; + } + + public String getEvent_type() { + return event_type; + } + + public void setEvent_type(String event_type) { + this.event_type = event_type; + } + + @Override + public String toString() { + return "UserEventsMessageTemplate{" + "account_id='" + account_id + '\'' + ", event_type='" + event_type + '\'' + + ", refercode='" + refercode + '\'' + '}'; + } +} diff --git a/src/main/java/biz/nynja/account/kafka/UserEventsProducer.java b/src/main/java/biz/nynja/account/kafka/UserEventsProducer.java new file mode 100644 index 0000000..1d087de --- /dev/null +++ b/src/main/java/biz/nynja/account/kafka/UserEventsProducer.java @@ -0,0 +1,31 @@ +/** + * Copyright (C) 2018 Nynja Inc. All rights reserved. + */ +package biz.nynja.account.kafka; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.stereotype.Component; + +@Component +public class UserEventsProducer { + + private static final Logger logger = LoggerFactory.getLogger(UserEventsProducer.class); + + @Autowired + private KafkaTemplate kafkaTemplate; + + @Autowired + @Qualifier("kafkaTopic") + private String kafkaTopic; + + public void sendKafkaMessage(UserEventsMessageTemplate userEventsMessageTemplate) { + kafkaTemplate.send(kafkaTopic, userEventsMessageTemplate); + + logger.info("Message sent to kafka topic : {}", kafkaTopic); + + } +} diff --git a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java index 457c784..7d0da1a 100644 --- a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java +++ b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java @@ -55,6 +55,9 @@ import biz.nynja.account.grpc.StatusResponse; import biz.nynja.account.grpc.UpdateAccountRequest; import biz.nynja.account.grpc.UpdateAuthenticationProviderRequest; import biz.nynja.account.grpc.UpdateSearchableOptionRequest; +import biz.nynja.account.kafka.Constants; +import biz.nynja.account.kafka.UserEventsMessageTemplate; +import biz.nynja.account.kafka.UserEventsProducer; import biz.nynja.account.models.Account; import biz.nynja.account.models.AccountByProfileId; import biz.nynja.account.models.AccountByQrCode; @@ -107,6 +110,7 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas private final PermissionsValidator permissionsValidator; private final ProfileDataConfiguration profileDataConfiguration; private final AccessPointService accessPointService; + private final UserEventsProducer userEventsProducer; public AccountServiceImpl(AccountRepositoryAdditional accountRepositoryAdditional, ProfileRepository profileRepository, @@ -115,7 +119,8 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas AccountByUsernameRepository accountByUsernameRepository, AccountProvider accountProvider, AccountByProfileIdRepository accountByProfileIdRepository, PhoneNumberNormalizer phoneNumberNormalizer, AccountCreator accountCreator, ProfileProvider profileProvider, PermissionsValidator permissionsValidator, - ProfileDataConfiguration profileDataConfiguration, AccessPointService accessPointService) { + ProfileDataConfiguration profileDataConfiguration, AccessPointService accessPointService, + UserEventsProducer userEventsProducer) { this.accountRepositoryAdditional = accountRepositoryAdditional; this.profileRepository = profileRepository; this.profileByAutheticationProviderRepository = profileByAutheticationProviderRepository; @@ -129,6 +134,7 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas this.permissionsValidator = permissionsValidator; this.profileDataConfiguration = profileDataConfiguration; this.accessPointService = accessPointService; + this.userEventsProducer = userEventsProducer; } @Override @@ -499,6 +505,15 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas logger.debug("Complete pending account creation...: {} ...", request); AccountResponse response = accountCreator.retrieveCompletePendingAccountResponse(request); + // send event for new user to Kafka + try { + userEventsProducer.sendKafkaMessage(new UserEventsMessageTemplate(response.getAccountDetails().getAccountId(), + Constants.EventType.SIGN_UP, "")); + }catch (Exception e) { + logger.error("Error sending event to Kafka for account id {}", response.getAccountDetails().getAccountId()); + logger.debug("Error sending event to Kafka for account id {}, {}", response.getAccountDetails().getAccountId(), + e.getMessage()); + } logger.info("SUCCESS: Completed pending account creation for account ID {}.", request.getAccountId()); responseObserver.onNext(response); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 3e29512..879dcba 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -43,6 +43,11 @@ erlang-bridge: host: localhost port: 6580 +kafka: + host: 127.0.0.1 + port: 9092 + topic: userEventss + #Metrics related configurations management: endpoint: diff --git a/src/main/resources/application-production.yml b/src/main/resources/application-production.yml index c76cc62..f97fa40 100644 --- a/src/main/resources/application-production.yml +++ b/src/main/resources/application-production.yml @@ -36,6 +36,11 @@ erlang-bridge: host: ${BRIDGE_HOST} port: ${BRIDGE_PORT} +kafka: + host: ${KAFKA_HOST:kafka.kafka.svc.cluster.local} + port: ${KAFKA_PORT:9092} + topic: ${KAFKA_TOPIC:userEvents} + #Metrics related configurations management: endpoint: -- GitLab From b8198ff611db725a3fc24a60e6f8aa5ba0152f9a Mon Sep 17 00:00:00 2001 From: Angel Botev Date: Thu, 25 Jul 2019 17:51:00 +0300 Subject: [PATCH 04/16] NY-7892_publish_kafka_event - bump version and move logic in AccountCreator; Signed-off-by: Angel Botev --- charts/account-service/Chart.yaml | 2 +- releases/staging/account-service.yaml | 2 +- .../account/services/AccountServiceImpl.java | 17 +--------------- .../decomposition/AccountCreator.java | 20 ++++++++++++++++++- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/charts/account-service/Chart.yaml b/charts/account-service/Chart.yaml index 5f041fe..0d67982 100644 --- a/charts/account-service/Chart.yaml +++ b/charts/account-service/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v1 appVersion: "1.0" description: Deployment of the nynja account service. name: account-service -version: 0.1.8 +version: 0.1.9 diff --git a/releases/staging/account-service.yaml b/releases/staging/account-service.yaml index 913f070..c4341b6 100644 --- a/releases/staging/account-service.yaml +++ b/releases/staging/account-service.yaml @@ -8,7 +8,7 @@ spec: chart: repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ name: account-service - version: 0.1.8 + version: 0.1.9 values: replicaCount: 2 diff --git a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java index 7d0da1a..457c784 100644 --- a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java +++ b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java @@ -55,9 +55,6 @@ import biz.nynja.account.grpc.StatusResponse; import biz.nynja.account.grpc.UpdateAccountRequest; import biz.nynja.account.grpc.UpdateAuthenticationProviderRequest; import biz.nynja.account.grpc.UpdateSearchableOptionRequest; -import biz.nynja.account.kafka.Constants; -import biz.nynja.account.kafka.UserEventsMessageTemplate; -import biz.nynja.account.kafka.UserEventsProducer; import biz.nynja.account.models.Account; import biz.nynja.account.models.AccountByProfileId; import biz.nynja.account.models.AccountByQrCode; @@ -110,7 +107,6 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas private final PermissionsValidator permissionsValidator; private final ProfileDataConfiguration profileDataConfiguration; private final AccessPointService accessPointService; - private final UserEventsProducer userEventsProducer; public AccountServiceImpl(AccountRepositoryAdditional accountRepositoryAdditional, ProfileRepository profileRepository, @@ -119,8 +115,7 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas AccountByUsernameRepository accountByUsernameRepository, AccountProvider accountProvider, AccountByProfileIdRepository accountByProfileIdRepository, PhoneNumberNormalizer phoneNumberNormalizer, AccountCreator accountCreator, ProfileProvider profileProvider, PermissionsValidator permissionsValidator, - ProfileDataConfiguration profileDataConfiguration, AccessPointService accessPointService, - UserEventsProducer userEventsProducer) { + ProfileDataConfiguration profileDataConfiguration, AccessPointService accessPointService) { this.accountRepositoryAdditional = accountRepositoryAdditional; this.profileRepository = profileRepository; this.profileByAutheticationProviderRepository = profileByAutheticationProviderRepository; @@ -134,7 +129,6 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas this.permissionsValidator = permissionsValidator; this.profileDataConfiguration = profileDataConfiguration; this.accessPointService = accessPointService; - this.userEventsProducer = userEventsProducer; } @Override @@ -505,15 +499,6 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas logger.debug("Complete pending account creation...: {} ...", request); AccountResponse response = accountCreator.retrieveCompletePendingAccountResponse(request); - // send event for new user to Kafka - try { - userEventsProducer.sendKafkaMessage(new UserEventsMessageTemplate(response.getAccountDetails().getAccountId(), - Constants.EventType.SIGN_UP, "")); - }catch (Exception e) { - logger.error("Error sending event to Kafka for account id {}", response.getAccountDetails().getAccountId()); - logger.debug("Error sending event to Kafka for account id {}, {}", response.getAccountDetails().getAccountId(), - e.getMessage()); - } logger.info("SUCCESS: Completed pending account creation for account ID {}.", request.getAccountId()); responseObserver.onNext(response); diff --git a/src/main/java/biz/nynja/account/services/decomposition/AccountCreator.java b/src/main/java/biz/nynja/account/services/decomposition/AccountCreator.java index 59a3347..1af73ba 100644 --- a/src/main/java/biz/nynja/account/services/decomposition/AccountCreator.java +++ b/src/main/java/biz/nynja/account/services/decomposition/AccountCreator.java @@ -20,6 +20,9 @@ import biz.nynja.account.grpc.CreatePendingAccountRequest; import biz.nynja.account.grpc.CreatePendingAccountResponse; import biz.nynja.account.grpc.ErrorResponse; import biz.nynja.account.grpc.ErrorResponse.Cause; +import biz.nynja.account.kafka.Constants; +import biz.nynja.account.kafka.UserEventsMessageTemplate; +import biz.nynja.account.kafka.UserEventsProducer; import biz.nynja.account.grpc.Role; import biz.nynja.account.models.Account; import biz.nynja.account.models.AuthenticationProvider; @@ -38,12 +41,15 @@ public class AccountCreator { private final PendingAccountRepository pendingAccountRepository; private final AccountRepositoryAdditional accountRepositoryAdditional; private final PhoneNumberNormalizer phoneNumberNormalizer; + private final UserEventsProducer userEventsProducer; public AccountCreator(PendingAccountRepository pendingAccountRepository, - AccountRepositoryAdditional accountRepositoryAdditional, PhoneNumberNormalizer phoneNumberNormalizer) { + AccountRepositoryAdditional accountRepositoryAdditional, PhoneNumberNormalizer phoneNumberNormalizer, + UserEventsProducer userEventsProducer) { this.pendingAccountRepository = pendingAccountRepository; this.accountRepositoryAdditional = accountRepositoryAdditional; this.phoneNumberNormalizer = phoneNumberNormalizer; + this.userEventsProducer = userEventsProducer; } /** @@ -159,6 +165,8 @@ public class AccountCreator { logger.debug("Account \"{}\" saved into the DB", createdAccount); AccountDetails details = createdAccount.toProto(); logger.debug("Account: \"{}\" created successfully.", response); + logger.debug("Send event for new account to Kafka."); + sendEventToKafka(details.getAccountId()); return AccountResponse.newBuilder().setAccountDetails(details).build(); } } @@ -191,4 +199,14 @@ public class AccountCreator { logger.error(logMessage, logValue); return newBuilder.setError(ErrorResponse.newBuilder().setCause(cause).setMessage(errorMessage)).build(); } + + private void sendEventToKafka(String accountId) { + // send event for new user to Kafka + try { + userEventsProducer.sendKafkaMessage(new UserEventsMessageTemplate(accountId, Constants.EventType.SIGN_UP, "")); + }catch (Exception e) { + logger.error("Error sending event to Kafka for account id {}", accountId); + logger.debug("Error sending event to Kafka for account id {}, {}", accountId, e.getMessage()); + } + } } -- GitLab From f1c73703e87bb62cd4c17f9a2aeb539dfd67490a Mon Sep 17 00:00:00 2001 From: Bogdan Alov Date: Fri, 26 Jul 2019 17:16:46 +0300 Subject: [PATCH 05/16] adding exposeHeaders --- charts/account-service/Chart.yaml | 2 +- charts/account-service/values.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/account-service/Chart.yaml b/charts/account-service/Chart.yaml index 5f041fe..0d67982 100644 --- a/charts/account-service/Chart.yaml +++ b/charts/account-service/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v1 appVersion: "1.0" description: Deployment of the nynja account service. name: account-service -version: 0.1.8 +version: 0.1.9 diff --git a/charts/account-service/values.yaml b/charts/account-service/values.yaml index 9428e11..d1f4d33 100644 --- a/charts/account-service/values.yaml +++ b/charts/account-service/values.yaml @@ -34,5 +34,6 @@ corsPolicy: allowMethods: allowCredentials: allowHeaders: + exposeHeaders: maxAge: -- GitLab From d0afb4f6a5a6ac258482a197d3f5b665e5e7f615 Mon Sep 17 00:00:00 2001 From: Bogdan Alov Date: Fri, 26 Jul 2019 22:06:40 +0300 Subject: [PATCH 06/16] Update account-service.yaml --- releases/dev/account-service.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releases/dev/account-service.yaml b/releases/dev/account-service.yaml index 4ef7c81..f4f5e74 100644 --- a/releases/dev/account-service.yaml +++ b/releases/dev/account-service.yaml @@ -8,7 +8,7 @@ spec: chart: repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ name: account-service - version: 0.1.8 + version: 0.1.9 values: replicaCount: 1 -- GitLab From 242ccfd7106fd20c56de0c536db8d85196e82715 Mon Sep 17 00:00:00 2001 From: Stoyan Tzenkov Date: Wed, 31 Jul 2019 14:03:36 +0300 Subject: [PATCH 07/16] DEF001: Shut down the channel after checking health status. Signed-off-by: Stoyan Tzenkov --- .../account/healthindicators/GrpcServerHealthIndicator.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/biz/nynja/account/healthindicators/GrpcServerHealthIndicator.java b/src/main/java/biz/nynja/account/healthindicators/GrpcServerHealthIndicator.java index a7c9dcf..6cb54b6 100644 --- a/src/main/java/biz/nynja/account/healthindicators/GrpcServerHealthIndicator.java +++ b/src/main/java/biz/nynja/account/healthindicators/GrpcServerHealthIndicator.java @@ -47,6 +47,8 @@ public class GrpcServerHealthIndicator implements HealthIndicator { AccountServiceGrpc.getServiceDescriptor().getName(), e.getMessage()); LOGGER.debug(null, e.getCause()); return Health.down().build(); + } finally { + channel.shutdown(); } switch (servingStatus) { -- GitLab From 6c6ab7954961cf6d82af3a6ac1598cf9bc32a21a Mon Sep 17 00:00:00 2001 From: Stoyan Tzenkov Date: Wed, 31 Jul 2019 14:09:33 +0300 Subject: [PATCH 08/16] Check if channel is not null. Signed-off-by: Stoyan Tzenkov --- .../account/healthindicators/GrpcServerHealthIndicator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/biz/nynja/account/healthindicators/GrpcServerHealthIndicator.java b/src/main/java/biz/nynja/account/healthindicators/GrpcServerHealthIndicator.java index 6cb54b6..d8a157a 100644 --- a/src/main/java/biz/nynja/account/healthindicators/GrpcServerHealthIndicator.java +++ b/src/main/java/biz/nynja/account/healthindicators/GrpcServerHealthIndicator.java @@ -48,7 +48,9 @@ public class GrpcServerHealthIndicator implements HealthIndicator { LOGGER.debug(null, e.getCause()); return Health.down().build(); } finally { - channel.shutdown(); + if (channel != null) { + channel.shutdown(); + } } switch (servingStatus) { -- GitLab From ae38a02512e5131933a3978f5cf480765a71b898 Mon Sep 17 00:00:00 2001 From: Bogdan Alov Date: Wed, 31 Jul 2019 14:13:47 +0300 Subject: [PATCH 09/16] updating chart version for the account service --- charts/account-service/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/account-service/Chart.yaml b/charts/account-service/Chart.yaml index 0d67982..ae0266d 100644 --- a/charts/account-service/Chart.yaml +++ b/charts/account-service/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v1 appVersion: "1.0" description: Deployment of the nynja account service. name: account-service -version: 0.1.9 +version: 0.2.0 -- GitLab From f28caa7db154cada821e3454fcfbe85be1491bd4 Mon Sep 17 00:00:00 2001 From: Bogdan Alov Date: Wed, 31 Jul 2019 15:47:08 +0300 Subject: [PATCH 10/16] updating releases for the account service --- releases/dev/account-service.yaml | 2 +- releases/prod/account-service.yaml | 10 +++++----- releases/staging/account-service.yaml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/releases/dev/account-service.yaml b/releases/dev/account-service.yaml index f4f5e74..a84918e 100644 --- a/releases/dev/account-service.yaml +++ b/releases/dev/account-service.yaml @@ -40,6 +40,7 @@ spec: host: bridge-service.bridge-service.svc.cluster.local port: 6570 + ## CORS policy needs clean up!!! This is temporary solution to allow UI team and others that depend on stable environment to work on staging. ## # CORS policy corsPolicy: allowOrigin: @@ -68,4 +69,3 @@ spec: - grpc-status - status maxAge: "600s" - diff --git a/releases/prod/account-service.yaml b/releases/prod/account-service.yaml index fb3d06f..45b5c16 100644 --- a/releases/prod/account-service.yaml +++ b/releases/prod/account-service.yaml @@ -8,13 +8,13 @@ spec: chart: repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ name: account-service - version: 0.1.8 + version: 0.1.7 values: replicaCount: 2 image: - repository: ${IMAGE_NAME} - tag: ${IMAGE_BUILD_TAG} + repository: eu.gcr.io/nynja-ci-201610/account/account-service + tag: master-25 gateway: selector: @@ -36,7 +36,7 @@ spec: grpc: 6565 bridge: - enabled: false + enabled: true host: bridge-service.bridge-service.svc.cluster.local port: 6570 @@ -68,4 +68,4 @@ spec: - grpc-message - grpc-status - status - maxAge: "600s" + maxAge: "600s" \ No newline at end of file diff --git a/releases/staging/account-service.yaml b/releases/staging/account-service.yaml index c4341b6..93f5a67 100644 --- a/releases/staging/account-service.yaml +++ b/releases/staging/account-service.yaml @@ -68,4 +68,4 @@ spec: - grpc-message - grpc-status - status - maxAge: "600s" + maxAge: "600s" \ No newline at end of file -- GitLab From c206684c3ce34758ad6e4d0436fe76fbfb56e08c Mon Sep 17 00:00:00 2001 From: Bogdan Alov Date: Wed, 31 Jul 2019 15:47:24 +0300 Subject: [PATCH 11/16] updating release for prod --- releases/prod/account-service.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/releases/prod/account-service.yaml b/releases/prod/account-service.yaml index 45b5c16..b403896 100644 --- a/releases/prod/account-service.yaml +++ b/releases/prod/account-service.yaml @@ -13,8 +13,8 @@ spec: replicaCount: 2 image: - repository: eu.gcr.io/nynja-ci-201610/account/account-service - tag: master-25 + repository: ${IMAGE_NAME} + tag: ${IMAGE_BUILD_TAG} gateway: selector: -- GitLab From a34a3de10539be1e5de24ff0535ffce46c3dc42b Mon Sep 17 00:00:00 2001 From: Nicolas Berthet Date: Thu, 1 Aug 2019 11:36:52 +0800 Subject: [PATCH 12/16] Update the dev dns --- releases/dev/account-service.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/releases/dev/account-service.yaml b/releases/dev/account-service.yaml index a84918e..d7af615 100644 --- a/releases/dev/account-service.yaml +++ b/releases/dev/account-service.yaml @@ -20,7 +20,7 @@ spec: selector: - api-gateway.default.svc.cluster.local hosts: - - account.dev-eu.nynja.net + - account.dev.nynja.net resources: limits: @@ -50,11 +50,11 @@ spec: - http://10.191.224.180:3000 - https://localhost:8080 - https://127.0.0.1:8080 - - https://web.dev-eu.nynja.net + - https://web.dev.nynja.net - https://web.staging.nynja.net - https://web.nynja.net - http://10.191.38.1 - - https://admin-console.dev-eu.nynja.net + - https://admin-console.dev.nynja.net allowMethods: - POST - GET -- GitLab From 24f86db5ed13f5d54bb6e3117aca20f347526ca2 Mon Sep 17 00:00:00 2001 From: Bogdan Alov Date: Thu, 1 Aug 2019 11:19:48 +0300 Subject: [PATCH 13/16] Update account-service.yaml --- releases/dev/account-service.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releases/dev/account-service.yaml b/releases/dev/account-service.yaml index d7af615..bef8551 100644 --- a/releases/dev/account-service.yaml +++ b/releases/dev/account-service.yaml @@ -8,7 +8,7 @@ spec: chart: repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ name: account-service - version: 0.1.9 + version: 0.2.0 values: replicaCount: 1 -- GitLab From 9f52e02f5da783dc0d6d4d6287494788425b1d2b Mon Sep 17 00:00:00 2001 From: Bogdan Alov Date: Thu, 1 Aug 2019 11:20:26 +0300 Subject: [PATCH 14/16] Update account-service.yaml --- releases/staging/account-service.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/releases/staging/account-service.yaml b/releases/staging/account-service.yaml index 93f5a67..b76cd23 100644 --- a/releases/staging/account-service.yaml +++ b/releases/staging/account-service.yaml @@ -8,7 +8,7 @@ spec: chart: repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ name: account-service - version: 0.1.9 + version: 0.2.0 values: replicaCount: 2 @@ -50,7 +50,7 @@ spec: - http://10.191.224.180:3000 - https://localhost:8080 - https://127.0.0.1:8080 - - https://web.dev-eu.nynja.net + - https://web.dev.nynja.net - https://web.staging.nynja.net - https://web.nynja.net - http://10.191.38.1 @@ -68,4 +68,4 @@ spec: - grpc-message - grpc-status - status - maxAge: "600s" \ No newline at end of file + maxAge: "600s" -- GitLab From f3fb05684d4d1a385c6cdae7621cff0ca3d3089b Mon Sep 17 00:00:00 2001 From: Bogdan Alov Date: Thu, 1 Aug 2019 11:25:03 +0300 Subject: [PATCH 15/16] Update account-service.yaml --- releases/prod/account-service.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/releases/prod/account-service.yaml b/releases/prod/account-service.yaml index b403896..7ea8ec3 100644 --- a/releases/prod/account-service.yaml +++ b/releases/prod/account-service.yaml @@ -8,7 +8,7 @@ spec: chart: repository: https://nynjagroup.jfrog.io/nynjagroup/helm/ name: account-service - version: 0.1.7 + version: 0.2.0 values: replicaCount: 2 @@ -50,7 +50,7 @@ spec: - http://10.191.224.180:3000 - https://localhost:8080 - https://127.0.0.1:8080 - - https://web.dev-eu.nynja.net + - https://web.dev.nynja.net - https://web.staging.nynja.net - https://web.nynja.net - http://10.191.38.1 @@ -68,4 +68,5 @@ spec: - grpc-message - grpc-status - status - maxAge: "600s" \ No newline at end of file + maxAge: "600s" + -- GitLab From e67ab514c17526522a1c2b45e4ba0124f60d7bc0 Mon Sep 17 00:00:00 2001 From: Bogdan Alov Date: Thu, 1 Aug 2019 11:30:05 +0300 Subject: [PATCH 16/16] Update account-service.yaml --- releases/prod/account-service.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/releases/prod/account-service.yaml b/releases/prod/account-service.yaml index 7ea8ec3..b6b3325 100644 --- a/releases/prod/account-service.yaml +++ b/releases/prod/account-service.yaml @@ -40,21 +40,12 @@ spec: host: bridge-service.bridge-service.svc.cluster.local port: 6570 - ## CORS policy needs clean up!!! This is temporary solution to allow UI team and others that depend on stable environment to work on staging. ## # CORS policy corsPolicy: allowOrigin: - - http://localhost:3000 - - https://localhost - - https://localhost/grpc/ - - http://10.191.224.180:3000 - - https://localhost:8080 - - https://127.0.0.1:8080 - https://web.dev.nynja.net - https://web.staging.nynja.net - https://web.nynja.net - - http://10.191.38.1 - - https://admin-console.dev-eu.nynja.net allowMethods: - POST - GET @@ -69,4 +60,3 @@ spec: - grpc-status - status maxAge: "600s" - -- GitLab