How to config Apache via command line? - node.js

I'd like to manage servers/virtual-hosts through an interface programmed in node.js. However, I'm struggling to get/set configurations on Apache.
Executing apachectl -S is the only way I've found to do that, but its response is not friendly to use.
Is there any easier way? Something I do that returns a JSON or Array with the configuration?

Related

Forward log to http server

I have a pipeline that I run with nextflow which is a workflow framework.
It has an option of seeing real time logs on the http server.
The command to do this is like so:
nextflow run script.nf --with-weblog http://localhost:8891
But I don't see anything when I open my web browser. I have port forwarded while logging into the ubuntu instance and the python http server seems to work fine.
I will need help in understanding how I can set this up so I can view logs generated by my script on the url provided.
Thanks in advance!
In nextflow you need to be careful with the leading dashes of commandline parameters. Everything starting with two dashes like --input will be forwarded to your workflow/processes (e.g. as params.input) while parameters with a single leading dash like -entry are interpreted as parameters by nextflow.
It might be a typo in your question, but to make this work you have to use -with-weblog <url> (note that I used only a single dash here)
See the corresponding docs for further information on this:
Nextflow is able to send detailed workflow execution metadata and
runtime statistics to a HTTP endpoint. To enable this feature use the
-with-weblog as shown below:
nextflow run <pipeline name> -with-weblog [url]
However, this might not be the only problem you are encountering with your setting. You will have to store or process the webhooks that nextflow sends on the server.
P.S: since this is already an old question, how did you proceed? Have you solved that issue yourself in the meantime or gave up on it?

Is there a way to get telnet session output as part of postman test scripts?

I want to test the Web API of a system which has also a CLI accessible via a telnet connection. The tests must verify that the response given to the API requests matches the output of commands given to the CLI.
The problem is that as far as I know there's no way to initiate a telnet connection from inside a postman script.
What will be the best way to achieve this?
Maybe postman is not the best tool for this job?
What will be the best way to achieve this?
A dedicated script written in NodeJS or any other programming language with or without help of some test framework like Jest \ karma. For sure not Postman.
You can use Postman to run the above mentioned script with pre-request script but it just make the all process much more complicated. Almost any modern script language will give you the option to send http request, no need to use postman.
Maybe postman is not the best tool for this job?
You are right, it's not.

Executing php scripts without opening browser

I want to execute a php file located in my apache server on localhost/remote from Processing. But I want to do it without opening the browser. How can I do this. The php script just adds data to mysql database using values obtained from GET request. Is this possible? Actually I tried using link("/receiver.php?a=1&b=2") but it opens a web page containing the php output.
Ideally such scripts must be generic so that it can be used as utility for both web and bash scripts, in-case you cannot change/modify script, then I would suggest to curl from terminal/bash script to make HTTP request to the given link.
Refer to this solution, as how to make request with CURL.

Logstash Config file at an endpoint

Is there a way to have the logstash config file be served from a HTTP endpoint?
I want to be able to share the configs from say a S3 bucket endpoint...
And just want to have them in one place.
I thought I saw somewhere I could...but cannot find it in the docs-
Thanks
It is little* unsecure to change your configs from web end-point...
But just for sake of curiosity you can do it.
You cant use nginx + php-fpm and from php you can call bash script which will perform all what you want!)
Also you must set appropriate file modes.
Maybe this approach little bit sophisticated - but it possible to achieve your aim.
PS: Anyway it is bad practice. Better use something like CodeDeploy or Jenkins etc.

How can i use tropo module with node.js?

In my application i need to use tropo application with node.js to send,receive message and call and answer phone calls.I saw the documentation but i didn't get any idea.Can anyone help me.
Disclaimer - I have never worked with tropo, but this is how I understand it works:
You write a script that tropo can parse, in most languages, to perform some function.
You link up that script to a number using tropo's web interface.
You / a client phones that number, tropo fetches your script and executes it.
Here is a full walkthrough of how everything above works: https://www.tropo.com/docs/scripting/creating_first_application.htm
NOW, if you want your script to do dynamic things, you need to host it yourself. For this you can use node.js:
You write a script that changes based on time / user data in node.js
You link up the script using tropo's web interface.
When someone calls / texts the number, tropo now fetches the dynamic script from your node.js server.
This node.js api can be used to write scripts on your node server: https://github.com/tropo/tropo-webapi-node, https://www.tropo.com/docs/webapi/new_tropo_web_api_overview.htm
Finally, you might want to dynamically create different scripts for different users and hook them up to individual numbers. At this point you use the REST API to automate the "number hooking up work" you used to have to do manually on tropo's website. You can use any node REST client, like request to do this. Here are the API docs: https://www.tropo.com/docs/rest/rest_api.htm

Resources