Deploy Node.js on Google app engine, running twice issue - node.js

I wrote a small app server that I want it to keep listening on the change of the firebase database. So I tried to deploy the app on Google app engine, but the code in server ran twice. Then I checked the log of that particular app engine instance. Seems like it ran the app server twice.
App engine's log image:
I couldn't find a way to fix this, help!
Thanks in advance!

The repeated messages typically indicate multiple instances being started. Which can be checked on the Instances page on the Developer Console, where you can also manually stop running instances.
But you also need to check the service scaling settings in your app.yaml file as that's what controls the automatic starting of instances.

If you want to listen to firebase changes you have two options: 1) use firebase queues to make sure that only one instance at the time take actions 2) use cloud functions

Related

React.js - How to deploy client and server independently or together?

I have a react.js website with a backend in Node/express hosted on Azure, right now the project is monolithic, every time I do a change in the front or backend everything is redeployed in production. What I would like to achieve is to be able to deploy the frontend and the backend independently from one another whenever I push a change on github, but also if they are both affected deploy them together to avoid inconsistencies. Do you know some best practices or services to achieve this? Thanks
The git deployment method of Azure app services is simple. However, as long as we modify the file, all deployment commands will be executed and the entire deployment process will start. This cannot be changed.
Based on your description, I probably know that your project is a fusion of front and back ends, without separation of front and back ends. So I guess, you want to use the same app services for the front-end app and the back-end app.
So I suggest that you still separate the front and back ends of the project. This is the mainstream. It is also convenient for later maintenance and expansion. If you just want to use a webapp service, you can use a webapp based on the windows environment, and just use a virtual application. In this way, the update program can be completely separated without any impact.
Note that at present I found that the virtual application does not support the react project and has raised a support ticket to confirm. If have any progress, I will tell you.

Deployed Nodejs service does not work on Azure Web App

I've created two pipelines: build and release for Nodejs app.
Here is the link to nodejs app repo: azure web service
Here is the tasks for build pipeline:
Here is the wwwroot folder structure:
So it is look like all required files are present.
Despite that, I'm constantly receiving:
You do not have permission to view this directory or page
I've tried to add web.config file, but it did not help.
I have front end application on same App service Plan and it works, so it is no way that I have bad service plan.
Do you have any suggestions?
Thanks a lot.
I was able to deploy my service only after using nodejs-docs-hello-world starter.
It is looks like web.config is a required file, btw, still did not find any meaningfull documentation for web.config.
Make sure your azure nodejs env support your js syntax (import from ...), in other case use webpack or typescript.
I'have found App Service Editor very helpful if you want to debug your code errors. See section Output.
I had a problem also with nodejs version, despite the fact I choosed node 12 tls during web app creation, I have noticed that my app used node 6 under the hood. So I changed default nodejs version to 10. See here how to do it
Also, I want to thank #Jason Pan for his help.

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.

Selenium and Azure Web App

I have an app using Selenium's ChromeDriver to click and retrieve a file from a website. I have decided to publish it as an Azure Job, would I still be able to run parts of the code that interface the ChromeDriver?
Also, I prefer not to use PhantomJS as sometimes it throws an error that the element is unclickable.
Many thanks in advance for your help.
Might not be possible on Azure App Service.
From https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#unsupported-frameworks
Unsupported Frameworks
[...]
PhantomJS/Selenium: tries to connect to local address, and also uses GDI+.
If you can convince Selenium to not bind to a socket on 127.0.0.1 and if you're not using stuff that hooks into GDI+ then it MAY work, it's a long shot though.
Try Cloud Services with a Worker Role instead or a VM (IaaS).
I deployed a few functional tests (Phantom) in a Webrole (Cloud Services) and everything went without a hitch. In my particular case i'm calling those tests from the build server over REST.

Resources