Deploy React website with node.js backend - node.js

I have developed website in react and node.js as intermediary to send and receive response.
Now i want to put this on a machine in lab , so everyone can access it.
Can i Install node on machine in lab and run same setup as on my dev machine and give ip of that server?
I tried searching deployment with node js an react, but everyone using AWS, or some external server after npm build.
How do I deploy my react app on lab machine with out actually copying code?

Two Things before you share your IP and PORT:
Have a process monitor setup in your lab machine, Check out pm2. This will help you run your application in the background,
monitor your application and start your application after restart.
Enable port in your firewall for everyone to use. if your lab system is Ubuntu then allow ufw for the port.
Now you can share your IP:PORT and everyone would be able to access it, provided they all are connected to the same network.

If you want everybody access your server, you can share your private IP with them, so others can access it using
yourip:port

Related

Deploy a node js application on fedora workstation 36

I have a nodejs application that i wanted to deploy on a local server(which is running Fedora 36). I have developed the NodeJS side on another pc,and it works fine when the node is running. But when i copy the node server directory to the fedora serve and run it,it only works on local host. I couldnot access the server even if i'm in the same network.
I'm developing the app for a small locally connected PC and i donot want to use the hosting companies as well as Heroku. Is the it the firewall that is blocking my request to the server? What option do i have to host it locally? Is there a better way?
Your node.js server is running on a port determined at the end of the script usually. Sometimes 3000. but can be anything. The correct way for others to access is as you say...
http://your.network.ip.address:port/
or
example ip
http://192.168.0.3:3000
check your local ip and port where you run this server.
How could others, on a local network, access my NodeJS app while it's running on my machine?

Running docker containers each with socsk5 proxy

Intro:
I have an app, when I run it, it connects to a server and shares its bandwidth, (basically gives out the public IP for the server to use),
Development:
Now I wanted that app to use transparent socks5 proxy for sending and receiving requests. This was possible when I downloaded the app (non containerized version) on ubuntu and configured red-socks and iptables in it, the server the app connected to assumed the app's public IP was the one I mentioned (socks5://user:pass#ip:port) (i own these proxy IPs too)
Requirement:
Next, I wanted to scale it out, so I looked for a docker image of this app, it was available so I downloaded and ran it, it worked fine, but the IP the server received was the non proxy IP (obviously as I have not configured any proxy).
My proposed idea was to run multiple docker containers,
but I still don't know how will I configure a different socks5 proxy for each of these containers.
Can someone advise me on how to go forward with this.
Thank you in advance :D
Edits: I had mentioned I was trying to do what I did with the ubuntu system on a ubuntu docker container, removed that and organized the whole situation.

Make create-react-app available to computers outside of local network

I was hoping to run my react-app and make it accessible to computers outside of my local network. I want someone to be able to type in :3000 (or other secure port) and be able to see my application. Is this possible without using a hosting service like Netlify? Obviously there are security concerns but this is primarily for out of network testing for a video player I'm creating.
Thank you.
Simply run HOST=0.0.0.0 npm run start.
Afterwards open the url from another device on the network.
Find whatever your ip is through ipconfig on cmd in windows and then
for e.g
replace this ip with what your ip is:
192.153.23.10:3000 would work.
Further read : Docs
there is also a great service called Ngrokwhich can assign https secure address to localhost apps. I know how to make it work with express and next js but there would be something for you there too check it out.

Hosting Nodejs app

I am running an app on localhost:3000, and now I am looking to host it using my home network.
I am running on windows machine, I have looked at number of guides but none seem to be complete enough.
Any help is much appreciated.
when you run your app in localhost:3000, you app in that moment is in online , in your private network... if you wanna check your app from outside pc.
you will need this point.
1- check the principal adress pc, the ip
2- you computer, shut down your firewall,, some times block you app.
3- in your second computer, connect in the same wifi, and put adress in a
browser and port, and you will saw you app online
EXAMPLE NO REAL
change ww.example.com by 1.63.21.0:3000
to keep you app, all the time running, when you app is finished, you will need this comand.
forever start app.js
that means, all the time of you computer is turn on, you app will start, to give a service, in this case your app
reference
https://github.com/foreverjs/forever
if you really wanna build a server, and put your pc in the internet world, you will need configurate you modem and buy some adress.. like a host in internet, a domain, hope help you with this message
I'd recommend using a service like Heroku instead of your home network, it has way better uptime, and you only have to worry about the code in your app instead of the networking and system architecture.

how to setup nodejs webapp as service?

I have nodejs installed, npm installed, modules installed, and my app codes. On my dev machine I simply type node app.js in my app folder to start the dev server, but now it's the time to deploy it to a real server I got problem.
Where is the regular folder to place my app codes.
Which user should be use to run my nodejs app. and how to make the user only have permission to execute app codes, and 80, 443, 843 ports.
How to write the service script, and stop server by kill pid?
ports are determined by which port your app listens on. If you have physical access via ssh to a server and have root privileges etc then you can just treat it as a dev server.
I would recommend forever for keeping it running and maybe a writing a balancer to handle multiple node apps at once.
Permission handling has to be done based on connectivity. A user connects to your service and you authenticate it for its permission levels. This is done by hand.
The folder you place it is not very relevant.
If you have say a no.de server you can learn how to use their smart machines. THere are similar guides for say the Amazon EC2.
I recommend Monit with Upstart. You can read about that solution here and here. You can also make a simple load balancer in nginx.

Resources