Google App Engine How to implement Profiling(Stack Tracing)? - node.js

I am using Google App Engine to run my NodeJS app on flexible env, now i wanted to generate FlameGraph but the thing is as App Engine itself handle scaling and deploying of instances now can anyone please tell me how can i generate Flamegraph(NodeJs Profiling) to trace Requests coming on my NodeJs server.
If anyone of you has worked on Google App Engine on any Framework(NodeJs or any other), Can you all please tell me how did you solve this kind of problem on App Engine.
Update -
Why We need to delete the instance after debugging it.

Flame graphs are a visualization of profiled software, allowing the
most frequent code-paths to be identified quickly and accurately.
So FlameGraphs have nothing to do with networking, scaling or deploying to GCP.
Anyhow, FlameGraph is a just a 3rd party tool you can install and run. So the answer is you can make it work same way you would install and run on your local computer.
If you don't know how to use FlameGraph to profile NodeJS, then you should start reading some tutorials, as this site is not for that type of questions. A good one is here: https://nodejs.org/en/blog/uncategorized/profiling-node-js/
UPDATE: How to ssh into app engine flex instance
In google cloud console go to App Engine Flex -> Instances

Related

Do I need a Framework for Deploying a Postgres + Express + React + Node App

I am a new self-taught developer.
I have created a simple full stack app (learning management system) using PERN stack. Now, I want to deploy it to learn the end-to-end process of creating a web app. I have a plan to make incremental improvements in the app and add more functionality to make it usable.
While researching for deployment, I came across various posts that doesn't recommend using create-react-app for production ready React apps. Further, this official article from React recommends using some toolchains for deployment (I think it is another name for Frameworks or set of tools):
https://reactjs.org/docs/create-a-new-react-app.html
Another alternative is to optimize the code using Webpack etc. before deploying it. I am neither familiar with any React Framework nor much aware of performance optimization for PERN apps.
If I have to use a framework, then my existing code may not work. I may have to do complete review of the same to make it suitable for the framework.
What is the best way to deploy my PERN app which I can scale in the future. (I have partially understood the concept of client side and server side rendering. As of now, users have to login to use app. But in the future it will be like the users can see the page (to take advantage of SEO) but need to login in order to interact with the site).
Do I need to learn a framework? (In that case I may have to develop all the code in that framework to maintain compatibility). If this is the case, then I will be glad to know which one?
Or, is there other way to deploy fully-functional PERN apps ready to use by potential customers.
Eagerly looking for some answers as I am completely confused at this point.

Publish Windows service in Microsoft store with NodeJS or Electron

I'm looking for a the golden advice.
I've created an app that listens to websockets over a certain port and then sends commands to a native module (wrapped by NodeJS). now all this is done in NodeJS app. and packed in exe file (with two extra files for the native module ".dll and .napi")
now I want two things:
Run this app as a windows service in the background.
Package it in an installer that should stop the service (if exists), install the new update, then re-run the service. this app will be published in Microsoft store as appx.
I'm new to all of this so I feel lost while trying to know which is the best approach with my little knowledge.
I'm a bit confused between NodeJS and ElectronJS, some people say electron is not the best choice for services, but electron-builder is a great tool for packaging.
Conclusion: I want to publish my app to Microsoft store (already bought a developer account), and to run it as a service (no GUI). and the code is written in JS (node or electron)
Thanks in advance

How to use GCP Runtime Configurator from Node.js?

I'm working on a Node.js application hosted on Google Cloud, using Google Application Engine. The app has a few settings like the following:
const TASK_BATCH_SIZE = 50;
Currently, every time we need to change some settings like that one to do some tests we need to re-deploy the app, and that happens very often. We are looking for some alternatives inside the Google Cloud ecosystem that allows us to configure our running services without needing to re-deploy.
One of the things we found in the docs was Runtime Configurator, which still seems to be a beta product. For Node.js specifically nodejs-rcloadenv is the only client library we found, but doesn't seem to support the Watcher / Waiter concepts described in the Runtime Configurator docs or any other way to subscribe to variable changes in a configuration resource.
Is Runtime Configurator the solution to our problem? Are there any other services inside the Google Cloud ecosystem, or any other library for Node.js that could help us with this?
If you want to update or to make some settings changes in the service, you need to re-delpoy the service.
You can't use Runtime Configurator as it's for Compute Engine and not for App Engine.
You can create a feature request on Google's Public Issue Tracker for your issue ( to update configurations without re-deploying the service).

