A Good Explanation of Remotely Debugging NodeJS on EC2 - node.js

I've seen this post, but it's not quite clear to me.
If I want to debug my NodeJS app running on EC2 (ubuntu 12.04) from my laptop - how do I do it?
I'm running the following on EC2
nodemon --debug app.js
And I've got node-inspector installed on EC2.
When I run the ssh command, I get the following:
C:\>ssh -L 5858:127.0.0.1:5858 ubuntu#ubuntu-aws
The authenticity of host 'ubuntu-aws (XXX.XXX.XXX.XXX)' can't be established.
RSA key fingerprint is ...
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ubuntu-aws,XXX.XXX.XXX.XXX' (RSA) to the list of known hosts.
Permission denied (publickey).
First, is that right? I run ssh on my laptop? Then I run node-inspector on EC2? Then I'll be able to connect with Chrome Dev tools from laptop?
And how do I fix that ssh error?

you still have to include your pemfile, like in your example: ssh -i pemfile.key -L 5858:127.0.0.1:5858 ubuntu#ubuntuaws

Related

Kill port on remote server with ssh

I want kill specific port on remote host with below command:
ssh username#remoteip "fuser -k 2323/tcp"
but got fuser: command not found error. I spent hours googling for this but I could not find any possible solution.
Any idea?
my linux distribution: centos
The error message says it all: The command fuser is not available.
You have to install the package psmisc:
yum install psmisc

Error connecting to docker container

I installed a service on a remote Linux computer using docker. I used the following commands
git clone https://github.com/OpenVidu/openvidu-tutorials.git
npm install -g http-server
http-server openvidu-tutorials/openvidu-getaroom/web
docker run -p 4443:4443 --rm -e openvidu.secret=MY_SECRET -e openvidu.publicurl=https://187.84.228.66:4443 openvidu/openvidu-server-kms
But when I try do connect at the first time, I received the follow error menssage:
"ERR_EMPTY_RESPONSE", and sometime "ERR_CONNECTION_CLOSED"
I used the following diagnostic command in Linux computer “docker ps” and received the following response:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
21b0620266cd openvidu/openvidu-server-kms:latest "/usr/bin/supervisor 5 days ago >Up 5 days 8443/tcp, 8888/tcp, 0.0.0.0:4443->4443/tcp, 9091/tcp sick_ritchie
What is wrong? How can I solve this?
I'm not sure sure what causes this, but when I had the same problem (with different http server) I changed listening on particular ip address (which was 127.0.0.1 in my case) to listening on all interfaces - 0.0.0.0.
I mean http server configuration, not Docker configuration.

Cloud foundry SSH not working

I am not able to make SSH working.
I checked that SSH is enable on the Application and Space level.
But when i ran
cf ssh "MY-APP-NAME" i get the following error:
FAILED
Error: SSH session allocation failed: ssh: unexpected packet in response to
channel open: <nil>
I also tried to connect without CLi and using the command
ssh -p 2222 cf:abcdefab-1234-5678-abcd-1234abcd1234/0#ssh.MY-DOMAIN.com
But when i entered the password the server stopped the connection (i used Putty).
I am trying to access with SSH because i need to launch npm install to install the dependencies of my application.
Thank you for your help
There is no need to ssh into an app to install dependencies.
Please have a look at Swisscoms Getting Started Guide for Node.js:
https://docs.developer.swisscom.com/tutorial-nodejs/index.html
The section 'Declare App Dependencies' (https://docs.developer.swisscom.com/tutorial-nodejs/dependencies.html) shows you how you specify the dependencies in a file called 'package.json'. This will then be automatically installed by the nodejs buildpack (https://github.com/cloudfoundry/nodejs-buildpack).

How to enable the Docker Remote API on Windows

I am trying to use the Docker Remote API on a Windows 10 host machine. I am using Chrome's Postman extension to see if I can get results from the docker remote api's endpoints. Here are the endpoints that I've tried:
GET http://192.168.99.100:4243/images/json
GET http://192.168.99.100:2376/images/json
Both returned Connection to server 192.168.99.100 failed (The server is not responding)
After a few searches I found out that the Docker Remote API is not enabled by default on Windows. Most of the guides are for Ubuntu but I have found this particular one for Windows.
These are the steps that I performed on my machine
docker-machine ssh
cd /var/lib/boot2docker
sudo vi profile
Change DOCKER_HOST='H tcp://0.0.0.2376' to DOCKER_HOST='H tcp://0.0.0.2375'
change DOCKER_TLS=auto to DOCKER_TLS=no
export DOCKER_HOST='-H tcp://0.0.0.2375'
export DOCKER_TLS_VERIFY=0
env | grep DOCKER
docker-machine restart
docker-machine env
docker-machine regenerate-certs
After performing the steps above, I did try again the endpoints on Postman but I still get the same result.
Can you perhaps give a little help if I have missed a step? Or am I on track?
Also, to answer some of my queries.
Is the docker remote api port for Windows 2375 and 4243 for Linux?
Is DOCKER_HOST for Windows and DOCKER_OPTS for Linux?
Switch your docker to windows container
Got to C:\ProgramData\Docker\config
in deamon.json file
add "hosts": ["tcp://0.0.0.0:2376", "npipe://"]
restart docker.
give command : docker -H tcp://0.0.0.0:2376 ps
The Remote API is now enabled by default on Windows (see ticket here).
It is reachable at http:\\localhost:2375 indeed (tested it).
I faced the same issue and found a quick solution for this. Just open docker settings and enable "Expose daemon on TCP..." checkbox. Docker will start automatically and the problem should be solved.Please find the image attached for reference
using docker desktop, go to settings and check "Expose daemon on tcp://localhost:2375 without TLS"

PostgreSQL SSH Tunnel to Amazon EC2?

I've created an Amazon EC2 AMI running CentOS Linux 5.5 and PostgreSQL 8.4. I'd like to be able to create an SSH tunnel from my machine to the instance so I can connect to the PostgreSQL database from my development machine (JDBC, Tomcat, etc.) I haven't modified the PostgreSQL configuration at all as of yet. I can successfully SSH into the instance from a command line, and have run the following command to try and create my tunnel:
ssh -N -L2345:<My instance DNS>:5432 -i <keypair> root#<My instance DNS>
I don't receive any errors when initially running this command. However, when I try and use psql to open up a connection on localhost:2345, the connection fails.
Any thoughts as to why this is happening?
The first <My instance DNS> should be localhost. And you probably don't want to/need to ssh as root.

Resources