Can't access to cloud9 remotly - cloud9-ide

I have installed Cloud 9 IDE on my server, but I can't access to it remotely.
info - socket.io started
Project root is: .
Trying to start your browser in: http://127.0.0.1:3000
Does Cloud 9 work only on local?

Yes, by default the Cloud9 webserver listens only to the localhost interface, to specify another address, just add the following argument to the command line: -l 0.0.0.0, e.g.
./cloud9.sh -l 0.0.0.0 -w ~/workspace

Related

Cannot connect to Container-optimized-os (running a spring-boot application using docker) using external ip

I have created a Google compute instance with Container-optimized-OS image.
I have configured the firewall to allow http and https.
I am using the docker image with spring boot application which connects to cloudsql. When I use run command on compute engine instance ssh, i.e. (docker run --rm name), the spring boot app is started successfully.
When I try to access the webservices through compute engine instance external ip, it is not working.
I went through a different question, and found that I should try using the sudo wget http://localhost command on the instance cli first and if it is good then everything should be good. But I am getting a connection refused message on 127.0.0.1:80.
I also tried the command to open port from Container optimized OS, I.E.
sudo iptables -w -A INPUT -p tcp --dport 80 -j ACCEPT , nothing is working.
The default port for Spring Boot is 8080 and not 80.
Run this command inside the instance container to see what ports are in LISTENING state:
sudo netstat -tulpn | grep LISTEN
You can redirect port 80 to port 8080 with this command:
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
Note: This iptables command only redirects port 80 to 8080 on network interfaces. This has no effect for localhost or 127.0.0.1.
For Google Compute Engine instances you do not need to enable ports using iptables. This is done via Google VPC firewall rules. You can use both but make sure you understand exactly what you are configuring and the side effects.
Note: Your Spring Boot application needs to listen on 0.0.0.0 and not 127.0.0.1 nor localhost. The last two are internal only addresses. 0.0.0.0 means listen on all network interfaces.
Note: Do not use sudo in front of wget. This is not necessary.
First, confirm what port your springboot application uses - if it's 8080 or 80. This depends on what you have configured inside application.properties file. This port is referred to as ContainerPort in below steps.
Execute docker run <image-name>:<tag>. This will run the image and show container logs on the console. If there is something wrong with your spring-boot app, the logs will show that and the container will shutdown. Press Ctrl+C to stop the container and return to shell.
If there is no error in step 1 run docker run -d -p<HostPort>:<ContainerPort> <image-name>:<tag>. Here HostPort is any free port in your GCP host VM and ContainerPort is the port used by your spring boot application within the container. Option d starts your container in detached mode.
Run docker ps and make sure that the container started in step 2 is running. It may not run if there is an error - for example if the HostPort you specified is already in use.
If step 3 shows that the container is running, execute curl http://localhost:<HostPort>/<End-Point-Path>. Here End-Point-Path is a valid path to a working endpoint within the container. If the endpoint is correct you should see expected result from the spring-boot app in the console.
Navigate to Google Cloud Console -> VPC network -> Firewall rules and add a firewall rule to open HostPort on your GCP VM.
Access your endpoint via the VM's external IP with URL - http://<VM-External-IP>:<HostPort>/<End-Point-Path>
Unless there is an application issue with your spring-boot app these steps should get you going.
I was able to build the correct solution by your help (John Hanley and Cyac).
I am combining both solutions in order to help the next person facing this.
As told by John, by default Spring boot uses port 8080, not 80 and as specified by Cyac you need to specify the port as 80 explicitly in application.properties file using
server.port=80
Make sure you expose the port 80 in docker image
On GCP Contaier optimized OS make sure you have allowed traffic for HTTP and HTTPs
Run command:
sudo iptables -w -A INPUT -p tcp --dport 80 -j ACCEPT
Run docker using:
docker run -p 80:80 SPRING_IMAGE.
Where SPRING_IMAGE is the name of the docker image with spring boot build.
Test by using curl http://localhost/ENDPOINT_NAME , e.g. http://localhost/shops/all

Access a host from within a Docker container on Windows

