How to deploy shield with Kibana on Bluemix - node.js

I am trying to deploy Kibana on Bluemix PaaS. Because Kibana is a Node.js application, it can be deployed as such on Bluemix. All i have to do:
Provide a simple manifest.yml file that details the app name and a couple of other things
Provide a Procfile that has just one line as web: bin/kibana --port=$PORT
Thus, I can run Kibana on Bluemix. Note that this is pushed via Cloud Foundry.
Also, I was able to install the marvel and sense plugins for Kibana.
Now, I installed the shield plugin. This plugin requires an ssl key and an ssl cert file to run. The path to these files must be provided in the kibana.yml file.
After installation, I tested the shield plugin natively and it worked just fine.
Here is the layout of the directory structure:
bin(d)
config(d)
installedPlugins(d)
node_modules(d)
sslFiles(d)
manifest.yml
Procfile
(d) represents directories. The sslFiles folder contains the ssl key and ssl cert files.
Before I could push to Bluemix, I knew that the paths to the SSL files would have to be relative to the app in Bluemix. Thus, in the kibana.yml file, I specified them as:
kibana.ssl.key:app/sslFiles/kibana.key
kibana.ssl.cert:app/sslFiles/kibana.cert
I did this as in Bluemix, I could see the following directory structure:
app(d)
bin(d)
config(d)
installedPlugins(d)
node_modules(d)
sslFiles(d)
manifest.yml
Procfile
Indentation represents containment. So, I pushed it to Bluemi using Cloud Foundry, but now I get a 502 Bad Gateway: Registered endpoint failed to handle the request error. I tried changing the paths to sslFiles/kibana.key but then I got a cannot find path sslFiles/kibana.key staging error.
What is responsible for my 502 error? Is it the path to the sslFiles? If so, how can I properly provide the paths?

Related

NodeJS cPanel Hosting

I set up a NodeJS API on cPanel using the NodeJS setup that is provided. the app starts but none of my endpoints are reachable with 404 pages being displayed.
In the cPanel > metrics > errors I can see the error: Path for NodeJS application is invalid: /home/username/repositories/repo
where username is the cpanel username and repo is the server.
I used the built in git support in cPanel to link to a remote repo via SSH. This part is most likely not the problem since I can see the actual server files referenced in the NodeJS server with the correct path (which is why this error message is so strange.)
The server works fine on localhost so this likely has something to do with cPanel.
I have never hosted a node app on cPanel and I know a VPS would be better but this is what I have to work with for now. There isn't a lot of discussions/forums/docs on this online so I am running out of options.
I would highly appreciate it if someone can tell me what is wrong or guide me in the right direction for where to start looking for the problem.
I solved the problem. When you don't use a git repo you can use a relative path from your home to the place the server is stored. i.e. don't include home/username/ in the path
for git repos you must use the absolute path meaning
home/username/repositories/yourserver
where "username" is your cPanel username and "yourserver" is the name of the folder where your server is located

Only seeing Index of/ at domain even though index.js is present in the pubic_html directory

I've been driving myself a little mad trying to deploy this node.js and express app
I'm hosting on bluehost, so therefor, deploying via cpanel -
Currently:
Git repo cloned and deployed head commit success
Node app registered in app manager and Npm dependencies have been successfully ensured.
I after cd'ing into my repository directory in cpanel terminal I ran
/opt/cpanel/ea-nodejs10/bin/node app.js
and it was confirmed that
Server running at http://127.0.0.1:3000
Then after logging into whm root I ran
curl http://127.0.0.1:3000
And am returned with my index.ejs file , which seems like a good sign.
However, when I go to my domain -- deltadesigns.co
All you can see is :
Index of /
Name Last modified Size Description
DeltaDesigns22/ 2021-02-27 06:23 -
cgi-bin/ 2021-02-19 03:00 -
DeltaDesigns22 is the repo with all of required files and folders, public, views, app.js cpanel.yml etc.
I can't figure out why it's not working, feel like I'm so close but am just missing something! All help is appreciated!

AWS ElasticBeanstalk Amazon Linux 2 .platform folder not copying NGINX conf

