Unable to run a application in localhost:8080 - ruby-on-rails

I am running a rails application in AWS cloud9 DEV env, listening on tcp://0.0.0.0:8080. i am able to open app on aws provided url (i.e https://xxxx.xxx.cloud9.us-east-1.amazonaws.com) but unable to open using localhost:8080.
I tried using protocol- tcp, http, https to run localhost:8080, also removed windows firewall defender. but did not work.
When i run the app using localhost, it says this site cant be reached.

The application hosted on the Cloud9 server, is running on a remote machine, not your local one. Localhost, and 127.0.0.1, correspond to your local machine, which I assume is not running this application. Should you run this application on your computer, you should be able to connect to it using localhost.
Moreover, if you are inside that Cloud9 machine, and you connect to it using localhost, you should be able to connect to it.
However, if you are connecting to it from a remote machine (i.e., you local device), you must connect to it using https://xxxx.xxx.cloud9.us-east-1.amazonaws.com

Related

Connection Error in Guacamole: The remote desktop server is currently unavailable. If the problem persists, please notify your system administrator

I am trying to setup up guacamole in a Digital Ocean Droplet (Ubuntu 18.04). I followed the steps provided in https://computingforgeeks.com/install-and-use-guacamole-on-ubuntu/ to setup guacamole and used Postgresql to authenticate guacamole by following the instructions provided in https://guacamole.apache.org/doc/gug/jdbc-auth.html#idm46227496294336.
The installation got over and I am able to access the webpage at http://droplet-ip:8080/guacamole, but when I try to connect to a remote machine over RDP I get a connection error stating 'The remote desktop server is currently unavailable. If the problem persists, please notify your system administrator, or check your system logs.'
I have checked the login credentials of the remote device, it's hostip and RDP port number, everything is correct. I am able to login to the machine through Remote Desktop Connection in Windows. I can also login to the same remote machine with same credentials in a perfectly working guacamole setup in another digitalocean droplet.
I have also tried this by installing guacamole using docker by following instructions provided in https://wiki.networksecuritytoolkit.org/index.php/HowTo_Setup_Guacamole, but still face the same problem. What am I doing wrong? I would be happy if someone could help me solve this problem
I was finally able to figure out why I was not able to connect to a remote device in Guacamole.
My Digital Ocean Linux droplets had freeRDP already installed. But Guacamole Server 1.3.0 works on freeRDP2. I had to make Guacamole send requests through freeRDP2.
I have enabled SFTP in the connection settings. But somehow the OpenSSH was corrupted in the remote machine resulting in connection error. So, I disabled SFTP. I think guacamole tries to establish RDP and SFTP connection in the very beginning, so even if one of the protocols fail, connection cannot be established. I am not proficient with guacamole so not sure with this point.
After resolving these problems, guacamole was able to send connection request to the remote machine. I checked the status using netstat and the status was SYN_SENT, but there was no response from the remote server. The problem was Firewall.
I allowed the ports for RDP in windows firewall, but the remote machine was in a network which had external firewall. I added the Guacamole Server IP in allowed list for NAT forwarding in the firewall device and finally I was able to establish a connection with the remote machine.

Jenkins : Unable to access jenkins in local machine

I'm trying to create a Test automation Pipeline to run my selenium scripts, I installed Jenkins in windows Remote Server 2012. Used following cmd($ java -jar jenkins.war) to start jenkins. It is working fine in Remote server with url:http://localhost:8080/
But when I'm trying to access it outside Remote server(my local machine) it is not working. am getting error message "This site can’t be reached"
My local laptop and Remote server is under the same proxy org network.
Can someone help how to resolve this issue , so that other folks can access it and run jobs when required from their laptops
Thanks in advance
Access Windows Firewall.
Add an inbound rule to allow port 8080 and
try accessing the url from any machine in the network.
you could allow/restrict access to all IPs, range of IPs or allow all. But to nullify the issue and confirm if its an issue with whitelisting IPs, I'd first allow access from all IPs with the wildcard *
for Debugging if its a port whitelisting issue, you could also telnet from the machine that you are trying to access this machine -
try
telnet remote machines IP Port
note: do not use a colon for port input just use a space

