TCP server won't work on Openshift NodeJS - node.js

I've used the openshift-cartridge-tcp-endpoint cartridge to try and make a TCP server which I can access from a desktop application.
I've set it up on a scaleable application and I can see the OPENSHIFT_NODEJS_PORT_TCP and OPENSHIFT_NODEJS_PROXY_PORT_TCP values when I list the environment variables using 'export' when ssh'd into my application.
The problem is, when I do 'rhc ssh APP_NAME oo-gear-registry all', no port is listed over which I can access my TCP application and when I try to access the application over the port given by the HTTP server, it does not connect. Do I have to take additional steps to make the port show up and be accessible?

It looks like that cartridge is over 2 years old, and probably doesn't work with the current version of OpenShift Online, as it only exposes port 8080 publicly and uses an HTTP/WS reverse proxy, so only http or web services connections would work. You might try logging an issue with the cartridge's creator here (https://github.com/Filirom1/openshift-cartridge-tcp-endpoint/issues) and ask them if it still works or not.

Related

IIS Apache and Node.JS HTTP all on the same server

I have one windows server already running sharepoint on 80/443 and the site works correctly.
We're trying to add more functionality by installing NodeJS and Apache
I've set apache to listen on 8080 and the default website comes up.
Node is running on 3000 and I can access the explorer that way as well.
My questions come from this. The server has a complete certificate chain installed on it and https://:8080 comes up correctly, but I can't get the node stuff to work on https: Secondly it appears while I have proxy pass set up correctly within my httpd.conf, either something is wrong within that as if I goto the https://:8080 /api/and anything beyond that, I get 503 errors and the page can't be displayed.
I'm unsure what I'm doing incorrectly here as from reading the documentation on proxy module, it seems that everything is setup and configured correctly.
Netstat shows listening on 3000 and 8080 and 80/443 for my SharePoint farm.
I had to configure the ssl settings for the proxypass to use the IP address of the local machine. After doing that I was able to connect correctly.
This allowed for connecting on :3000 via telnet to the localmachine and allowed for explorer to be viewed with https://:8080 the correct way enforcing our certificates.

How do I get acces to server running on Bluemix Paas?

Few days ago I wanted to launch my own Agario server. I assumed not to spend any money on hosting/vps etc. After a long search I found Bluemix PaaS, I put open source Agario clone Ogar (https://github.com/OgarProject/Ogar) in them and server has already started in 1523 port, but when i try to connect to this server via agario site ( connect("ws://appname.eu-gb.mybluemix.net:1523") ) I can't connect. I tried also other ways e.g. prepared agar.io link (agar.io?ip=appname.eu-gb.mybluemix.net), but nothing worked.
Has anyone met similar problem?
Inbound traffic is only on standard HTTP/HTTPS ports 80/443. Bluemix will tell your application what port to listen on with the VCAP_APP_PORT env variable. Inbound requests are then mapped to that port. So, once you bind to the VCAP_APP_PORT port, you should be able to connect to : ws://appname.eu-gb.mybluemix.net

Connecting to websocket server from external network

I'm not sure whether to ask this question on a programming forum or linux administration forum as it involves both programming with web sockets and server admin. Basically I am trying to follow this guide "http://41j.com/blog/2014/12/simple-websocket-example-golang/". I have a centos basic server that has a static IP and I've port forwarded it to ports 22 and 80 (ssh and http). I can compile and run the server app fine, but i cannot connect the client. I'm currently out of ideas since I've never messed with networking before. I read somewhere that html5 websockets go through ports 80 and 443 when given an external IP. What I want is to start the server app on port say something like 1445 and then lets pretend my external IP is 244.214.21.44 and then have client connection string look like 'ws//244.214.21.44:1445/echo'. What am I missing, do I need to install apache or something?
Thanks for reading.

Solr with Jetty on LAMP server - Admin page access issue

I have Solr with its default Jetty that came with example directory installed on Linux server which has apache2 as its web server.
Now, within the same private LAN, when I open a browser and type in http://<ip-address>:8983/solr works ONLY when I do port forwarding otherwise it doesn't work. I am not sure what could be the problem? Please note this installation has been done on a remote server in a hosting environment for production deployment and I am a beginner wrt deployment stuff.
You can use the jetty.host parameter during startup to allow direct access to Jetty.
The -D option of the java command can be used with the followin syntax:
java -Djetty.host=0.0.0.0 -jar start.jar
In this way Jetty can be reached from all the hosts.
However this is not the ideal setup IMHO. I prefere to setup Jetty to listen only on localhost, implementing the client with another frontend server which listen on port 80. If you want to implement the frontend on another server you can use iptables to limit the incoming connection, dropping everything on the 8983 port if the IP is different from the one of your frontend server.
This image depicts my preferred setup for a LAMP stack includin SOLR:

Deploying a TCP server to Heroku

I have a TCP server coded in node.js. I'd like to put it up on Heroku because it's a free service and I don't need anything more than what their free plan offers.
Now, I know very little about the inner workings of Heroku and I'm pretty new to the whole thing so I have a few questions.
Firstly, is it even possible to deploy a TCP (non-web) server? I've read that Heroku doesn't like node.js's net because it doesn't support websockets and that I should use socket.io.
So I've switched my server to socket.io. I think. Because my code more or less looks the same. I've done this as well: https://devcenter.heroku.com/articles/using-socket-io-with-node-js-on-heroku
What do I put in my Procfile instead of "web"? Also, when I tried to deploy what I currently have, the logs said that my application failed to bind to $PORT. What's $PORT? And how do I change it to the port I want?
In fact, if I don't change it, how do I know what it is so my application can connect to this server?
The free tier of Heroku does not support TCP server. Here is the reason.
To save costs and offer free services, Heroku hosts multiple free-tier apps on the same machine. These apps, one of them being yours, share the same IP address. The apps are assigned to different ports.
However, as you probably noticed, when you access your app in a browser, the port is always 80. Hence, to know which app an incoming HTTP request is looking for, the server must be looking into the HTTP headers. (For example, using HOST to find out the app name, then resolve the app name to an internal port number.)
Finally, Heroku decided to hide away the internal ports from the internet. This, along with the fact that TCP connections don't have a HOST field, makes it impossible to host a TCP server with Heroku.
To work around this, use WebSocket.
Appendix: the Research
Testing was done with a free-tier Heroku app, in March 2020.
If you make up a non-existing app name (e.g. https://hr.herokuapp.com), Heroku responds with a page saying "There's nothing here, yet."
If you first manually nslookup an existing app (e.g. https://world-of-blogs.herokuapp.com), then try to use the IP address to access the app, Heroku also responds with a page saying "There's nothing here, yet."
Heroku doesn't support a generic TCP server but you should be able to get the functionality you want with socket.io.
You need to put web in your Procfile. That's what lets Heroku bind an external connection to port 80 to the local port your web traffic will arrive you. You find that port by looking at the environment variable $PORT. More info, with examples, is here: https://devcenter.heroku.com/articles/nodejs

Resources