I want to integrate Elasticsearch into my NW.js application.
My current idea is to configure a JavaScript file in node-main that uses the Node.js API spawn to start the local Elasticsearch application.
child_process.spawn(
resolve(`./cache/elasticsearch-8.11.4/bin/elasticsearch`),
[],
{stdio: 'inherit', shell: true, uid: process.getuid()}
);
I have a few issues. First, when starting, multiple warning windows pop up (see screenshots below). I don't know how to prevent them from showing.
Second, I want to encrypt Elasticsearch, but both the elasticsearch-reset-password and elasticsearch-setup-passwords commands seem to require interaction with the command line. Is there a way to set the password without interaction, directly to what I need?
Third, I want to limit Elasticsearch's maximum memory usage to 500 MB. I tried modifying -Xms500m/-Xmx500m in jvm.options, but it doesn't seem to have any effect. The memory usage still increases without limit until it reaches around 2 GB. How should I set this value?


Some ideas you could try:
npm install --save concurrently wait-onpackage.json:npm startto run the app locally.dev:webspins up a local web server on port 4175.dev:desktopwill "wait" until it gets a 200 OK response from local host on that port, and then it will automatically run NW.js from the current directorynpm startwill run both of those at the same time, with-kmeaning if either ends, the other is killed. So I can close the window and it will stop the server.mainandnode-mainin yourpackage.json"node-main": "index.js"- runs in the node context before a window is launched"main": "http://localhost:4425"- will open a window pointed to this url"node-remote": "http://localhost:4425"- Gives permission to this url to use Node.js commands from the DOM..jsfile as yourmain"main": "index.js"- This will run a script, but will not create a window. From here you can run whatever Node.js code you want and then launch a new window when ready.