Kibana 4 configuration for production - node.js

I'm trying to deploy Kibana 4 to Azure Websites. I can't use bin/kibanta.bat file since Azure Websites uses start script in package.json to bootstrap application. I tried to update package.json start script to run bin\kibana.js file and environment variables in it. After that Azure starts running Kibana server but I'm getting this error: Uncaught ReferenceError: ZeroClipboard is not defined (http://kibana-site.azurewebsites.net/index.js?_b=5827:89458). Does anyone tried to make Kibana 4 run not using bin\kibana* files? Maybe I have to specify additional environment variables?

The solution is explained here: https://github.com/elastic/kibana/issues/2617
It's a bug that was fixed later.

Related

Google Cloud Run Second Flask Application - requirements.txt issue

I have a google cloud run flask application named "HelloWorld1" already up and running however i need to create a second flask application. I followed the below steps as per documentation:
1- On "Cloud Shell Editor" clicked "<>Cloud Code" --> "New Application" --> "Cloud Run Application Basic Cloud Run Application .."-->"Python (Flask): Cloud Run", provide and new folder and application is created.
2- When i try to run it using "Run on Cloud Run Emulator" i get the following error:
Starting to run the app using configuration 'Cloud Run: Run/Debug Locally' from .vscode/launch.json...
To view more detailed logs, go to Output channel : "Cloud Run: Run/Debug Locally - Detailed"
Dependency check started
Dependency check succeeded
Starting minikube, this may take a while...................................
minikube successfully started
The minikube profile 'cloud-run-dev-internal' has been scheduled to stop automatically after exiting Cloud Code. To disable this on future deployments, set autoStop to false in your launch configuration /home/mian/newapp/.vscode/launch.json
Update initiated
Update failed with error code DEVINIT_REGISTER_BUILD_DEPS
listing files: file pattern [requirements.txt] must match at least one file
Skaffold exited with code 1.
Cleaning up...
Finished clean up.
I tried following:
1- tried to create different type of application e.g django instead of flask however always getting the same error
2- tried to give full path of [requirements.txt] in docker settings, no luck.
Please if someone help me understanding why i am not able to run a second cloud run Flask app due to this error?
It's likely that your Dockerfile references the 'requirements.txt' file, but that file is not in your local directory. So, it gives the error that it's missing:
listing files: file pattern [requirements.txt] must match at least one file

/npm/bin/npm-cli.js: not found on Azure app service - node app

I am trying to deploy the nodejs app to Azure but I am getting the below error.
2021-07-08T10:22:38.234570707Z
/home/site/wwwroot/node_modules/.bin/npm: 1:
/home/site/wwwroot/node_modules/.bin/npm: ../npm/bin/npm-cli.js: not
found
2021-07-08T10:22:38.244796509Z npm info lifecycle express-typescript-starter#0.1.0~start: Failed to exec start script
This is the output I am seeing application logs on Azure.
App Service is the free plan with Node 14 as a runtime environment running on Linux. I have verified all the files, everything looking good.
Even I checked node modules as well. The folder is there but the error-specific file i.e inside node_module npm/bin/npm-cli.js. It is not there.
But it's not on my local as well and there it's working fine.
I am deploying through Github action.

NodeJS Google Vision is unable to detect a Project Id in the current environment

Under Ubuntu environment, NodeJS Google Vision complains:
Error: Unable to detect a Project Id in the current environment.
Even though I already put json credential through
$ export GOOGLE_APPLICATION_CREDENTIALS=/var/credential_google.json"
Please help.
As a quick hack you can try this :
$ GOOGLE_APPLICATION_CREDENTIALS="/var/credential_google.json" node app.js
It's not recommended to use a .json config file locally. I've seen these leak on production servers causing whole platforms to be deleted + the introduce environmental switching and security issues.
Setup Google Cloud CLI.
Now the server will 'look' at the local environment and use that.
If you get the error "Unable to detect a Project Id in the current environment.", it means the auth library cannot find the project default id.
You need to have a base project in Google Cloud set, regardless of environmental variables and project you're running.
Run
gcloud config set project [some-project-id]
Now if you run (node example)
"dev": "NODE_ENV=dev GCP_PROJECT=some-project-id nodemon index.ts",
It will load the project environment. This also allows you to deploy easier with:
"deploy:dev": "y | gcloud app deploy --project some-dev-project app.yaml",
"deploy:prod": "y | gcloud app deploy --project some-prod-project app.yaml"
App engine has security setup automatically with standard environments. With flex you can use one of the manage images Google Provides.
If you are usually a windows user and trying out Ubuntu (like me), the problem is likely with the assumptions that the export command exports variable to all terminal sessions and that you need to open a new terminal to get it to use (as expected in a windows terminal for an environment variable).
The export command doesn't export the variable to another terminal session. So if you export it in a terminal, you use it on the same terminal.
If you would like to export it permanently, then you can try the solution listed here
You can put the path to the JSON credentials directly when instantiating the client, by passing it as an argument.
For example:
const client = new speech.SpeechClient( {keyFilename: "credential_google.json"});
Also, for me setting it in the terminal didn't work.

