FIWARE Orion subscription creation failed - docker

Trying to create subscription on FIWARE Orion to notify Cygnus instance. But no matter what I try or do I get failed as subscription status.
Main problem seem to be Cygnus URL I am using for notification, but Cygnus is up and running without any issues and this problem still persist.
FIWARE Orion version:
"orion" : {
"version" : "1.15.0-next",
"uptime" : "0 d, 0 h, 24 m, 24 s",
"git_hash" : "9cf2ea8243e4757a52c9019d197112abcf715dbe",
"compile_time" : "Mon Sep 24 08:22:30 UTC 2018",
"compiled_by" : "root",
"compiled_in" : "ea5d2e530912",
"release_date" : "Mon Sep 24 08:22:30 UTC 2018",
"doc" : "https://fiware-orion.readthedocs.org/en/master/"
}
FIWARE Cygnus version:
version 1.9.0_SNAPSHOT.887d615a9dfc2c09c99e511f8cefb148aa54809e
FIWARE Orion error log:
time=Thursday 27 Sep 13:33:09 2018.712Z | lvl=WARN | corr=N/A |
trans=1538055058-177-00000000002 | from=pending | srv=pending |
subsrv=pending | comp=Orion |
op=AlarmManager.cpp[328]:notificationError | msg=Raising alarm
NotificationError http://172.20.0.2:5050/notify: (curl_easy_perform
failed: Timeout was reached)
Subscription body:
{
"description": "A subscription to get info about Room entity",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "Room"
}
],
"condition": {
"attrs": [
]
}
},
"notification": {
"http": {
"url": "http://172.20.0.2:5050/notify"
},
"attrs": [
]
},
"expires": "2040-01-01T14:00:00.00Z",
"throttling": 5
}
I found good amount of simmilar problems they all point out to url issues of Cygnus because it is run as docker container.
But you can see in logs and example that I use IP address of containers (not localhost etc), and issue is constant.
What did I miss here since there is no much to do with subscription creation and it looks very simple but still all subscription are getting back with failed as status and issue I describe above.
Thanks.

It seems to be a connectivity problem.
You mention you are using Docker and I understand that Orion and Cygnus run in different docker containers. Thus, probably there is some kind of connectivity problem between, the IP you are using in the subscription is not the right one or Cygnus container is not exposing port 5050 to others.

Related

WhatsAPP Business API - Connection refused. Please check if wacore is running: wacore:6251 error

I've installed WhatsApp business client on my linux docker containers, I have managed to hit the /v1/health route perfectly and have also changed the default password through an endpoint.
But, I'm getting an error when I try to access POST request /v1/contacts . The error is:
{
"meta": {
"version": "v2.41.2",
"api_status": "stable"
},
"errors": [
{
"code": 1014,
"title": "Internal error",
"details": "Connection refused. Please check if wacore is running: wacore:6251"
}
]
}
However, my wacore container is indeed running:
Docker Container Image
P.S: Some questions already posted here with similar titles don't solve my issue.

Is there additional setup for connecting Nomad and Jenkins?