I've been moving over to ElasticBeanstalk using Amazon Linux 2 and I'm having a problem overwriting the default nginx.conf file. I'm following the AL2 docs for the reverse proxy.
They say, "To override the Elastic Beanstalk default nginx configuration completely, include a configuration in your source bundle at .platform/nginx/nginx.conf:"
My apps folder structure
When I run my deploy though, I get the error
CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment: Elastic Beanstalk ignored your '.ebextensions/nginx' configuration directory. To include these configuration files, move them to '.platform/nginx'.","timestamp":1598554657,"severity":"WARN"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1598554682,"severity":"ERROR"}]}]}
The main part of the error is
"Elastic Beanstalk ignored your '.ebextensions/nginx' configuration directory. To include these configuration files, move them to '.platform/nginx'.""
Which I'm confused about because this is where I've put the file/folder.
I've tried completely removing the .ebextensions folder and got the same error.
I've tried starting from a completely fresh beanstalk environment and still got that error. I'm not understanding how beanstalk is managing this.
Based on the comments.
The issue was caused by duplicate locations of the nginx config file. This was due to deleting the nginx default path in .ebextensions, while EB re-creating it.
Since this seems as a bug, AWS support ticked was created.

When runing a Node.JS app from WHM/cPanel Application Manager, the Passenger file is missing "PassengerStartupFile" and won't actually run

I've installed Node.JS via cPanel and all the Phusion Passenger files and dependencies. I can run the application manually via SSH. I have created the application in cPanel's Application Manager. However, after the application is "enabled" it's not actually "running" and only results in the Passenger error page. It says it was not able to execute the application.
If I manually inspect the application configuration file in /etc/apache2/conf.d/userdata/ssl/2_4/username/subdomain/application_name.conf I can see it doesn't have an entry for PassengerStartupFile. If I add the line
PassengerStartupFile ./bin/www
and restart the Passenger service, is works and I can access it via the URL. However, if I disable and re-enable the application via cPanel, the conf file is regenerated and that entry is lost.
How can I get cPanel to add the PassengerStartupFile entry, or get Passenger to auto-detect the startup file from the package.json file or environment variables or something?
As a work-around, I've created a second application_name_patch.conf file with the missing configuration line so that it all eventually gets compiled together, but that's kludgy...
Your solution to add a second application_name_patch.conf file next to the appliation_name.conf file is exactly the solution you need as is explained here: How to Install a Node.js Application.
The linked article suggests you use the path /etc/apache2/conf.d/userdata/ssl/2_4/user/domain.nodejs.conf for the custom startup file, but I would recommend you use the path /etc/apache2/conf.d/userdata/ssl/2_4/user/domain/nodejs.conf as this will place the custom configuration in the same directory as the original application conf file.

Azure Node hosting file/folder permissions

I have launched my sails.js app to Azure Node.js shared infrastructure.
App does not lift due to file permission. Seems like grunt tasks cannot create
concatenated files in .tmp directory in the root.
I tried to give write access via FileZilla but it did not worked. When ever I try to hit URL
I see file permissions are getting set into default values.
I also did not see any settings to give Folder permissions at Azure Dashboard.
Is there any workaround on this issue?
Error:
** Grunt :: An error occurred. **
------------------------------------------------------------------------ [31mAborted due to warnings.[39m Running "sails-linker:prodJs"
(sails-linker) task[24m Autoinsert script tags in an html file
[33mWarning: ENOTSUP: operation not supported on socket, scandir
'D:\home\site\wwwroot.tmp\public\concat\production.css' [39m
------------------------------------------------------------------------ Looks like a Grunt error occurred-- Please fix it, then restart
Sails to continue running tasks (e.g. watching for changes in
assets) Or if you're stuck, check out the troubleshooting tips below.
[4mTroubleshooting tips:[24m
*-> Are "grunt" and related grunt task modules installed locally?
Run npm install if you're not sure.
*-> You might have a malformed LESS, SASS, CoffeeScript file, etc.
*-> Or maybe you don't have permissions to access the .tmp
directory?
e.g., D:\home\site\wwwroot\.tmp ?
If you think this might be the case, try running:
sudo chown -R YOUR_COMPUTER_USER_NAME D:\home\site\wwwroot\.tmp
According to the error information below, it seems that the sails app default start up for websocket on the port 1337, but the Azure webapp only enable the ports 80 and 443.
Warning: ENOTSUP: operation not supported on socket
There was an SO thread Deploy sails.js to Windows Azure Website that discuss about deploying the sails app on Azure WebApp.
Hope it helps. Best Regards.

Resources