How to configure Thorntail http port with project-default.yml? - thorntail

I'm using Thorntail 2.3.0.Final, in documentation "5.4.2. Sockets" there is an example of configuring some kind of something:
thorntail:
network:
socket-binding-groups:
standard-sockets:
http:
port: 8081
I thought it starts listening on port 8081, but it persistently continues start listening port 8080
so how to configure port binding properly?

The shortcut way is to use:
thorntail:
http:
port: 8081

Related

Mosquitto WebSocket service is not exposed using docker-compose

i'm running docker-compose.yaml with the configuration for mosquitto:
mosquitto:
image: eclipse-mosquitto
ports:
- 1883:1883
- 9001:9001
volumes:
- ./configuration/mosquitto:/mosquitto/config/
- ./configuration/mosquitto/logs:/var/log/mosquitto
I can see the following log when I run docker-compose:
1653666208: mosquitto version 2.0.14 starting
1653666208: Config loaded from /mosquitto/config/mosquitto.conf.
1653666208: Opening ipv4 listen socket on port 1883.
1653666208: Opening ipv6 listen socket on port 1883.
1653666208: Opening websockets listen socket on port 9001.
I can access the TCP on 1883, But I can't see the WebSocket service running on the server.
I tried the
sudo netstat -lnp| grep 9001
and it didn't return me anything.
What am I missing in the configuration?

yml config about http and https

In application.yml, I need to config https port and http port.
For this, code is as follows in application.properties.
server.port.http=80
server.port.https=443
In application.yml, I tried follwing code for configuration,
but it doesn't work.
code1
server:
port: 443
http: 80
code2
server:
port:
http: 80
port: 443
How do this only with application.yml?
I can do it with collaboration of .properties and .yml.
However, I want to do this with only application.yml.
Solution
I found solution thanks to answer of dariosicily.
I configured https and http port as follows.
server:
port: 443
ports:
https: 443
http: 8080
I need to configure default port of spring boot.
So, I configured default port using server.port=443,
and https and http port using server.ports.
And used them in java as follows.
#Value("${server.ports.http}")
private int serverPortHttp;
#Value("${server.ports.https}")
private int serverPortHttps;
It works really well. Thank you!!!
You can configure both http and https ports creating a dictionary with http and https keys in your application.yml :
server:
port:
http: 8080
https: 443
Then you can access both properties in your java class (or kotlin with an equivalent code) :
#Value("${server.port.http}")
private int httpPort;
#Value("${server.port.https}")
private int httpsPort;

actuator port in >= Spring Boot 2.3.4

Is it still possible to change the actuator port in 2.3.4?
neither management.port nor management.endpoints.port seems to work. Intellij doesn't recognize any of these settings, either.
It is management.server.port. Customizing the Management Server Port
With these settings:
server:
port: 8082
management:
server:
port: 8081
the default app port is 8082 and the actuator data is exposed at 8081

Strange behavior of server.port property in Tomcat

Actually, it is not a problem, but a strange thing I would like to understand. I use SpringBoot2 with embedded Tomcat. And I've added self-signed SSL certificate. This is pretty usual config:
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:keystore.p12
server.ssl.key-store-password=123456
server.ssl.key-alias=tomcat
server.port=8443
And I made a connector, to force http -> https redirect, like in many examples:
private Connector getHttpConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
connector.setPort(8080);
connector.setSecure(false);
connector.setRedirectPort(8443);
return connector;
}
If I would not specify server.port property in my config, I will see the following error:
Description:
The Tomcat connector configured to listen on port 8080 failed to
start. The port may already be in use or the connector may be
misconfigured.
Action:
Verify the connector's configuration, identify and stop any process
that's listening on port 8080, or configure this application to listen
on another port.
But if I will, I will see following:
o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s):
8443 (https) 8080 (http) with context path ''
Why server.port starts to point at https port??? Even sources of springframework.boot.autoconfigure.web.ServerProperties says that it is
/**
* Server HTTP port.
*/
Is it ok, or I've got something strange in my server? Or this is how Conectors works? :) Thank you
By default, the embedded server start on port 8080 if you don't give any value for server.port in the properties file
And you are also specifying connectors port as 8080 (connector.setPort(8080);)
Hence you are getting port conflicts.

Mac port issue with Nginx and Tomcat

Configured Nginx to interact with Tomcat on port 9090 on mac.
This configuration works when querying on localhost. Fails to work when connecting from outside, until firewall is disabled.
I have firewall configuration to something like below for forwarding to port 8080 and 8443
sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to me 80
sudo ipfw add 110 fwd 127.0.0.1,8443 tcp from any to me 443
Request domain.com --> 443 --> nginx on 8443 --> Tomcat 9090
Side note:
domain.com --> 80 --> re-directs to 443 and then to nginx on 8443 --> Tomcat 9090
iOS Firewall IPFW sends everything from 80 to 8080 and 443 to 8443
Nginx is running on 8080 and 8443
Nginx redirects everything from 8080 to 8443. Nginx on 8443 communicates with Tomcat over 9090.
Tomcat is on 9090
Router is configured to allow access on Port 80 and 443,
So the question, what do I need to change on mac to unblock firewall for a successful
response.

Resources