Google Cloud as server for node.js

I want to create a node.js with express application that can host multiple clients with different domain names.
I have never created such application, so my question is:
If I have a project on my computer and want google (or some other hosting) to run my node application, how do I do it? Do I need to zip the whole project, and transfer it to the host? If not, how do Google know the front-end and back-end code?
If you just want to deploy your code, App Engine is the best option for you.
You can deploy your code there, and Google will manage how many instances will you need. For NodeJS, you can see a quickstart that will show you how to start here. You can deploy different services and map those services with different domain names.
There are examples on App Engine if you are using Express, and a tutorial that will show you how to organize your front-end and back-end in App Engine.

How Do I Set Up The MEAN (Mongo, Express, Angular & Node) stack on Nitrous.IO

I using the upcoming weekend to check two things off of my 2013 project list:
Give Cloud Development A Try
Try ANGULAR.JS
My game plan is to set up the MEAN stack on Nitrous.IO and then use the stack to complete one of the many Angularjs tutorial projects available online.
Questions:
I'd be interested in hearing if anyone has set up the MEAN stack on Nitrous or otherwise or if anyone is aware of any good blog post that go through the process for someone with little to no javascript development experience.
Also, if you have setup a MEAN stack are there any things you would do differently or are there any invaluable resources I should be aware of.
Some Resources I Found Useful:
I've been researching online for the past week and have uncovered some great resources, but it would be great to see what others have found or can suggest. Below are some links to some resources that I have come across that may be helpful to others:
Building Angular Start-up Stack - Toronto Meetup Stream
Egghead.io Offers some great Video tutorials on Angular
Google's Angular site has a wealth of info.
USC Linux User Group Youtube video on MEAN on Amazon AWS
Thanks in advance for any resources, insights or guidance.
Since you are starting on JavaScript I would suggest that you start simple. For example
Build a simple web site with Node.js and Express (no Angular, no Mongo).
Deploy it to the cloud.
Then add Angular and see how the structure changes when you use an MVC framework on the client side (e.g. your backend becomes a plain REST API).
Then, play with Node.js and Mongo probably outside your simple Node/Express/Angular app to get the hand of a NoSQL database and database access from Node.js (the fact that everything is async brings some interesting challenges for beginners)
Then integrate Mongo into your app.
Ok, here's how I successfully set-up the MEAN stack on Nitrous.IO.
First, many thanks to Valeri V. Karpov and his The Code Barbarian blog. In July he had a blog post titled Introduction to the MEAN Stack, Part One: Setting Up Your Tools. I primarily followed his article, only making adjustment dictated by the Nitrous cloud platform.
So here are the steps:
Create A Nitrous Box: Go to the Nitrous site and sign-up for an account. Please note the free account does not provide enough storage to accommodate the full MEAN Stack. You'll need at least a "Start" pricing plan - at $9.99 per month.
Create A Nodejs Box: Once you complete your registration and select a pricing plan, its time to create a Nodejs box. Follow the instructions on the Nitrous site. The box comes preconfigured Nodejs.
Install Mongodb: To install Mongodb on your box, go to the shell prompt and type: parts install mongodb You can confirm the installation was successful by typing parts start mongodb. To stop the mongodb server you type parts stop mongodb.
Confirm your Node & NPM Installations: Type node at the command prompt. You should see a > sign if node is installed correctly. You are now in the node shell. Type control-c to exit the shell. Type NPM at the prompt and you should see some usage information
Install Express: type npm install express -g The -g flag means the package will be installed so you can run it from the terminal. Note, if you are using the free box you will likely encounter errors during the Express installation as a result of you exceeded the allocated storage.
From here on you can follow Valeri's article at Step 4 Creating an ExpressJS application..
Good luck and enjoy.
Use Bitnami https://bitnami.com/stack/mean. I like it a lot, pretty simple and concise. In my case it was for Windows and it was a seamless experience

Resources