Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwrite the CORS Header witha docker-compose file #78

Open
AngeloBadellino opened this issue Jun 25, 2018 · 4 comments
Open

Overwrite the CORS Header witha docker-compose file #78

AngeloBadellino opened this issue Jun 25, 2018 · 4 comments

Comments

@AngeloBadellino
Copy link

Having the followinf Docker-Compose

  zookeeper:
    image: confluentinc/cp-zookeeper:latest
    restart: unless-stopped
    ports:
      - "2181:2181"
    environment:
      - ZOOKEEPER_CLIENT_PORT=2181
      - ZOOKEEPER_TICK_TIME=2000

  kafka:
    image: confluentinc/cp-kafka:latest
    ports:
      - "59092:9092"
    environment:
      - KAFKA_BROKER_ID= 1
      - KAFKA_ZOOKEEPER_CONNECT= zookeeper:2181
      - KAFKA_ADVERTISED_LISTENERS= PLAINTEXT://kafka:9092
      - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR= 1
    depends_on:
      - zookeeper

  schema_registry:
    image: confluentinc/cp-schema-registry:latest
    ports:
      - '58081:8081'
    restart: unless-stopped
    environment:
      - SCHEMA_REGISTRY_LISTENERS= http://127.0.0.1:8081
      - SCHEMA_REGISTRY_HOST_NAME= schema
      - SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL= zookeeper:2181
    depends_on:
      - kafka
      - zookeeper

  proxy:
    image: confluentinc/cp-kafka-rest:latest
    ports:
      - '58082:8082'
    environment:
      - KAFKA_REST_ZOOKEEPER_CONNECT= zookeeper:2181
      - KAFKA_REST_SCHEMA_REGISTRY_URL= schema:8081
      - KAFKA_REST_HOST_NAME= proxy
      - KAFKA_REST_LISTENERS= http://127.0.0.1:8082
    depends_on:
      - schema_registry
      - kafka
      - zookeeper

  kafka-ui:
    image: landoop/kafka-topics-ui:latest
    ports:
      - 58000:8000
    environment:
      - KAFKA_REST_PROXY_URL=http://127.0.0.1:8082
      - PROXY=True
    depends_on:
      - proxy
      - kafka

I am getting the CONNECTIVITY ERROR well know problem.
I am trying to figure out how to overwrite the kafka.rest.conf settings.

Any help?

@andmarios
Copy link
Contributor

Try to set KAFKA_REST_LISTENERS to http://proxy:8082, and accordingly KAFKA_REST_PROXY_URL to the same value.

Btw, exposing the broker port at 59092 won't work for your host. Clients will want to connect to the advertised listeners.

@AngeloBadellino
Copy link
Author

Hi thank you forthe reply.
Unfortunatly I am getting the same error. Opening the dev panel I see errors similar to:


Possibly unhandled rejection: Failed at method [GET] [http://proxy:8082/topics] with error: 
{"data":null,"status":-1,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"http://proxy:8082/topics","dataType":"json","headers":{}},"statusText":""}

Bdw, I get response if access that link directly from the host machine.

@andmarios
Copy link
Contributor

Please change PROXY=True to PROXY=true or PROXY=1 as it is case sensitive.

@s3ni0r
Copy link

s3ni0r commented Feb 10, 2019

Hi @AngeloBadellino ,
the confluent docker images have some scripts that transform all environment variables prefixed with $COMPONENT_ like (SCHEMA_REGISTRY, KAFKA_REST) into configuration using a template file, for instance in your docker-compose file, if you would like to add a configuration entry like heap.opts to your schema-registry.properties you can declare an environment variable in your docker service as follow :

environment:
  SCHEMA_REGISTRY_HEAP_OPTS: -Xms1g -Xmx1g
  SCHEMA_REGISTRY_ACCESS_CONTROL_ALLOW_METHODS: GET,POST,PUT,OPTIONS

then when you run your docker service, it will be added into your configuration file as :

heap.opts=-Xms1g -Xmx1g
access.control.allow.methods=GET,POST,PUT,OPTIONS

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants