Connection refused at localhost in camunda self managed

Hi Everyone

I am trying to build a very basic workflow through desktop camunda modeler with a rest api connector to fetch response from a local post api with payload hosted on localhost and port 8009
image

but I get this error after running the instance

I have taken help of camunda docs and installed zeebe, operate, tasklist, connector through docker from here (GitHub - camunda/camunda-platform: Links to Camunda Platform 8 resources, releases, and local development config) and template from here, connector bundle is running in docker.

so do anyone know how to resolve the issue or how to test post api with payload deployed locally on camunda self managed.

template is taken from GitHub - camunda/connector-http-json: HTTP JSON Cloud Connector

Hi @Alexiso03 ,

As camunda platform is running in docker virtual network it cannot communicate to localhost

Run your local application in a docker container within the camunda platform network and communicate it through container name

Hope this helps

Thanks for the reply @Praveen_Kumar_Reddy

I got it why it can’t communicate to localhost, so I tried to run my fastapi project in a container but I didn’t understand about running within camunda plaform network and communicating it through container name as rest api needs a url I can’t provide a container name there.

can you kindly clarify this.

Thanks again for the reply

You can use a docker compose file to run your container within the network of camunda platform

You can find an example here, This example is running for connector runtime you can take snippet of adding a network from here and use it in your compose file

Make sure you check your nework name of camunda platform before adding it

For url you need to replace localhost with the name for your container

http://localhost:8009/api

instead of localhost give container name(assuming it as fastapi)
 
http://fastapi:8009/api

Hope this proves useful
Praveen

Hey,


this is my container name “api” and I changed the URL from http://localhost:8000/transaction to http://api:8000/transaction but now the error is

I am new to camunda so don’t know why this issue persists

@Alexiso03 , please share your doocker compose file and post template in rest connector

Docker Compose File:
docker-compose.yaml (216 Bytes)

rest connector template:

my post connector config:



@Alexiso03 check the network name created for your camunda platform by using the below command in cmd line

 docker network ls

It will give the network name and add this to docker compose

version: '3'

services:
  web:
    build: .
    command: sh -c "uvicorn extractionapi:app --reload --port=8000 --host=0.0.0.0"
    ports:
      - 8000:8000
    networks:
      - camunda-platform-830_camunda-platform
networks:
  camunda-platform-830_camunda-platform:
    external: true

still the same issue, my camunda network’s name is

I applied it in the yaml file too,

and here is the result:

So here something worked for me, I tested out api and thus I got the result inside the docker container

here we can see a host responding in my case it is “172.18.0.1” thus the host will change to this address and everything else remains the same therefore url will be http://172.18.0.1:8000/transaction.

Thanks @Praveen_Kumar_Reddy for your replies, you had been a great help.

1 Like

It looks like your API Container name is actually api-web-1 rather than api, so calls to http://api:8000 won’t resolve from Camunda connector, since it would need to be http://api-web-1:8000

1 Like

Thanks for the reply @GotnOGuts

I tried that url too but then the error message changed to “api-web-1”.
Still I understood what was happening in the containers and the above URL worked for me in getting a response.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.