I'm interested in setting up Jenkins to test and launch my applications on Nomad and am trying to connect the two using https://github.com/jenkinsci/nomad-plugin
I've installed and been able to connect to and validate the connection to Nomad from Jenkins. I have a simple pipeline that just echos via bash, and I can see Jenkins is able to launch Nomad jobs and allocations. However, these jobs stall and die. Looking at the Nomad logs, I can see:
INFO: Locating server among [http://localhost:8080/]
May 06, 2022 8:16:36 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: Failed to connect to http://localhost:8080/tcpSlaveAgentListener/: Connection refused (Connection refused)
It sounds like Nomad isn't able to find its way back to Jenkins, even though that's the correct Jenkins port on my machine.
Is there some additional setup I need to follow to allow Nomad to pass information back to Jenkins? Is there an issue with the tunnel? I did enable the fixed tunnel port of 50000 to match the template below.
My Nomad job template in Jenkins:
{
"Job": {
"Region": "global",
"ID": "%WORKER_NAME%",
"Type": "batch",
"Datacenters": [
"dc1"
],
"TaskGroups": [
{
"Name": "jenkins-worker-taskgroup",
"Count": 1,
"RestartPolicy": {
"Attempts": 0,
"Interval": 10000000000,
"Mode": "fail",
"Delay": 1000000000
},
"Tasks": [
{
"Name": "jenkins-worker",
"Driver": "docker",
"Config": {
"image": "jenkins/inbound-agent"
},
"Env": {
"JENKINS_URL": "http://localhost:8080",
"JENKINS_AGENT_NAME": "%WORKER_NAME%",
"JENKINS_SECRET": "%WORKER_SECRET%",
"JENKINS_TUNNEL": "http://localhost:50000"
},
"Resources": {
"CPU": 500,
"MemoryMB": 256
}
}
],
"EphemeralDisk": {
"SizeMB": 300
}
}
]
}
}
"JENKINS_URL": "http://localhost:8080",
The address of jenkins url is invalid, which is what the message is about. Give the ip address of jenkins instance, not localhost. localhost inside the docker container is the docker container localhost.
Also, remember to enable connections to port 50000 in jenkins, there is an option for that.

Consul watch with critical consul checks

So I have a consul check that watches over a container and is designed to go critical when the container is stopped. I want to create a consul watch that will run a script after the check has gone critical, or after several critical responses (for example if my check sends 5 critical responses I want it to run a script).
Here is the json for my working check and my guess as to what I my watch might look like:
{
// this check works
"checks": [
{
"id": "docker_stuff",
"name": "curl test",
"notes": "curls the docker container",
"script": "/scripts/docker.py",
"interval": "1s"
}
],
//this watch doesn't work
"watches": [
{
"Node": "client2",
"CheckID": "docker-stuff",
"Name": "docker-stuff-watch",
"Status": "critical",
"Status_amt": "5",
"handler": "/scripts/new-docker.sh",
"Output": "container relaunched",
}
]
}
What do I need to change in my watch to get it working?
Would I also need to use a consul event to watch my health check and then trigger a consul watch (of the event type) that runs my /scripts/new-docker.sh script? If so then how would I make a consul event that watches over my health check? For example if this was my consul check, watch and event, what would I need to change to get this working?
{
"checks": [
{
"id": "docker_stuff",
"name": "curl test",
"notes": "curls the docker container",
"script": "/scripts/docker.py",
"interval": "1s"
}
],
"watches": [
{
"type": "event",
"name": "docker-stuff-watch",
"handler": "/scripts/new-docker.sh"
}
],
"events": [
{
"Node": "client2",
"CheckID": "docker-stuff",
"Name": "docker-stuff-event",
"Status": "critical",
"Status_amt": "5",
"Output": "container relaunched",
}
]
}
What do I need to change in my watch to get it working?
Are there any errors? Make sure your watch handler '/scripts/new-docker.sh' is consuming STDIN that Consul will be sending, even if it is throwing it away to /dev/null, otherwise the process will wait forever for it to be consumed
Something like
while read -r -t 0; do read -r; done
I would recommend considering an upgrade to the next version of Docker 1.12 (release candidate at the moment). The new concept of services can be used to state the desired number of containers to be run.
https://docs.docker.com/engine/swarm/swarm-tutorial/deploy-service/
There's also a new HEALTHCHECK directive in the Dockerfile that enables you to bundle a check script with the container image.
These new features might enable you to replace the functionality you've had to implement using consul.

Packer-built OpenStack instance stuck in "Spawning" state

I'm trying to build a new Debian image with Packer, but the building process halts at ==> openstack: Waiting for server to become ready..., while Packers building instance is stuck in the Spawning state.
(Edit: My last test build was stuck for ~45 minutes, and exited with this error message: Build 'openstack' errored: Error waiting for server ({uuid}) to become ready: unexpected state 'ERROR', wanted target '[ACTIVE]')
The source image is a cloud image of Debian, and my template file looks like this:
{
"variables": {
"os_auth_url": " ( Keystone URL ) ",
"os_domain_name": " ( Domain Name ) ",
"os_tenant_name": " ( Project Name ) ",
"os_region_name": " ( Region Name ) "
},
"builders": [
{
"type": "openstack",
"flavor": "b.tiny",
"image_name": "packer-openstack-{{timestamp}}",
"source_image": "cd8da3bf-66cd-4847-8970-447533b86b30",
"ssh_username": "debian",
"username": "{{user `username`}}",
"password": "{{user `password`}}",
"identity_endpoint": "{{user `os_auth_url`}}",
"domain_name": "{{user `os_domain_name`}}",
"tenant_name": "{{user `os_tenant_name`}}",
"region": "{{user `os_region_name`}}",
"floating_ip_pool": "internet",
"security_groups": [
"deb_test_uni"
],
"networks": [
"a4151f4e-fd88-4df8-97e1-2b113f149ef8",
"71b10496-2617-47ae-abbc-36239f0863bb"
]
}
]
}
The username and password fields are being added by a separate file, located on the (Jenkins) build server.
The building process managed to get past this at one point, but exited with a ssh timeout error. I have no idea why that happened, and why only then.
Is there anything blindingly obvious that I'm missing? Or has anyone else suffered the same problem, but managed to find a solution?
Thanks in advance!
It turns out that, in my case, there was nothing I (personally) could do. It was neither the Packer template nor the environment variables (as I had a suspicion it could be), but a fault in the server-side configuration.
I'm sorry that I don't know what the bug or fix was, as I wasn't the one who found or fixed the problem, but knowing that it could be good idea to double-check the server setup might help someone in the future.

Any API or Web UI project to manage a Docker private registry?

I can't find how to manage images in a private registry. I can push or pull an image because i know the id but how to get the list of pushed images ?
Take for example a person who wants to see the available images under the private registry of his organization. How can she do ?
Unless I'm mistaken, I can't find API or Web UI to discover the registry content like the index.docker.io do with the public registry.
Are there any open source projects to manage this ?
thanks.
Are there any open source projects to manage this ?
There is a containerized web application that provides administration of one-to-many private registries. Its name is Docker Registry UI and it is FOSS.
The source is on Github and you can run it in a container like so:
docker run -p 8080:8080 -v my_data_dir:/var/lib/h2/ atcol/docker-registry-ui
Disclaimer: I wrote the web-app as I could not find one myself. I believe this answers your question (as quoted).
Thanks Thomas !
To allow the use of the search API, you must start the container by specifying the value of the environment variable SEARCH_BACKEND like this :
docker run -d -e SEARCH_BACKEND=sqlalchemy -p 5000:5000 --name registry samalba/docker-registry
Then i have a result for this query :
GET http://registry_host:5000/v1/search?q=base
Result :
{
"num_results": 1,
"query": "base",
"results": [{"description": "", "name": "test/base-img"}]
}
To list all images, you can do this :
GET http://registry_host:5000/v1/search
Result :
{
"num_results": 2,
"query": "",
"results": [
{"description": "", "name": "test/base-img"},
{"description": "", "name": "test/base-test"}]
}
And to know the available versions of an image :
GET http://localhost:5000/v1/repositories/**test/base-img**/tags
Result :
{
"0.1": "04e073e1efd31f50011dcde9b9f4d3148ecc4da94c0b7ba9abfadef5a8522d13",
"0.2": "04e073e1efd31f50011dcde9b9f4d3148ecc4da94c0b7ba9abfadef5a8522d13",
"0.3": "04e073e1efd31f50011dcde9b9f4d3148ecc4da94c0b7ba9abfadef5a8522d13"
}
I've written a docker-registry-frontend that you can find on github. It allows you to browse your private registry and do almost everything that is available through the Docker registry API v1. Plus, it can be run as a docker container on its own.
Here's a list of basic features with some screenshots: https://github.com/kwk/docker-registry-frontend/wiki/Features. In addition to these features, there's support for SSL encryption and Kerberos authentication.
I want to present for you, my frontend for private registry, you may try it from github or dockerhub.
Also you can find interface screenshots there.
To sum up it has:
- internal db (BoltBD) gives it ability to store info, and as result it responses much more faster then after direct api call like in other projects
- app can pars, store and show info from registry such as:
- image layers info:
- name / tag
- image size and pushes number
- upload and push dates
- image creating commands history
- it is possible to set multiple repositories in case you have more than one registries and observe them in one place
- show statistics pretty, draw curves for uploads number and image sizes for tag with respects to dates
Update 2017-02-15
So far also there was added:
find a parent
show tree-graph of parents
image deletion
Bearer token auth support
As far as I see, the Docker registry has a REST API, very similar to Docker itself. You can find the documentation at http://docs.docker.io/reference/api/registry_api/. But on the first glance I don't see a method to just list all images.
There is also an REST API for the official index (infos at http://docs.docker.io/reference/api/docker-io_api/).
EDIT
I just tested the Docker registry API and it is not so self-explanatory. You can query all images of a certain repository. In my case, my repository is called "thomas/busybox". I can query all images in there by calling:
https://my-private-registry.com/v1/repositories/thomas/busybox/images
Result:
[
{
"id": "2d8e5b282c81244037eb15b2068e1c46319c1a42b80493acb128da24b2090739"
},
{
"id": "6c991eb934609424f761d3d0a7c79f4f72b76db286aa02e617659ac116aa7758"
},
{
"id": "9f4e93171ec525221fa9013d0e21f8690cef68590664eb5249e0b324c5faf31a"
},
{
"id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"
}
]
Now I know that I have four images in my repository and I can query every image. The query for the first image would be:
https://my-private-registry.com/v1/images/2d8e5b282c81244037eb15b2068e1c46319c1a42b80493acb128da24b2090739/json
Result:
{
"id": "2d8e5b282c81244037eb15b2068e1c46319c1a42b80493acb128da24b2090739",
"parent": "9f4e93171ec525221fa9013d0e21f8690cef68590664eb5249e0b324c5faf31a",
"created": "2014-04-24T15:59:59.47081913Z",
"container": "d15320d6935ca35bc4198e373f29e730f4c53cce32b3809c2fecec22eb30018b",
"container_config": {
"Hostname": "4964db5b599b",
...
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"HOME=\/",
"PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin"
],
"Cmd": [
"\/bin\/sh",
"-c",
"#(nop) CMD [\/bin\/sh -c \/bin\/sh]"
],
"Image": "9f4e93171ec525221fa9013d0e21f8690cef68590664eb5249e0b324c5faf31a",
...
"OnBuild": [
]
},
"docker_version": "0.10.0",
"author": "J\u00c3\u00a9r\u00c3\u00b4me Petazzoni <jerome#docker.com>",
"config": {
"Hostname": "4964db5b599b",
"Domainname": "",
"User": "",
"Memory": 0,
...
"Env": [
"HOME=\/",
"PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin"
],
"Cmd": [
"\/bin\/sh",
"-c",
"\/bin\/sh"
],
"Image": "9f4e93171ec525221fa9013d0e21f8690cef68590664eb5249e0b324c5faf31a",
...
"OnBuild": [
]
},
"architecture": "amd64",
"os": "linux",
"Size": 0
}
You can also search for an image, but I do not get any results:
https://my-private-registry.com/v1/search?q=thomas
Result:
{"num_results": 0, "query": "thomas", "results": []}
Sonatype Nexus Repository Manager 3.0 has Private Registry for Docker

Resources