Execute a nodejs script in Google Cloud Platform - node.js

I have a Nodejs script which will fetch data from bigquery and populate some of it in a database (running on Google Cloud Platform).
If the script is fetchdata.js, then running it on server from the command line would be node fetch.js
However, I am not sure how to accomplish this with the Google Cloud Platform.
It seems that I have to deploy this script as a separate service (using Google App engine/ Compute engine) and then call that service externally (using the browser) to execute that piece of code. Am I missing something here?
Earlier I thought this could be accomplished using Google Cloud Functions but even that does not seem to be the correct use case.

Yes, You would need a client to connect to you SQL (database) in order to insert the fetched data and for that you would need to use one of the services (Google Compute Engine or Google App Engine)
In App Engine you can run your NodeJS script and then connect the App Engine instance to Cloud SQL database ( if you are using Google Cloud SQL database )
In Compute Engine, you can run the script and connect the Compute Engine Virtual Machine to the database

Related

How to create integration tests for worker services in Node.js

I have a Node.js app that runs as a worker service in an infinite loop to perform regular tasks.
It connects to two different APIs and a MySQL database.
I created a mock server for both APIs and I have a SQL script to create a ready database image for the desired tests.
So, the idea is to test the App with the actual connections to the database and to the mock server for the APIs.
For a web app, there's Cypress. For an app like this, how is it done?

Is there any possible way to manage IBM virtual cloud instances with Node JS?

I'm not familiar with how cloud integration works but I have been assigned a task to try and find out a documentation on IBM portal which would provide a way to perform some specific actions on virtual cloud servers (virtual machines) instances like create, start, stop, delete, restart, upgrade etc. So far I have had no success in finding out such documentation. Although all of this has been already finalized with api's on Node js with aws ec2, alibaba ecs, azure cloud, google cloud and oracle cloud. Only service we are struggling with is IBM. Before this was done with Terraform service in golang but now we are shifting to node js. Any help would be appreciated.
The available api docs are here: https://cloud.ibm.com/docs?tab=api-docs
javascript APIs are not available. The python, go and raw (curl) APIs for VPC are here: https://cloud.ibm.com/apidocs/vpc. The vpc will include creating "instance"s within a vpc.
Unfortunately javascript is not currently available. You can craft your own based on the curl or use the "ibmcloud is ACTION" command line. All of the command line have json output.

Is it possible to install powershell on a web app hosted by Firebase?

Im hosting a node.js web app with firebase, and i need to run a powershell script. I have installed the node module "node-powershell" which works perfectly locally, however when deployed, it tells me that i need to install powershell (install it in the firebase 'computer'). Is there any way to do this?
Firebase Hosting is a so-called static hosting service. This means it serves the content as is, it does not interpret/execute that content in any way.
So most likely you're using the Cloud Functions integration with Firebase Hosting to run those Node scripts. And that turns this into a question whether Cloud Functions can run Powershell scripts.
I don't immediately seen an answer there, although you could potentially upload the binary yourself if that is available for the platform Cloud Functions runs on (Debian). For an example of this, see Can you call out to FFMPEG in a Firebase Cloud Function

Move Azure CosmosDB to local environment

hope you are doing great!
Right now, we are developing a web app with .NET CORE in dev environment, does mean that our config file is pointing to Azure CosmosDB, and we use Gremlin to manage Graph stuff.
But what we need also, is to make a local environment but we dont know how to have the CosmosDB in our local PC's.
Does anyone know a tool or something to get CosmosDB, with Graph supports and Gremlin working locally?
Thanks.
The Cosmos DB Emulator can be installed locally for local development purposes, however, the emulator does not support the Gremlin API for Graph storage.
While you cannot use Cosmos DB locally, you could install another database that supports the Gremlin API locally for your local Dev environments; such as the Apache Tinkerpop Gremlin Server. If you do this, then you'll want to extra make sure you fully test your code against Cosmos DB Graph API, before deploying to ensure that there aren't any compatibility issues when releasing to Testing, Staging, and eventually Production environments.
There is currently no emulator that will allow you to work with the Gremlin API locally. You're going to have to provision a development instance within Azure, or perhaps one per developer on your team.
The Azure Cosmos DB Emulator now supports graph databases. The management UI doesn't support Gremlin but only SQL but you can use it in your program via Gremlin.
It's described in https://learn.microsoft.com/de-de/azure/cosmos-db/local-emulator?tabs=cli,ssl-netstd21#gremlin-api

How do I create a testing instance of my NodeJS app hosted on Azure Cloud Services?

My client has a Node app running on Azure as a Cloud Service and using an Azure-hosted MS-SQL database. They would like another instance of the app running which they could use for testing changes before deployment to the production site. This instance would also have a separate database so that testing would not interfere with the live database. What is the most straightforward way to set this up?
I think you can either create another cloud service to deploy your testing app, or use the staging slot of the cloud service you are using now. And create another database for test purpose.

Resources