I use Docker CE for Windows on latest Windows 10 and have built an image with a
script that runs a test against a web server.
(A litmus test suite for a WebDAV server to be exact, but I think the problem
is general.)
I run the web server on a Powershell console:
> wsgidav -p 8080 -H localhost
21:04:19.107 - <13348)> wsgidav INFO : Running WsgiDAV/3.0.0a3 Cheroot/6.4.0 Python/3.6.5
21:04:19.107 - <13348)> wsgidav INFO : Serving on http://localhost:8080 ...
From another Powershell console, I run my script in a Docker container (using FROM alpine).
The script starts and tries to access the endpoint, but does not succeed:
> docker pull mar10/litmus
> docker run --rm -p 8080:8080 mar10/litmus http://gateway.docker.internal:8080
-> running `basic':
0. init.................. FAIL (connection refused by `gateway.docker.internal' port 8080: Operation timed out)
I tried so far
Using the gateway.docker.internal hostname
using -p PORT:PORT
using --net=host
restarting the docker daemon (which interestingly sometimes also was neccessary to
fix timeouts in docker pull)
different IP addresses for the web server (127.0.0.1, localhost, 0.0.0.0, local IP)
Nothing worked so far (although the failure message may be different).
Maybe I just missed a working combination of the above, or any other trick?
FWIW, I was able to solve it by building the container with the --network host option and use a real IP of the client (instead of localhost or 0.0.0.0).
Details here: https://hub.docker.com/r/mar10/docker-litmus/

Jmeter distribtion testting on linux

I am trying do distributed testing on linux server using apache-jmeter 2.9
The default port (1099) is already used(by jboss)
I changed the port as 1097
I start jmeter-server on one machine for now and start test on single machine.
jmeter-server seems to start succesfuly
but when evern i trying to exceute script is shows following error.
[jboss#StagingSvr2 bin]$ ./jmeter -n -t CBL_Load/CBL_Admin_Load.jmx -l
.jtl -R 172.16.0.2
Creating summariser <summary>
Created the tree successfully using CBL_Load/CBL_Admin_Load.jmx
Configuring remote engine for 172.16.0.2
Failure connecting to remote host: 172.16.0.2
java.rmi.ConnectIOException: non-JRMP server at remote endpoint
Failed to configure 172.16.0.2
[![enter image description here][1]][1]No remote engines were started.
I have gone through google but not able to find exact solution that where I am doing blundder!
Make sure nothing is listening at the port 1097 using netstat or nc or telnet. Looking into non-JRMP server at remote endpoint something is present there which is not JMeter RMI endpoint. Try locating a free port using aforementioned tools and bind JMeter slave to it
With regards to bind JMeter slave I would recommend amending your startup command to something like:
./jmeter-server -Dserver_port=xxxx
where xxxx is a free port on your Linux system
Amend your Master startup command to include the port as well like:
./jmeter -R 172.16.0.2:xxxx -n -t CBL_Load/CBL_Admin_Load.jmx -l result.jtl
More information:
JMeter Remote Testing: Using a different port
How to Perform Distributed Testing in JMeter

Accessing remote server service via HTTPS

I have a server(AWS) to which I have ssh access.
There is a service(supervisor) running on this service on port 9001 whose web view can be accessed through 127.0.0.1:9001 had it been a local machine.
But since it is not a local machine, how do I access it?
I got the ip address of the machine using ifconfig | grep inet and then tried accessing it through https://172.11.11.1:9001/
Bit dint work.
When I tried wget https://172.11.11.1:9001/ it shows
Connecting to 172.31.19.8:9001... and hangs there.
I have added the following line in my supervisor conf file.
[inet_http_server]
port = *:9001
Can someone please help me with this?
This is more of a server config question. You'll most likely find your AWS access properties allow connections on post 22, 80 and 443 only. In AWS console you'll need to add a new security access group to allow port 9001 to be accessed.

Amazon EC2 permissions and a simple web server

I just started experiment with EC2 tonight, and got a server running locally. I know it works locally because when I curl http://localhost:8080/hello it outputs hello.
I want to access this from the outside world. I modified my permissions in my security group to allow 8080 access, and then typed in "curl http://ec2-123-45-67-891.compute-1.amazonaws.com:8080/hello" into my local terminal. I got the response "curl: (7) couldn't connect to host".
Do I need to do something differently? (Obviously yes, but what?)
Have you bound your server only to localhost? If so, you'll only be able to connect from localhost.
Check the netstat output for your process with something like:
sudo netstat -ltnp | grep your_server_process
Look for whether your server process is bound to 127.0.0.1:8080 or 0.0.0.0:8080. If the former, then you're only bound to localhost and you need to reconfigure it.
I met the same issue. Try use 0.0.0.0 instead of 127.0.0.1.
You allowed access on 8080, but in your localhost example, it's running on port 80.

Resources