JAVA_HOME for Logstash

I am trying to setup ELK stack for my Web Services Log Monitoring.
So I have setup all the parts for ELK Stack.
I am facing one issue in Log-stash. When I am running Log-stash, I am facing error, could not load Java binary
Although the simple fix it set the JAVA_HOME in environment variable.
But I don't want to set an environment variable, but what I want to set JAVA_HOME just for Log-stash. I have tried adding in startup.options, but to enable I must run system-install. When I am running system-install, I am facing the same error again.
I have added
export JAVA_HOME=/opt/jre8
then system-install file runs, but still on starting log-stash, I am getting the same error. What should I do to resolve this error?
You can config in startup.options (logstash5.4 version):
Ex:
JAVA_HOME=/.../jdk1.8.0_121
JAVACMD=/.../jdk1.8.0_121/bin/java
Then use root role to start: system-install.
(You can use update-java-alternatives --list to list installed java versions with paths)
You can add this configuration to the file- /etc/sysconfig/logstash, this file is read during startup by logstash.
This is what you should add:
export JAVA_HOME=/opt/jre8

How to set path to Mono so Supervisor knows about it?

I am following this tutorial (Hosting Nancy with Nginx on Ubuntu) with one change. I am using the Spark view engine instead of the built in view engine.
Spark view engine throws an error building any view when the Nancy host is running under supervisor.
System.SystemException: Error running mcs: Cannot find the specified file
at Mono.CSharp.CSharpCodeCompiler.CompileFromFileBatch (System.CodeDom.Compiler.CompilerParameters,string[]) <0x00577>
at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromFileBatch (System.CodeDom.Compiler.CompilerParameters,string[]) <0x00033>
at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile (System.CodeDom.Compiler.CompilerParameters,string[]) <0x0004d>
at Spark.Compiler.BatchCompiler.Compile (bool,string,string[]) <0x007f4>
at Spark.Compiler.CSharp.CSharpViewCompiler.CompileView (System.Collections.Generic.IEnumerable`1>,System.Collections.Generic.IEnumerable`1>) <0x00087>
at Spark.SparkViewEngine.CreateEntryInternal (Spark.SparkViewDescriptor,bool) <0x002af>
at Spark.SparkViewEngine.CreateEntry (Spark.SparkViewDescriptor) <0x0004f>
at Nancy.ViewEngines.Spark.SparkViewEngine/<>c__DisplayClass2.b__1 (Nancy.ViewEngines.ViewLocationResult) <0x00023>
at Nancy.ViewEngines.DefaultViewCache/<>c__DisplayClass1`1.b__0 (Nancy.ViewEngines.ViewLocationResult) <0x00023>
If I run the environment setting script /opt/mono/env.sh and then run my host from the command prompt, the website works.
I think it must be due to my Nancy host not being able to find Mono when running under supervisor.
For reference:
#env.sh
export PATH=/opt/mono/bin:$PATH
export LD_LIBRARY_PATH=/opt/mono/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig:$PKG_CONFIG_PATH
I am using Mono 3.8.0 from here:
http://download.opensuse.org/repositories/home:/tpokorra:/mono/xUbuntu_14.04/
How do I set these paths so that Nancy host can find Mono when running under supervisor?
I needed to set the environment option in my supervisor configuration file.
Here is the setting that worked for the above example.
environment=PATH="/opt/mono/bin:$PATH"

Resources