Remote Port Forwarding on OpenShift - openshift

I just saw this blog about hosting Minecraft on OpenShift and I'd like to give it a try.
My only concern is the port forwarding. For the other players that I would invite, setting up a local port forward would be too complex.
How can I forward the ports on the server so that can just enter a simple TLD instead? Is it even possible?
Thanks!

If you want everyone to be able to access the minecraft server it is quite involved, you need everyone to sign up for an openshift account, add their accounts to your domain, and then have everyone do the port forward.
If you don't want to do that, you basically have to run something on another server where you had full access and run the port forward and tie them to publicly available ports.

Related

How to access MySQL database that is on another machine, located in a different locations (NOT LOCAL) with python

I am finished with my project and now I want to put it on my website where people could download it and use it. My project is connected to my MySQL and it works on my machine. On my machine, I can read, and modify my database with python. It obviously, will not work if a person from another country tries to access it. How can I make it so a person from another town, city, or country could access my database and be able to read it?
I tried using SSH but I feel like it only works on a local network.
I have not written a single line of code on this matter because I have no clue how to get started.
I probably know how to read my database on a local network but I have no clue how to access it from anywhere else.
Any help, tips, or solutions would be great and appreciated.
Thank you!
If I'm understanding correctly, you want to run a MySQL server from your home PC and allow others to connect and access data? Well, you would need to make sure the correct port is forwarded in your router and firewall, default is TCP 3306. Then simply provide the user with your current IP address (could change).
Determine the correct MySQL Server port being listened on.
Allow port forwarding on the TCP protocol and the port you determined, default is 3306.
Allow incoming connections on this port from software firewall if any.
Provide the user with your current IP Address, Port, and Database name.
If you set login credentials, make sure the user has this as well.
That's it. The user should be able to connect with the IP Address, Port, Database Name, Username, and Password.

How can I connect a local MySQL database to the IBM Node-Red platform

I am using MySQL workbench on windows, which I want to connect to a Node-Red running on the IBM cloud. Since I don't run them on the same server the host 127.0.0.1 and port 3306 does not seem to work. What permissions should I give?
I'm going to make a LOT of assumptions here, because there really isn't enough information in your question.
First assumption, by "running on IBM" you mean that Node-RED is running on the IBM Cloud hosting service.
The short answer is you can not do what you want.
The longer version is that you probably could actually make this work but doing it is a REALLY bad idea.
Second assumption, you are doing this from home (even if you are doing it from a office location the same problems are likely to apply). This means you are connected to a local LAN using RFC 1918 address range (e.g. 192.168.0.x), this means you are behind a router that is performing NAT (Network Address Translation). This means you are going to need to set up portforwarding on the router so that when traffic arrives at the router it will send it on to your Windows machine. How you do this will depend on your router.
Next problem, your broadband probably doesn't have a static IP address which means it will change every time your connection drops. There are work arounds for this using things like Dynamic DNS. But that's too complicated to get into here.
Assuming you get all of that sorted out you still have the problem that you have now exposed your mysql database to the internet, so you need to make sure you have enabled all the right security measures to prevent people logging in and at best seeing all your data.
There are 2 much better solutions to this
Run Node-RED on the same machine or at least on the same local network as the database.
Use one of IBM Clouds hosted database solutions, these are a lot easier to connect to a IBM Cloud instance of Node-RED.
If you do not want to open ports to your network I recommend using a free MYSQL remote server
A simple website is https://remotemysql.com
Just take the screenshot of the credentials of your database after registration.
Keep in mind if your database is empty it will get deleted after some time.

Express/NodeJS application on Cpanel

