How do I deploy a node app on Google Compute Engine? - node.js

I followed these steps: https://developers.google.com/deployment-manager/nodejs
But I don't really know where to go from there...how do I actually deploy my node application? Where is the node code? It's not on my machine, I don't think. So, how do I edit it?
I tried connecting to the shell, installing a node app with yo, and serving it to port 9000 with grunt, and then allowing that port with
gcutil --project <project-id> addfirewall http9000 --allowed tcp:9000
and navigating to the address, but it didn't work. However, navigating to 8080, which is what the tutorial said to do gets me Hello World, but I don't know where that code is. Thanks in advance.

Taking look at the star-up script in the vm, I notice that your have this ' DIR=/srv/www FILE=hello.js...', so I found the source at '/srv/www/hello.js'

Related

Deploying Next.js in Jelastic

I have no experience with Next.js and its deployment. Our team has been developing an app in Next.js and I need to deploy it into our Jelastic platform. I am very much familiar with Apache server and haven't used any other servers than that.
I found out that Next.js can't be deployed with Apache (or at least static export is not the best idea). So, I created a Node.js server environment in Jelastic and I have no idea how to make the application accessible. I read the Next.js documentation and it says that the production build files after next build are stored inside .next folder but I didn't find any entry point files (as in Apache) such as index.html in that folder.
I tried running next start and a server was started on localhost on port 3000, but I couldn't access that remotely.
I didn't find much about Next.js deployment in different environments anywhere. I am probably missing several things here, but I am clueless. How do I deploy and run Next.js application in Jelastic?
Basically, port 3000 is not open on the firewall side on the NodeJS nodes that Virtuozzo provides. I think the server would have been accessible if you had opened the corresponding port through the dashboard.
You can test if your application is accessible from the NodeJS node by doing a "curl localhost:3000".
Otherwise, I think the best way to make your application accessible from the outside is to use your NodeJS node as you do, but add a loadbalancer NGinx node in front of it. Change the configuration provided to point to port 3000 and not 80 of your NodeJS node. This should be enough.

How to hot reload on netlify?

Netlify just as example, same question with CloudFlare Pages etc.
In the past I setup my own server with node and react/vue.
I have my node setup on a server because I don't want to install node and node packages on my local machine.
When I was developing I SSH into the server with port forwarding.
So I ran a dev server on port 8888 (npm run dev) on the server and opened http://localhost:8888 in my local browser.
When I make a change to the files I can immediately see the effects without running npm run build.
I am thinking about using a service like netlify because its the right thing to do? But how can I see the changes I make without actually running build?
Is this even possible or do you use theses service only when you are building a website that rarely changes? I am probably missing something. But not sure how to proceed.
I don't know what's the right way. I am very open to suggestions.
Edit: These services that I mentioned are meant for build only. See answer below. I am still leaving this question so people can post suggestions.
You cannot do this. Those services are only for hosting the build version of your app. You have to develop it locally and push the build to these services.
Why would you even want to run a development version online?

Docker vs node.js

I'm fairly new to React-native. Im sorry about quite a convoluted question but I have dilemma. I am building an API that communicates with a server app that Im working on, I have been using Docker successfully to run containers BUT I'm constantly being told that I don't need to run Docker at all. I understand the principles of Docker and Node.JS but in all honesty I cant imagine how I would run server side without Docker. Ive tried Node.js and seemed to require a PHP server, which I was also told I did not need. Is this true? which is better Docker or Node.JS? and If Node JS is better how to run it without a php server as it is my understanding that php serves the pages and React consumes the pages.
'You can just install Node, frequently through your OS's package manager. It doesn't require PHP or other language interpreters. I find working directly with Node much easier than using Node in Docker: it is actually a local development environment that my IDE is comfortable with, and not a path to run a Node interpreter "somewhere else" that's isolated from my desktop tooling. '
1)After a few weeks of research I found that I didn't need docker at all. Within Node is the ability to run a server using either fastify or express. I just needed to check on the relevant documentation for usage
2) I linked fastify to ngrok and exposed my local IP address to a public facing direction
3) I linked the ngrock url to my freedns and voila! it worked!
4) I had a small problem with the port which was resolved by using
the command ngrok http 127.0.0.1:5000

How to host a React App on Standalone Server

I have a stand alone server that will only be connected to a lan without outside internet access. I am new to hosting so I am lost as to what to use and how to do it.
I have run my react app using npm start. But how do I configure node to start up a react app when the stand alone server starts?
Is there some other windows based host that is easier to configure to run a React app?
I would probably use a Linux server distribution to achieve this. Quite easy actually but not sure how to do that on a Windows machine, unfortunately. You can simply Google for "How To Setup A Web Server And Host Website" I am sure there are a lot of guides and tutorials

Meteor app deployment on LAMP server

I'm struggling with meteor app deployment:
I have VDS with 10 websites running on RedHat OS + Apache, MySQL, PHP.
I want install Meteor app there on specific port. It is possible?
Already installed NodeJS, MongoDB... But cant deploy simple "todo" Meteor app for example. After installing Meteor faced problem with comand:
meteor: command not found
I know about MUP and other staff, but how I can do it manually?
You should use meteor up - https://github.com/kadirahq/meteor-up.
I haven't done this on apache, I use nginx instead. However, what you're basically doing is a port forward / proxy. The idea is that you will get your site up and running at 00.00.00.00:3000 or domain.com:3000
From there you will create a virtual host that grabs all traffic going to that port and removes the port for viewing. For an example of that please see this answer.
Again, I typically use nginx for this because it's easier and because nginx does a much better job of serving static assets which your meteor app will need. I've written up a blog post on how to do this step by step. Check that out here.. You can really use this blog post to do your entire set up, just replace the nginx part with apache.

Resources