Node.js Application with MongoDB on Kubernetes Using Helm - node.js

How can we authenticate to a mongodb database which is in azureVM ?
How can i write helm chart for that ?
What are the prerequisites for that ?
Anyone have any idea about this?

The easiest way how to do that and guide you should be a Microsoft tutorial about Node.js application development for Azure Kubernetes Service using Azure Dev Spaces:
https://learn.microsoft.com/en-gb/azure/dev-spaces/get-started-nodejs
There you will get:
1. How to enable Azure Dev Spaces on your AKS
2. How to develop the first Node.js app with sample code
3. How to generate helm chart for Node.js app
4. How to deploy and test it locally
Inside Node.js app you should use the most popular mongodb client which is: https://www.npmjs.com/package/mongodb
Regarding npm package documentation, there is also a lot of online tutorials on how to work with that package:
https://www.guru99.com/node-js-mongodb.html

Related

inject secrets (API keys etc) into node js project

I'm migrating a nodeJS project from GCP to DigitalOcean.
I'm running this nodeJS code on a kubernetes cluster in DigitalOcean. I'm using GitHub Actions to automatically build a docker image and deploy it to my kubernetes cluster. Everything works as expected, but I have a question.
On GCP, I used the secret manager to inject secrets (database credentials, API keys, ...) into my NodeJS project. I am looking for a similar solution on DigitalOcean. I have found SecretHub, it looks interesting but I'm unable to sign up.
I have found this from 1password connect, but it looks like I have to setup a server?
Does anyone know some interesting tool or trick to secure inject secrets into my nodejs code?
Yes, you can check out the Hashi corp vault which is mainly used with Kubernetes as a secret solution to inject the configuration and variables to the deployment of Kubernetes.
It's easy to set up and integrate with Kubernetes.
Hashi corp vault : https://www.hashicorp.com/products/vault
Enterprise version is paid one however you can open-source version which will solve your all needs with UI and login panel, you can use it for Production purpose it's safe, secure, and easy to integrate.
You can run one simple POD(deployment) on the Kubernetes server.
here you can follow the demo with minikube setup: https://learn.hashicorp.com/tutorials/vault/kubernetes-minikube?in=vault/kubernetes

NestJs deployed to Azure Linux Web App wont start

I have spent many days but still can not get this to work.
I have setup a deployment pipeline for NextJS I have the dist folder and I'm also copying the node modules folder etc. The build pipeline works, makes a package which is then deployed to a Azure Linux Web App.
Problem is can not hit the application
I look into the logs and I can see the app has started but for some reason the container fails and the site never works.
I'm pulling my hair out here I have tried everything, read every guide I can find but nothing seems to work. Help me stack-bi-wan-overflow your my only hope.
As you have confirmed in your comment , Converting this to answer to help other community members.
To achieve the above requirement make sure that you have used express instead of using fastify . As fastify must have different network configuration which can not connect with container.
For more information please refer the below links:-
SO THREAD: nestjs to azure windows app service - web.config settings & Angular CLI app not running when deploying to Linux App Service
Blog:- Deploy and run Nest js app to azure

Deploying a Python API to Azure App Services

I have a client with an existing API built in Python 2.7.6. Currently it's Dockerized (Docker v1.16(?)) on some VMs at another host. I have seen several posts about putting Python natively on azure app services but I am no expert at either Docker or Python so I wanted to know a couple things:
Can we natively push Python (2.7.6) to azure app services? or would
we need something like Docker?
This Docker version is (apparently) quite old - is it easy to update
this?
If I needed to Dockerize this what SKU on Azure would I need to
procure? I suspect this would not be a standard S1 web app running
Linux?
Following link explains creation of app services using docker hub image:
https://learn.microsoft.com/en-us/azure/app-service/containers/quickstart-docker-go
More detailed explanation:
https://learn.microsoft.com/en-us/azure/app-service/containers/tutorial-custom-docker-image
You can also use webapp on linux to deploy your python app directly:
https://learn.microsoft.com/en-us/azure/app-service/containers/quickstart-python
If you are using direct deployment, use Webapp for Linux, rather than Webapp for windows. Windows based webapp are mmore suited for dotnet based applications

how to install azure cli on azure web app

I have been using azure cli installed on windows 7 locally. I want to use it on azure web app as well. But I did not find any relevant article to accomplish it. Could anyone let me know how to install az-cli on azure web app windows instance.
Thanks
If you want to create resources from your code you should use the Azure REST API:
https://learn.microsoft.com/en-us/rest/api/azure/
It also has client libraries, you can read more about it on the link.

Azure Bot Service set node.js version not working

Specifying a Node.js version in Azure Bot Service doesn't seem to work.
In Azure portal, navigate to the bot service instance, then in application settings set the environment variable WEBSITE_NODE_DEFAULT_VERSION to 7.7.4, which is the highest version available as of 22/05/2017. However it turns out the node.js runtime is still v6.5.0!
In Kudu -> Environment it shows:
WEBSITE_NODE_DEFAULT_VERSION = 7.7.4
and
Path = D:\home\site\deployments\tools;... D:\Program Files (x86)\nodejs\7.7.4;...
Couldn't find where this v6.5.0 node.js version was set. Maybe in IIS settings? It would be good if azure bot service allows to use customized node.js version rather than the system provided lag version. So is there a fix or work-around? Thanks.
Currently Azure Bot Service (Preview) only supports Node.js v6.5 LTS and does not provide any advanced version configuration options as you described.
Keep in mind that when you create a bot with Azure Bot Service (Preview), you are creating an Azure Functions app (in the background). Azure Functions has their Node.js version locked at v6.5 as described in their documentation.
The node version is currently locked at 6.5.0. We're investigating adding support for more versions and making it configurable.
If you would like to install and run a specific version of Node.js, you will need to setup a VM and configure it to your specifications.
Alternatively, you can deploy your SDK Bot (aka not using Azure Functions) to Azure App Service on Linux (Preview), which will allow you to select a Node.js version in the v6.x LTS range, for example v6.10.2 + npm v3.10.10. In this scenario, you must specify the specific Node.js and npm version in your package.json "engines" section. You can read more about this option in my blog article: Deploying Bot Framework To Azure On Linux
For other people who want to customize their node.js version for their bots, I've found a way: use Azure App Service instead of Azure Bot Service. Here is how:
Create your Azure app from the Azure portal, and choose the node.js template
(optional) Configure Continuous Delivery
Register your app in Bot Framework portal
start Kudu Cmd console
cd D:\home\site\wwwroot
md bin
cd bin
then download the node.js version you like, e.g.
curl -O http://nodejs.org/dist/latest/win-x64/node.exe
Using Kudu, modify D:\home\site\wwwroot\web.config to point to your entry .js file (default is server.js) and add the following line:
<iisnode watchedFiles="web.config;*.js"
nodeProcessCommandLine=""D:\home\site\wwwroot\bin\node.exe""
/>
Following the steps above, you are no longer restricted by the locked node v6.5, and use the latest node.js feature as you wish.

Resources