Ok so I have an app with a Node/Express API and everything works fine on localhost. I'm trying to figure out how to make everything work on CPanel that's running on Apache. The client side stuff but I am unable to fetch any data from the backed. I've searched and looked, yes, but I'm still quite unsure on how to approach this. Do I have to use a Virtual Host and if so what are the specific steps I need to do?
NodeJS doesn't run on Apache or Nginx. Most you can do in these web servers is to set a reverse proxy.
NodeJS has its own web-server. cPanel won't help you in that regard, since you only need to install NodeJS on your server (you must have SSH access-root), and run it from there. You can daemonize your Node process to keep running installing PM2 or Forever (NPM Packages).
Here's a good answer (search before asking, the issue might be solved by then).
Run node.js on cpanel hosting server
cPanel typically runs Apache or another web server that is shared among all the cPanel/unix accounts. The web server listens on port 80. Depending on the domain name in the requested URL, the web server uses "Virtual Hosting" to figure out which cPanel/unix account should process the request, i.e. in which home directory to find the files to serve and scripts to run. If the URL only contains an IP address, cPanel has to default to one of cPanel accounts.
Ordinarily, without root access, a job run by a cPanel account cannot listen on port 80. Indeed, the available ports might be quite restrictive. If 8080 doesn't work, you might try 60000. To access a running node.js server, you'll need to have the port number it's listening on. Since that is the only job listening on that port on that server, you should be able to point your browser to the domain name of any of the cPanel accounts or even the IP address of the server, adding the port number to the URL. But, it's typical to use the domain name for the cPanel account running the node.js job, e.g. http://cPanelDomainName.com:60000/ .
Of course port 80 is the default for web services, and relatively few users are familiar with optional port numbers in URLs. To make things easier for users, you can use Apache to "reverse proxy" requests on port 80 to the port that the node.js process is listening on. This can be done using Apache's RewriteRule directive in a configuration or .htaccess file. This reverse proxying of requests arguably has other benefits as well, e.g. Apache may be a more secure, reliable and manageable front-end for facing the public Internet.
Unfortunately, this setup for node.js is not endorsed by all web hosting companies. One hosting company that supports it, even on its inexpensive shared hosting offerings, is A2Hosting.com. They also have a clearly written description of the setup process in their Knowledge Base.
Finally, it's worth noting that the developers of cPanel are working on built-in node.js support. "If all of the stars align we might see this land as soon as version 68," i.e. perhaps early 2018.
References
Apache Virtual Hosting -
http://httpd.apache.org/docs/2.4/vhosts/
Apache RewriteRule Directive - http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html
A2Hosting.com Knowledge Base Article on Configuring Node.js - https://www.a2hosting.com/kb/installable-applications/manual-installations/installing-node-js-on-managed-hosting-accounts
cPanel Feature Request Thread for node.js Support - https://features.cpanel.net/topic/nodejs-hosting
Related StackOverflow Questions
How to host a Node.Js application in shared hosting
Why node.js can't run on shared hosting?
Is worth to point out that the NodeJS support hasn't yet come to cPanel (as early 2019)

How to connect a C # system with a MySQL database outside the LAN?

I'd like to know how to connect the client pc in a outside network for example a WAM network, i have my database in my pc and i use this like the server. I know how to connect mysql with another client computer inside the LAN network but i dont know how to do it like the other way.
if you don't understand something make me know.
PD: sorry for my english is my first question on a english forum
Ultimately it works exactly the same way - you need an IP address and a port to connect to your database on. You can either do this by setting up port-forwarding at the firewall on the network with the database server (basically, forward port 3306 to the LAN IP address), or by giving the database server a publicly available static IP and then opening port 3306 in any firewalls. Alternatively, you can set up a VPN to the network with the database server, and connect through this. If done right, the VPN option is much more secure.
However, you should ask yourself why you want to do this. Is your idea to have a client software that directly connects to the database? This is not a great design - it's usually better to have a backend database that is accessed via a frontend API (e.g. a RESTful API or similar). Among other benefits, this can give you much better (finer-grained) access control to the database.
Your MySql server should have a firewall rule to accept outside connection on MySql port (default is 3306). Best setup should allow connection from your clients WAN address only.
Then, your C# connector will be able to connect just the same as in LAN.

How to host and access murmur (mumble server) on OpenShift without port forwarding?

I wanted to experiment with hosting a tiny murmur server, up to a few people.
Using a diy cartridge template, and a static build of murmur.x86, I've been able to start Murmur on the allowed OpenShift IP address.
However, how, if there's any way, would I be able to access the actual murmur server from a client, without requiring SSH > Port Forwarding from mine (and anyone else's who may want to access) local PC?
There is currently no way to expose ports other than 80/443/8000/8443 publicly on OpenShift Online. You are also able to make raw TCP connections to those ports, you can only use http/https/ws/wss. The only way to access the ports that murmur uses is over ssh port forwarding. If you would like to run a murmur server you would need to use a virtual machine that has it's own ip address and all ports exposed.