Running jupyter notebook from web server on ipad localhost

I'm using Blink on my iPad Pro to SSH to my DigitalOcean Ubuntu web server and run Jupyter Notebook.
I can SSH just fine, and can run Jupyter Notebook fine as well. I get the usual Jupyter Notebook url http://localhost:8888/?token-12345 but when copy-pasting this url in my chrome browser on my iPad, I get he error message 'this site can't be reached'.
Anyone knows how to fix that? Is SSH tunnelling part of the solution? What command(s) should I run?
There are multiple ways to do that:
SSH tunnel / port forwarding. You may need a standalone app to establish a tunnel (this one, for example), and then connect to your server in browser using localhost and mapped port.
Public server. You can make your server accessible publicly (more details here), but beware that you may also need to configure a valid SSL certificate to connect to your server via HTTPS, or otherwise Jupyter's kernel will not be able to connect in any iOS browser. Here is a step-by-step guide on how to configure a self-signed certificate that will work on iPad: https://juno.sh/ssl-self-signed-cert/
Finally, once you get it working in Chrome/Safari, you may consider using an app that I've developed instead of browser, it's called Juno and it's a Jupyter Notebook client for iPad: https://itunes.apple.com/app/juno-jupyter-notebook-client/id1315744137
It does require an in-app purchase to connect to an arbitrary server, but you can launch a bunch of introductory notebooks for free out of the box, without any configuration.

How to access the local machine's serial port data using a Heroku application

I have an existing Ruby on Rails Heroku application. I want to get the serial port data from the COM 1 port in a Windows computer using this application, but since Heroku is a cloud-based platform running on a Linux server, I am unable to get serial port data from the local machine where the Heroku application is running. If I run the standalone Ruby code on that Windows machine, then it works fine and I am able to get my desired data.
I am getting the following error
Unable to open COM1
How do I solve this issue?
The part of code of my Rails application through which I am accessing serial port data is:
port_str = 'COM1' #may be different for you
baud_rate = 2400
data_bits = 8
stop_bits = 1
parity = SerialPort::NONE
sp = SerialPort.new(port_str, baud_rate, data_bits, stop_bits, parity)
i=sp.gets.chomp
puts i
This code is working fine if I run it on that local machine. 'serialport' gem is there on my gemfile.
Rails is a web server technology that runs on a web server. It builds HTML pages that get sent to a client computer and are rendered by the browser.
When you run Rails locally you are mimicing a real web server - localhost is basically running a web server on your local machine. That is why you can cheat and use Ruby code in your Rails app that locally can access the port of your local machine, but once you run your Rails app on a real web server (like in Heroku) you cannot do this, so you have the wrong tool for the job you are trying to do.
Not only that but since Rails is a web technology you have a web application that runs inside the browser and you cannot easily access the port on a client machine from a web browser. More information on that is in "How to read serial port data from JavaScript".
The ONLY reason your Ruby code is able to access the port is because it is not running in the browser when you run on localhost but it is running inside the web server that gets fired up on localhost, so when the app runs on a real web server that Ruby code will try to access the port of the server not any client machine.

How to get a Cordova app running on the device to connect to Node JS server

I have a nodeJS server running on my local machine and a Cordova app (hybrid). I am able to connect and run the app using the iOS simulator, however, it does not connect to the nodeJS server on my local machine when the app is installed on my iPhone.
Can you give some hints on how to resolve this issue
Thanks
If you are on the same local network, you can run ipconfig (if on windows) or ifconfig (if on unix) to find out your local machine IP address on the local network.
For example your address may be 192.168.0.2 and your node app runs on port 8080, in this instance you can use 192.168.0.2:8080 to access your server.
An easier and better way would be to use something like ngrok to create a tunnel to your local machine accessible from the internet.

Resources