Email service in Jhipster - spring

I'm new to Jhispter and I created an application using the yeoman generator for Jhipster.
When I logged as an admin to this application to check the Health checks section I noticed that email service is down and the details says this :
com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1
How can I solve this problem ?

You must fill properties in application-dev.yml or application-prod.yml with your real account data (eg gmail account)
mail:
host: localhost
port: 25
username:
password:
Sample file:
https://github.com/jhipster/jhipster-sample-app-token/blob/master/src/main/resources/config/application-dev.yml

Go to application-prod.yml and add config below to fix it.
spring:
mail:
host: smtp.gmail.com
port: 587
user: your gmail address
password: your password
protocol: smtp
tls: true
auth: true
from: spoonatte#gmail.com
properties.mail.smtp:
auth: true
starttls.enable: true
ssl.trust: smtp.gmail.com
OR in application-prod.yml
mail:
host: smtp.gmail.com
port: 587
username: your gmail address
password: your password
protocol: smtp
tls: true
properties.mail.smtp:
auth: true
starttls.enable: true
ssl.trust: smtp.gmail.com
messages:
cache-seconds: 1
thymeleaf:
cache: false

Related

How to set the servers property of openapi with Apache Camel?

I am trying to setup a openapi specification and publish the API with Apache Camel and Spring. I tried using restConfiguration, adding the property in the application.yaml, and using the #OpenApiProperty on the app. Everytime the generated yaml reads:
- servers
- url: ""
platform:
# not used
urlrewrite:
enabled: false
token: ${LOCAL_TOKEN:}
apim:
token_ep: ${x/token}
client:
username: ${apim_client_username:}
password: ${apim_client_password:}
consumerKey: ${apim_client_id:}
consumerSecret: ${apim_client_secret:}
endpointsOrchestrated:
server: myServer
emr-endpoint: xxxxxxxx
triggerName: ${PLATFORM_MODULE_ID}
env: dev
domain: ${PLATFORM_MODULE_DOMAIN}
openapi:
title: My Sample api
version: 1.0.0
camel:
dataformat:
jackson:
auto-discover-object-mapper: true
springboot:
tracing: false
rest:
host: myhost.com
port: 8080
spring:
application:
name: aaa
profiles:
active: ${ENV:local}
server:
servlet:
context-path: /
port: ${TOMCAT_PORT:8080}
host: localhost
# MAX HTTP THREADS
tomcat:
threads:
max: ${MAIN_HTTP_THREADS:200}

Invalid helo name Jhipster

I have set the file application-prod.yml with mail account but it is not working with mail server , it returns error 550 invalid helo name. i want to know where i can set host correctly.
thanks
mail:
host: mail.xxxx.cloud
port: 587
username: register#xxxx.cloud
password: xxxxxxxxxx
protocol: smtp
tls: true
properties.mail.smtp:
auth: true
starttls.enable: true
ssl.trust: mail.xxxx.cloud
...
...
...
mail:
from: register#xxxx.cloud
base-url: https://host.xxxx.cloud/

Problem with unknown ports on Spring Eureka Client registration

