How to call WebServices in Puppet manifests? - puppet

We need to invoke an external webservice via Puppet. The steps provided to me consist of invoking webservices using curl command. Is there anyway to invoke webservices natively via Puppet instead of calling curl commands instead ?
The curl example is provided below
curl -k -v –H "Content-Type:application/json" –-data some_data_file https://service.server.com/some_service

Related

AWS Lambda Docker Image: How do you automatically run handler after starting container?

For reference, I am trying to run a lambda handler inside a docker container locally on my machine.
I have been using this guide from AWS and can complete all the steps outlined successfully. To test the function locally they provide these steps:
Run your image locally:
docker run -p 9000:8080 <image name>
In a separate terminal, you can then locally invoke the function using cURL:
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"hello world!"}'
This works, but I am trying to do this process programmatically through a script, so I've been wondering:
Is there a way to automatically invoke the handler after starting the container and having it close immediately after, rather than needing to invoke it manually with cURL?
What tells the container to invoke the handler after it receives a POST request? Any insight into this would be much appreciated.

What all POST Rest API commands we can execute inside a azure container instance

I have build a docker linux image which includes azure cli, kubectl and terraform installation. I have pushed the image to azure container registry and created a container instance manually with that image. My container is running successfully and I am able to connect to it from the azure portal.
But my requirement is, I have to run some Rest API commands which is provided by the microsoft to perform certain action on the container. I have followed below microsoft documentation for executing the rest api command.
Link: https://learn.microsoft.com/en-us/rest/api/container-instances/containers/execute-command#code-try-0
I just provided my container details and added body as below:
{
"command": "/bin/bash",
"terminalSize": {
"rows": 12,
"cols": 12
}
}
I have received 200 response after running the above command. But when I tried running some different commands I am getting the 200 response but output is not changing. Can someone please share the information like what commands I can execute in azure container instance through the rest api.
Actually, this REST API is for the exec command that executes the bash command in the container. So it will create a socket session to communicate with the container, the returns are the socket session and the password.
And for the exec command, also for this REST API, it only can execute the single command, like ls, /bin/bash. But if you want to execute multiple commands like ls -al or curl $url, then it will fail. Actually, ACI does not support running multiple commands through the REST API or the exec command. The solution is you use the Azure CLI command az container exec to run the bash command /bin/bash, it will create a socket session for you, like an SSH connection. Then you can run commands inside the container. Here is the screenshot:

How to backup & restore spinnaker pipelines

I am new to & trying to use spinnaker for the client I am working with. I am somewhat familiar with spinnaker architecture.
I know FRONT50 micro-service is responsible for this task. I am not sure how I can safely backup the pipeline data and restore into a new instance.
I want that to be able to continuously back up these pipelines as they are being added so that when I happen to recreate the spinnaker instance(i.e destroy my the infra and then recreate from scratch) I am able to restore these.
I am currently using Azure as the cloud provider and using Azure Container service.
I found this page here : https://www.spinnaker.io/setup/install/backups/
but does not indicate if the pipelines will also be backed up.
Many thanks in advance
I am not sure about the standard method but you can copy the configurations for pipelines and applicatons from front50 manually.
For pipelines, just do a curl to http://<front50-IP>:8080/pipelines
curl http://<front50-IP>:8080/pipelines -o pipelines.json
For applications config:
curl http://<front50-IP>:8080/v2/applications -o applications.json
To push pipeline config to Spinnaker, you can do:
cat pipelines.json | curl -d#- -X POST \
--header "Content-Type: application/json" --header \
"Accept: /" http://<Front50_URL>:8080/pipelines
P.S: My Spinnaker version is 1.8.1 and both, v1 and v2, k8s providers are supported.
Update-2: If you are using AWS S3 or GCS, you can back up the buckets directly.

How do we know when Heritrix completes a crawl job?

In our application, Heritrix is being used as the crawl engine and once the crawl job is finished, we are manually kicking off an endpoint to download the PDFs from a website. We would like to automate this downloading pdf task as soon as the crawl job is complete. Does HEritrix provide any URI/webservice method - which returns the status of the job? (or) Do we need to create a polling app to continuously monitor the status of the job?
I don't know if there is any option to do it without continious monitoring but you can use Heritrix API to get status for a job, smth like
curl -v -d "action=" -k -u admin:admin --anyauth --location -H "Accept: application/xml" https://localhost:8443/engine/job/myjob
gives you XML from where you can read job status.
Another, maybe easier (yet not so 'professional') option is to check if your jobs warcs directory contains a file with .open extension. If not - the job is finished.

I'm unable to connect Docker Remote API using nodejs hosted in AWS

I have created t1.micro instance in Amazon web-services(AWS), and installed docker.io.
I executed following commend in SSH client "sudo docker -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock -d &".
when I am trying to get all images : myipaddres:4243/images/json.
I'am getting "This webpage is not available" page.
Finally I found https://github.com/crosbymichael/dockerui expose remote api on my host. :)

Resources