IBM Cloud: Access Cloud Foundry from app using API vs CLI? - node.js

I need to create a Node.js program which needs to run cf commands like cf a, cf cs etc.
While searching the web I found this two repos which don't seem official and no longer maintained anymore:
https://github.com/prosociallearnEU/cf-nodejs-client
https://github.com/IBM-Cloud/cf-nodejs-client
My question is, should I use those libraries or I can use a child process to call the cf cli commands (assume that the bin is in the env), what is preferred way?

Do NOT use the Cloud Foundry command line interface (CLI) for interacting with Cloud Foundry from an app. There are well-documented Cloud Foundry APIs for that. The CLI is just a wrapper around those API functions.
The Cloud Foundry API endpoints for IBM Cloud are documented and available for use.

Related

Can I use Firebase Functions Emulator with GCP Cloud Functions

I have a GCP project that uses node.js javascript Google Cloud Functions that are triggered by Pub/Sub topics.
When setting up local testing according to this doc, it seems quite complicated.
Using Firebase PubSub emulator and Firebase Functions emulator seems much easier. Can I just use the Firebase Functions Emulator with my GCP Cloud Functions?
No. You can only use the Firebase emulator with functions written using the firebase-functions node module and deployed with the Firebase CLI. It will not work any other way.
The ease of use is part of the value of using the Firebase tools over the core GCP tools, but you do have to choose to use them, as they are not interchangeable.

Keeping app specific variables when using continuous integration in IBM Cloud

I have an application written in Node.js that I am deploying to the IBM Cloud infrastructure. Everything works great as long as I have the environment variables for the app embedded in my manifest.yml file. This isn't ideal since it keeps these secure values within my GitHub repository.
I use a .env file for my local testing and placing that in my .gitignore is great to ensure that it doesn't roll out to the Git repo, but having to place the values into my manifest really defeats the purpose.
Is there a way to ensure that my environment variables are kept between CI runs that I store on my IBM Cloud apps without resorting to storing them in the manifest?
If you are using Cloud Foundry, then I would recommend to take a look at how Cloud Foundry integrates with services. It allows to bind a service to an app, thereby making the credentials available. If you already have some services, like another database, you can utilize the concept of user-provided service. There is no need to set variables, it is managed by Cloud Foundry.
Those concepts integrate well with the Continuous Delivery service on IBM Cloud.
where you run continuous integration? if you run on IBM Cloud Continuous Delivery you can set Environment Variable and provide access to your job to access it.
you can see the documentation in here.

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

Azure vs Cloud Foundry

I'm new to cloud foundry and would like to do a detailed comparison between Windows Azure and Cloud Foundry. I've searched around a lot but haven't been able to find anything useful. Is there a good post or some material which does a detailed feature wise comparison of the two?
Regards,
Vikram
You're not exactly comparing like for like here. Azure has IaaS type capability as well as PaaS, not only can you push applications to it but you can also deploy VM images too, including Linux.
However, as Cloud Foundry is open source the number of runtimes and frameworks if supports evolves quickly as VMWare openly encourage contributions from the OSS community. Correct me if I am wrong, but in a lot of cases, with Azure, you have to provide the runtime you wish to use where as Cloud Foundry supports them "natively", if that's the correct word?!
Right now, Cloud Foundry supports the following runtimes and frameworks;
Runtimes
java - 1.6.0_24
java7 - 1.7.0_04
node - 0.4.12
node06 - 0.6.8
node08 - 0.8.2
ruby18 - 1.8.7p357
ruby19 - 1.9.2p180
Frameworks
grails
java_web
lift
node
play
rack
rails3
sinatra
spring
standalone
They also provide all the major storage services too, including MySQL, Postgres, RabbitMQ and Redis.
The actual open source project supports a whole lot more too!
I don't know much about Azure. But, I've used Cloudfoundry. Its great for Java deployments. I use VMC from Ruby gem for deployment and its so 3 - 4 step easy way to push your WAR to cloudfoundry server. They also provide neat documentation for configuration and setup. Oh and adding services (like Mongo DB, MySql) are also very simple. Though,sometimes, debugging server related issues are annoying with it. But, overall, its good for me :)
http://docs.cloudfoundry.com/tools/deploying-apps.html
Likewise, I don't know much about Cloud Foundry but I'm using Windows Azure for a couple of client projects and I have to say that I'm now very impressed with the development environment. I'm using the Websites Preview feature with continuous Git deployment via BitBucket. Setting this up is a breeze and allows me to push my changes to BitBucket and have Windows Azure deploy them automatically for me. There's currently no ability to run unit tests as part of the deployment cycle as per other cloud platforms (e.g. AppHarbor) but the feature set for getting up and running with a .NET application and SQL Azure database is now pretty slick. Here's a couple of links:
Deploying an ASP.NET Web Application to a Windows Azure Web Site and SQL Database
Continuous Deployment with Windows Azure Websites and Bitbucket

Resources