Spring Boot App deployed on Azure App Service port 8080 - linux

I'm trying to deploy a Spring Boot Rest Api (Gradle) to an Azure app service. There is an executable jar in the /home/site/wwwroot folder and a startup command (java -jar /home/site/wwwroot/app.jar). When I execute this script, the spring api starts but throws the following error: "The Tomcat connector configured to listen on port 80 failed to start. The port may already be in use or the connector may be misconfigured."
I can't run the app on another port because the Azure App Service only allows inbound HTTP traffic on port 80 and 443 for SSL. I tried killing the process that is running on port 80 but that kills my ssh terminal.
Is there a solution to 'clear' the proces running on port 80 and actually run my Spring application on it?

"The Tomcat connector configured to listen on port 80 failed to start.The port may already be in use or the connector may be misconfigured."
The error is because another process is running on the same port. To solve this, you have two options.
Try to run the application on a port other than 8080.
Identify and stop the process running on that specific port.
Check this post on how to change the default tomcat port number.
See: how the spring boot configuration works.
Check this blog and SO thread might be helpful. Tomcat Server Error - Port 8080 already in use

Related

Running Logux on Google Cloud Run doesn't find the running port

While trying to get Logux running in Cloud Run, I get this error:
Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable.
Even though the server is running an the Dockerfile is exposing the correct port (which is mapped in Cloud run as well).
The Dockerfile is located here: https://github.com/knownasilya/battle-chess/blob/main/Dockerfile
Note that the server runs https and ws on port 31337.
As mentioned by the Cloud Run Troubleshooting docs, if we get the message:
Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable.
And we know our code/container is working as expected, we should check that the port that that Cloud Run will be checking correlates with the one used in our app and like in this case, that the container listens on 0.0.0.0 (all the net interfaces)
As well this is mentioned in the Cloud Run Requirements doc:
The container must listen for requests on 0.0.0.0 on the port to which requests are sent. By default, requests are sent to 8080, but you can configure Cloud Run to send requests to the port of your choice. Cloud Run injects the PORT environment variable into the container. Inside Cloud Run container instances, the value of the PORT environment variable always reflects the port to which requests are sent. It defaults to 8080.

Access NodeJS server installed on Linux server

I created my App from this boilerplate
https://github.com/Bikranshu/express-react-boilerplate
Now I uploaded it to a live Linux server and Node server is running.
Screenshot of running server
But I am unable to access it through Browser with IP address of server.
http://ip_address:3000
After waiting long in browser it is showing timeout error.
Please guide me how can I access the node/react app from browser.
Server running at <ipaddress> is a local IP, are you in a different network than the server? If so, you should be typing https://<public ipaddress>:3000
UPDATE
Hosting services usually only forward port 80 (http) or 443 (https.) This means that your port 3000 is not allowed for public access. To fix your problem you need to change the listening port.
Check line 42 on
server/app.js change 'port' to "80" or check package.json and edit npm start to set port to 80

Don't see nodeJs serveur port working / same port client/server don't cause error

I have an application which work with React/socket/nodeJS on a VPS.
This VPS use apache as php engine and when I check the config, it listens the port 7080.
My nodeJS work on any port 80 / 3000 / 7080 etc... and when I use netstat on my console VPS I don't see this <IP:SERVERPORT>.
Here is the problem I face:
1. Why I can't see my server PORT running on my VPS with netstats? ( I see console log from my server so he work)
2. Why it work with the same apache port? Normally I have to use a server port different from the client...
For information, my vps is dedibox (online.net with plesk).

Boot Spring Application failed on sub user

Whenever I try to run my spring boot application, my Linux machine returns me the following issue:
org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-80]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:225) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23][...](LifecycleBase.java:150) ~[tomcat-embed-core-8.5.23.jar!/:8.5.23]
... 21 common frames omitted
Caused by: java.net.SocketException: Permission denied[...]
The Tomcat connector configured to listen on port 80 failed to start.
The port may already be in use or the connector may be misconfigured.
Hope someone can help me.
I'm guessing you're on Ubuntu. Ports under 1024 can only be opened by root so as a normal unprivileged user you can't run your app on port 80. Why not use another port using server.port property?
As clearly mentioned the port is already in use. Configure spring boot to use some other port.
As said in docs either set server.port as system property using command line option to jvm --server.port=8090 or add application.properties in /src/main/resources/ with
server.port = 8090
For random port use
server.port=0
Run it as root, if Ubuntu or Debian use Sudo your_command. Because ports under 1024 can be used just by root.

Remote debugging NodeJS Container on AWS

Running a NodeJS Docker Container on an EC2 instance, I'm trying to remote debug it, but keep getting "connection refused" from the instance.
What I've tried -
Opening ports in EC2 security groups
Exposing ports in Dockerfile, both the port the app is listening on and the debug port
Forwarding the port within the Docker run command using the -p flag
Making sure the app is accessible directly through the port it's configured to listen to
After trying all of these, the debug port is still inaccessible by the remote debugger or even telnet.
Any ideas what could cause this?

Resources