Well, a have tried ALL tutorials, ALL answer on Stackoverflow. But I still face the same error:
On Heroku, Eureka Clients are receiving random ports that I don't know where they come from.
And these random ports are different from Heroku Environment variable $PORT. I know that $PORT is the container Dyno port, not the host port xxxxx.herokuapp.com that the out side world can access. Again, I don't know where these ports come from!!!
The link clients in the Eureka Dashboard stay like this:
hdfb2324-8jfw-83ud-dkdf-9ej90jefj201.qwer.dyno.rt.heroku.com:inight-ws-gateway:${RANDOM PORT}
When I click, go to https://inight-ws-gateway.herokuapp.com:${RANDOM PORT}/actuator/info. I take the Timeout because the correct port is 443, Https default.
I have 3 applications, 1 Eureka Server and 2 Eureka Clients (Zuul Gateway and a trivial Rest API).
Every works ok when I run in my localhost, but when I deploy in Heroku, it's happen.
Eureka Server application.yaml:
server:
port: ${PORT}
spring:
application:
name: '#project.artifactId#' # inight-ws-discovery
version: '#project.version#'
eureka:
client:
fetch-registry: false
register-with-eureka: false
management:
endpoints:
enabled-by-default: false
web:
exposure:
include:
- health
- info
endpoint:
health:
enabled: true
info:
enabled: true
Eureka Client (Zuul gateway) application.yaml:
server:
port: ${PORT}
spring:
application:
name: '#project.artifactId#' # inight-ws-gateway
version: '#project.version#'
eureka:
instance:
hostname: ${INIGHT_EUREKA_INSTANCE_HOSTNAME} # inight-ws-gateway.herokuapp.com
client:
enabled: true
fetch-registry: true
register-with-eureka: true
service-url:
defaultZone: ${INIGHT_EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE} # https://inight-ws-discovery.herokuapp.com/eureka/
healthcheck:
enabled: true
zuul:
sensitive-headers:
- Cookie
management:
endpoints:
enabled-by-default: false
web:
exposure:
include:
- health
- info
- routes
endpoint:
health:
enabled: true
info:
enabled: true
routes:
enabled: true
jwt:
config:
privateKey: ${INIGHT_JWT_CONFIG_PRIVATEKEY}
Eureka Client (Rest API) application.yaml:
server:
port: ${PORT}
spring:
application:
name: '#project.artifactId#' # inight-ws-auth
version: '#project.version#'
datasource:
hikari:
schema: inight
jdbc-url: ${INIGHT_DATASOURCE_JDBC_URL}
username: ${INIGHT_DATASOURCE_USERNAME}
password: ${INIGHT_DATASOURCE_PASSWORD}
driver-class-name: ${INIGHT_DATASOURCE_DRIVER_CLASS_NAME}
jpa:
show-sql: ${INIGHT_JPA_SHOW_SQL}
hibernate:
ddl-auto: ${INIGHT_JPA_HIBERNATE_DDL_AUTO}
eureka:
instance:
hostname: ${INIGHT_EUREKA_INSTANCE_HOSTNAME} inight-ws-auth.herokuapp.com
client:
enabled: true
service-url:
defaultZone: ${INIGHT_EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE} https://inight-ws-discovery.herokuapp.com/eureka/
healthcheck:
enabled: true
management:
endpoints:
enabled-by-default: false
web:
exposure:
include:
- health
- info
endpoint:
health:
enabled: true
info:
enabled: true
jwt:
config:
privateKey: ${INIGHT_JWT_CONFIG_PRIVATEKEY}
swagger.basePackage: br.com.bz.inight.auth.controller
my fault!!!!!
I have a couple of microservices on Heroku:
Eureka Server
Zuul Gateway
Some app services
The link on Eureka Server Dashboard, doesn't matter. Whats matter is the https://GATEWAY.herokuapp.com/actuator/routes and the <port enabled="true">80</port> on https://EUREKA_SERVER.herokuapp.com/eureka/apps.
But for this happen (<port enabled="true">80</port> on app services) you MUST ,EXPLICITLY, declare in application.yaml
eureka:
instance:
non-secure-port: 80
hostname: ${EUREKA_CLIENT_INSTANCE_HOSTNAME} # herokuapp_name.herokuapp.com
If you read the documentation, you will see that the property eureka.instance.non-secure-port has the default value 80. I don't know why, but, if you don't declare it, the <port enabled="true">80</port> are not set up on microservices applications on Eureka Server.
Check the tutorial https://blog.heroku.com/managing_your_microservices_on_heroku_with_netflix_s_eureka.
Well, these are my architecture application.yaml:
coffee-eureka-server application.yaml
spring:
application:
name: '#project.artifactId#'
server:
port: ${PORT}
eureka:
instance:
hostname: ${EUREKA_CLIENT_INSTANCE_HOSTNAME} # herokuapp_name.herokuapp.com
client:
fetch-registry: false
register-with-eureka: false
service-url:
defaultZone: ${EUREKA_SERVER_URI}/eureka/ # in this case, same value of eureka.instance.hostname, but with https:// prefix, of course
coffee-zuul-gateway application.yaml
spring:
application:
name: '#project.artifactId#'
server:
port: ${PORT}
eureka:
instance:
hostname: ${EUREKA_CLIENT_INSTANCE_HOSTNAME} # herokuapp_name.herokuapp.com
client:
fetch-registry: true
register-with-eureka: true
service-url:
defaultZone: ${EUREKA_SERVER_URI}/eureka/
management:
endpoints:
enabled-by-default: true
web:
exposure:
include:
- routes
- info
- health
coffee-simple-ms application.yaml
spring:
application:
name: '#project.artifactId#'
server:
port: ${PORT}
eureka:
instance:
non-secure-port: 80 # <<<<<<<<< HERE
hostname: ${EUREKA_CLIENT_INSTANCE_HOSTNAME} # herokuapp_name.herokuapp.com
client:
fetch-registry: true
register-with-eureka: true
service-url:
defaultZone: ${EUREKA_SERVER_URI}/eureka/
When I click, go to https://inight-ws-gateway.herokuapp.com:${RANDOM PORT}/actuator/info. I take the Timeout because the correct port is
443, Https default.
When you are hosting on localhost the link would be: http://localhost:${PORT}/actuator/info
On Heroku this link is: https://inight-ws-gateway.herokuapp.com/actuator/info
The difference:
It is using http secure, https
The port number is "gone"
The hostname inight-ws-gateway.herokuapp.com is automatically translated into a ${IP_ADDRESS}:${PORT}.
You will need to adjust your source code for the https URL generation.
Your web application will run on a port different from the usual http/https port. It does not have to be 80, 8080 or 443. It can be any port. And that port is specified by Heroku through $PORT.

elasticsearch.yml ses email config

Took the config from elastic search documentation, and added it to elastic cloud yml.
xpack.notification.email.account:
ses_account:
smtp:
auth: true
starttls.enable: true
starttls.required: true
host: email-smtp.us-east-1.amazonaws.com
port: 587
user: <username>
password: <password>
giving me the below error:
'xpack.notification.email.account.ses_account.profile': is not allowed

REDMINE on Debian 7 doesn't send mails over Exchange

i'm running Redmine on Debian 7 and try to send mails via Mircosoft Exchange.
My configuration.yml looks like:
default:
email_delivery:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: true
address: <FIREWALLIP or SMTPIP>
port: 25
domain: <MYDOMAIN.local or mydomain.de>
authentication: :login
user_name: "username"
password: "pwd"
I used both the Firewall and smtp ips and various combinations of domains and usernames to try it.
Sending the mail via telnet works with both ips.
Can anyone help?
Thanks.
edit resolved:
works with this configuration:
default:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: <FIREWALLIP>
port: 25
domain: <mydomain.de>
works with this configuration:
default:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: <FIREWALLIP>
port: 25
domain: <MYDOMAIN.local or mydomain.de>
authentication: :login
user_name: "username"
password: "pwd"

Resources