reportportal / service-api

Report portal. Main API Service
Apache License 2.0
43 stars 65 forks source link

External rabbitmq instance without access to "/" vhost #1971

Open nevesing opened 2 months ago

nevesing commented 2 months ago

I am trying to use external rabbitmq instance where we dont have access to / vhost and our internal team who host this rabbitmq instance do not provide access to / vhost. We configure RP_AMQP_ANALYZER-VHOST to specific vhost but still it tries to connect to additional vhost /

  api:
    image: reportportal/service-api:5.11.0
    container_name: reportportal-api
    logging:
      <<: *logging
    depends_on:
      # rabbitmq:
      #   condition: service_healthy
      gateway:
        condition: service_started
      postgres:
        condition: service_healthy
    environment:
      RP_DB_HOST: *db_host
      RP_DB_USER: *db_user
      RP_DB_PASS: *db_password
      RP_DB_NAME: *db_name
      RP_AMQP_HOST: rabbitmq-external.xxx.com
      RP_AMQP_PORT: 5672
      RP_AMQP_USER: reportportaladmusr
      RP_AMQP_PASS: xxx
      RP_AMQP_APIUSER: reportportaladmusr
      RP_AMQP_APIPASS: xxx
      RP_AMQP_ANALYZER-VHOST: fs-qa-reportportal
      DATASTORE_TYPE: filesystem
      LOGGING_LEVEL_ORG_HIBERNATE_SQL: debug
      RP_REQUESTLOGGING: "false"
      AUDIT_LOGGER: "OFF"
      MANAGEMENT_HEALTH_ELASTICSEARCH_ENABLED: "false"
      RP_ENVIRONMENT_VARIABLE_ALLOW_DELETE_ACCOUNT: "false"
      LOGGING_LEVEL_COM_EPAM_TA_REPORTPORTAL_WS_CONTROLLER: debug
      LOGGING_LEVEL_COM_EPAM_TA_REPORTPORTAL_WS_RABBIT: debug
      JAVA_OPTS: >
        -Xmx1g 
        -XX:+HeapDumpOnOutOfMemoryError 
        -XX:HeapDumpPath=/tmp  
        -Dcom.sun.management.jmxremote.rmi.port=12349 
        -Dcom.sun.management.jmxremote 
        -Dcom.sun.management.jmxremote.local.only=false  
        -Dcom.sun.management.jmxremote.port=9010 
        -Dcom.sun.management.jmxremote.authenticate=false 
        -Dcom.sun.management.jmxremote.ssl=false 
        -Djava.rmi.server.hostname=0.0.0.0
      RP_JOBS_BASEURL: http://jobs:8686
      COM_TA_REPORTPORTAL_JOB_INTERRUPT_BROKEN_LAUNCHES_CRON: PT1H
      RP_ENVIRONMENT_VARIABLE_PATTERN-ANALYSIS_BATCH-SIZE: 100
      RP_ENVIRONMENT_VARIABLE_PATTERN-ANALYSIS_PREFETCH-COUNT: 1
      RP_ENVIRONMENT_VARIABLE_PATTERN-ANALYSIS_CONSUMERS-COUNT: 1
    volumes:
      - storage:/data/storage
    healthcheck:
      test: curl -f http://0.0.0.0:8585/health
      interval: 60s
      timeout: 30s
      retries: 10
      start_period: 60s
    labels:
      - "traefik.http.middlewares.api-strip-prefix.stripprefix.prefixes=/api"
      - "traefik.http.routers.api.middlewares=api-strip-prefix@docker"
      - "traefik.http.routers.api.rule=PathPrefix(`/api`)"
      - "traefik.http.routers.api.service=api"
      - "traefik.http.services.api.loadbalancer.server.port=8585"
      - "traefik.http.services.api.loadbalancer.server.scheme=http"
      - "traefik.expose=true"
    networks:
      - reportportal
    restart: always

Error logs if we use external hosted rabbitmq:

reportportal-api  | Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - access to vhost '/' refused for user 'reportportaladmusr', class-id=10, method-id=40)

Success logs if we use internal rabbitmq in docker--compose:

reportportal-api  | 2024-04-16 11:28:59.875  INFO 1 --- [           main] o.s.a.r.c.CachingConnectionFactory       : Created new connection: connectionFactory#1d8e9f22:0/SimpleConnection@29a73056 [delegate=amqp://rabbitmq@172.26.0.3:5672/, localPort= 54540]

...

reportportal-api  | 2024-04-16 11:29:44.783  INFO 1 --- [nio-8585-exec-1] o.s.a.r.c.CachingConnectionFactory       : Created new connection: analyzerConnectionFactory#2f19ab6:0/SimpleConnection@748feadf [delegate=amqp://rabbitmq@172.26.0.3:5672/fs-qa-reportportal, localPort= 54610]
Pink-Bumblebee commented 2 months ago

@nevesing , actually I do not understand why you need external Rabbit. Could you please explain?

nevesing commented 2 months ago

@nevesing , actually I do not understand why you need external Rabbit. Could you please explain?

I mean a managed/on-prem rabbitmq instance which is not part of the docker-compose services. I use that instance for other projects and so want to use the same for reportportal.

nevesing commented 2 months ago

Below is from a k8s deployment using helmchart. Rabbitmq is deployed with same helm chart and I still see below errors relevant to / vhost however everything is working fine. My goal is to use on-prem rabbitmq instance as mentioned above

itmq@192.168.31.109:5672/,133), conn: Proxy@3aef4650 Shared Rabbit Connection: SimpleConnection@21df2968 [delegate=amqp://rabbitmq@192.168.31.109:5672/, localPort= 48556], acknowledgeMode=AUTO local queue size=0
2024-04-18 16:17:42.520  INFO 1 --- [168.31.109:5672] o.s.a.r.c.CachingConnectionFactory       : Shutdown Signal: channel error; protocol method: #method<channel.close>(reply-code=403, reply-text=ACCESS_REFUSED - queue 'reporting.1' in vhost '/' in exclusive use, class-id=60, method-id=20)
2024-04-18 16:17:47.523  WARN 1 --- [.Spring.bean-10] o.s.a.r.l.SimpleMessageListenerContainer : Exclusive consumer failure: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=403, reply-text=ACCESS_REFUSED - queue 'reporting.1' in vhost '/' in exclusive use, class-id=60, method-id=20)
2024-04-18 16:17:47.525  INFO 1 --- [.Spring.bean-10] c.e.t.r.ws.rabbit.ConsumerEventListener  : Restarting consumer with a queue reporting.0
2024-04-18 16:17:47.527  INFO 1 --- [.Spring.bean-10] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@12e178aa: tags=[[]], channel=Cached Rabbit Channel: AMQChannel(amqp://rabbitmq@192.168.31.109:5672/,135), conn: Proxy@3aef4650 Shared Rabbit Connection: SimpleConnection@21df2968 [delegate=amqp://rabbitmq@192.168.31.109:5672/, localPort= 48556], acknowledgeMode=AUTO local queue size=0
2024-04-18 16:20:02.289  INFO 1 --- [_ClusterManager] o.s.s.quartz.LocalDataSourceJobStore     : ClusterManager: detected 1 failed or restarted instances.
raikbitters commented 2 months ago

@nevesing hello. Could you try to set that variable for API and Jobs Services: RP_AMQP_BASE-VHOST: /your-host/ ?

We use / root host by default, but you can change it. https://vscode.dev/github/reportportal/service-api/blob/develop/src/main/resources/application.yaml#L121

nevesing commented 2 months ago

@raikbitters Thanks. I tried as per your suggestion. I set RP_AMQP_BASE-VHOST and RP_AMQP_ANALYZER-VHOST both to same value fs-qa-reportportal-vh. I also noticed from application.yaml that my amqp.addresses and amqp.api-address will be different so I added another env like RP_AMQP_API-ADDRESS: https://xxx:xxxx@rabbitmq-external-console.xxx.com/api and it fails with unauthorized error because it is trying to create that vhost i believe

It makes PUT /api/vhosts/fs-qa-reportportal-vh

> curl -s https://xxx:xxxx@rabbitmq-external-console.xxx.com/api/vhosts/fs-qa-reportportal-vh | jq .
{
  "error": "not_authorised",
  "reason": "Not administrator user"
}
reportportal-api  | javax.net.ssl|DEBUG|A4|HttpClient-1-Worker-0|2024-04-19 16:25:11.080 UTC|SSLEngineOutputRecord.java:279|WRITE: TLSv1.3 application_data, length = 276
reportportal-api  | javax.net.ssl|DEBUG|A4|HttpClient-1-Worker-0|2024-04-19 16:25:11.082 UTC|SSLCipher.java:2029|Plaintext before ENCRYPTION (
reportportal-api  |   0000: 50 55 54 20 2F 61 70 69   2F 76 68 6F 73 74 73 2F  PUT /api/vhosts/
reportportal-api  |   0010: 66 73 2D 71 61 2D 72 65   70 6F 72 74 70 6F 72 74  fs-qa-reportport
reportportal-api  |   0020: 61 6xxxxxxxxxxxxxx48 54   54 50 2F 31 2E 31 0D 0A  al-vh HTTP/1.1..
reportportal-api  |   0030: 43 6F 6E 74 65 6E 74 2D   4C xxxxxxxxxxxxxxxxx 20  Content-Length:
reportportal-api  |   0040: 30 0D 0A 48 6F 73 74 3A   20 72 61 62 62 69 74 6D  0..Host: xxx
reportportal-api  |   0050: 71 2D 73 6A 63 33 37 2D   33 38 2D 73 74 61 67 65  qxxx
reportportal-api  |   0080: 2xxxxxxxxxxxx3   65 72 2D 41 67 65 6E 74           .com..User-Agent
reportportal-api  |   0090: 3A 20 4A 61 76 61 2D 68   74 74 70 2D 63 6C 69 65  : Java-http-clie
reportportal-api  |   00A0: 6E 74 2F 32 31 2E 30 2E   32 0D 0A 41 75 74 68 6F  nt/21.0.2..Autho
reportportal-api  |   00B0: 72 69 7A 61 74 69 6F 6E   3A 20 42 61 73 69 63 20  rization: Basic
reportportal-api  |   00C0: 63 6D 56 77 62 33 4A 30   63 47 39 79 64 47 46 73  cxxxxxGFs
reportportal-api  |   00D0xxxxxxxxxxxxxxxxxxx 4E 79   6E 74 2F 32 31 2E 30 2E  YWRxxxkNl
reportportal-api  |   00E0: 61 33 5A 70 57 45 31 57   53 47 52 6E 59 30 49 3D  a3Zxxxx=
reportportal-api  |   00F0: 0D 0A 63 6F 6E 74 65 6E   74 xxxxxxxxxxxxxxxxxx  ..content-type:
reportportal-api  |   0100: 61 70 70 6C 69 63 61 74   69 6F 6E 2F 6A 73 6F 6E  application/json
reportportal-api  |   0110: 0D 0A 0D 0A 17 00 00 00   00 00 00 00 00 00 00 00  ................
reportportal-api  |   0120: 00 00 00 00 00                                     .....
reportportal-api  | )
reportportal-api  | javax.net.ssl|DEBUG|A4|HttpClient-1-Worker-0|2024-04-19 16:25:11.086 UTC|SSLEngineInputRecord.java:213|READ: TLSv1.2 application_data, length = 318
reportportal-api  | javax.net.ssl|DEBUG|A4|HttpClient-1-Worker-0|2024-04-19 16:25:11.087 UTC|SSLCipher.java:1935|Plaintext after DECRYPTION (
reportportal-api  |   0000: 48 54 54 50 2F 31 2E 31   20 34 30 31 20 55 6E 61  HTTP/1.1 401 Una
reportportal-api  |   0010: 75 74 68 6F 72 69 7A 65   64 0D 0A 63 6F 6E 74 65  uthorized..conte
reportportal-api  |   0020: 6E 74 2D 6C 65 6E 67 74   68 3A 20 36 30 0D 0A 63  nt-length: 60..c
reportportal-api  |   0030: xxxxxxxxxxxxxxxxxxxxx73   65 63 75 72 69 74 79 2D  ontent-security-
reportportal-api  |   0040: 70 6F 6C 69 63 79 3A 20   73 63 72 69 70 74 2D 73  policy: script-s
reportportal-api  |   0050: 72 63 20 27 73 65 6C 66   27 20 27 75 6E 73 61 66  rc 'self' 'unsaf
reportportal-api  |   0060: 65 2D 65 76 61 6C 27 20   xxxxxxxxxxxxxxxxxxxxxxD  e-eval' 'unsafe-
reportportal-api  |   0070: 69 6E 6C 69 6E 65 27 3B   20 6F 62 6A 65 63 74 2D  inline'; object-
reportportal-api  |   0080: 7xxxxxxxxxxxxxxxxxxxxxC   66 27 0D 0A 63 6F 6E 74  src 'self'..cont
reportportal-api  |   0090: 65 6E 74 2D 74 79 70 65   3A 20 61 70 70 6C 69 63  ent-type: applic
reportportal-api  |   00A0: 61 74 69 6F 6E 2F 6A 73   6F 6E 0D 0A 64 61 74 65  ation/json..date
reportportal-api  |   00B0: 3A 20 46 72 69 2C 20 31   39 20 41 70 72 20 32 30  : Fri, 19 Apr 20
reportportal-api  |   00C0: 32 34 20 31 36 3A 32 35   3A xxxxxxxxxxxxxxxxx 0D  24 16:25:10 GMT.
reportportal-api  |   00D0: 0A 73 65 72 76 65 72 3A   20 43 6F 77 62 6F 79 0D  .server: Cowboy.
reportportal-api  |   00E0: 0A xxxxxxxxxxxxxxxxx 6F   72 69 67 69 6E 0D 0A 0D  .vary: origin...
reportportal-api  |   00F0: 0A 7B 22 65 72 72 6F 72   22 3A 22 6E 6F 74 5F 61  .."error":"not_a
reportportal-api  |   0100: 75 74 68 6F 72 69 73 65   64 22 2C 22 72 65 61 73  uthorised","reas
reportportal-api  |   0110: 6F 6E 22 3A 22 4E 6F 74   20 61 64 6D 69 6E 69 73  on":"Not adminis
reportportal-api  |   0120: 74 72 61 74 6F 72 20 75   73 65 72 22 7D           trator user".
raikbitters commented 2 months ago

I tried as per your suggestion. I set RP_AMQP_BASE-VHOST and RP_AMQP_ANALYZER-VHOST both to same value fs-qa-reportportal-vh.

We use different vhosts for API and Analyzer. For that reason could you create different vhosts for API service and Analyzer?

raikbitters commented 2 months ago

It fails with unauthorized error because it is trying to create that vhost i believe

Yes, it's correct. The service API uses the RabbitMQ manage API endpoint you provide here, RP_AMQP_API-ADDRESS, to create a vhost for Service Analyzer with a name you provide here, RP_AMQP_ANALYZER-VHOST. If you have vhost with the same name, Service API doesn't create it, but anyway, you have to give credentials for RabbitMQ manage API here: RP_AMQP_API-ADDRESS. I think the Service API won't work without access to RabbitMQ Manage API.

nevesing commented 2 months ago

Thanks @raikbitters. I see the same error "Not administrator user" and my changes are below. API credentials are correct otherwise we will not see this error. It is still trying to createfs-qa-reportportal-analyzer-vh and the PUT fails. The on-prem instance already has both the vhosts created and access granted for same user. Please help.

RP_AMQP_API-ADDRESS: https://xxx:xxxx@rabbitmq-external-console.xxx.com/api
RP_AMQP_ANALYZER-VHOST: fs-qa-reportportal-analyzer-vh
RP_AMQP_BASE-VHOST: fs-qa-reportportal-api-vh
nevesing commented 2 months ago

@raikbitters could you suggest other workarounds/solution?

nevesing commented 1 month ago

I am still waiting for any help

raikbitters commented 1 month ago

Thanks @raikbitters. I see the same error "Not administrator user" and my changes are below. API credentials are correct otherwise we will not see this error. It is still trying to createfs-qa-reportportal-analyzer-vh and the PUT fails. The on-prem instance already has both the vhosts created and access granted for same user. Please help.

RP_AMQP_API-ADDRESS: https://xxx:xxxx@rabbitmq-external-console.xxx.com/api
RP_AMQP_ANALYZER-VHOST: fs-qa-reportportal-analyzer-vh
RP_AMQP_BASE-VHOST: fs-qa-reportportal-api-vh

@nevesing hello. Did you provide credentials of admin user?

nevesing commented 1 month ago

Thanks @raikbitters. I see the same error "Not administrator user" and my changes are below. API credentials are correct otherwise we will not see this error. It is still trying to createfs-qa-reportportal-analyzer-vh and the PUT fails. The on-prem instance already has both the vhosts created and access granted for same user. Please help.

RP_AMQP_API-ADDRESS: https://xxx:xxxx@rabbitmq-external-console.xxx.com/api
RP_AMQP_ANALYZER-VHOST: fs-qa-reportportal-analyzer-vh
RP_AMQP_BASE-VHOST: fs-qa-reportportal-api-vh

@nevesing hello. Did you provide credentials of admin user?

@raikbitters yes the admin credentials I used is for the vhosts (fs-qa-reportportal-analyzer-vh and fs-qa-reportportal-api-vh) only (not for the entire managed rabbitmq instance)

nevesing commented 1 month ago

fs-qa-reportportal-analyzer-vh shows these queues but nothing for fs-qa-reportportal-api-vh

image

Docker container status:

image

> curl -s https://admin:xxxx@rabbitmq-external-console.xxx.com/api/vhosts/fs-qa-reportportal-analyzer-vh | jq .
{
  "error": "not_authorised",
  "reason": "Not administrator user"
}
nevesing commented 1 month ago
reportportal-jobs  | Caused by: com.rabbitmq.http.client.HttpClientException: PUT returned 401
reportportal-jobs  |    at com.rabbitmq.http.client.JdkHttpClientHttpLayer.maybeThrowClientServerException(JdkHttpClientHttpLayer.java:128) ~[http-client-5.2.0.jar!/:5.2.0]
reportportal-jobs  |    at com.rabbitmq.http.client.JdkHttpClientHttpLayer.put(JdkHttpClientHttpLayer.java:208) ~[http-client-5.2.0.jar!/:5.2.0]
reportportal-jobs  |    at com.rabbitmq.http.client.Client.createVhost(Client.java:378) ~[http-client-5.2.0.jar!/:5.2.0]
reportportal-jobs  |    at com.epam.reportportal.analyzer.RabbitMqManagementClientTemplate.<init>(RabbitMqManagementClientTemplate.java:48) ~[classes!/:na]
reportportal-jobs  |    at com.epam.reportportal.config.rabbit.AnalyzerRabbitMqConfiguration.managementTemplate(AnalyzerRabbitMqConfiguration.java:64) ~[classes!/:na]
reportportal-jobs  |    at com.epam.reportportal.config.rabbit.AnalyzerRabbitMqConfiguration$$EnhancerBySpringCGLIB$$9619fcd1.CGLIB$managementTemplate$2(<generated>) ~[classes!/:na]
reportportal-jobs  |    at com.epam.reportportal.config.rabbit.AnalyzerRabbitMqConfiguration$$EnhancerBySpringCGLIB$$9619fcd1$$FastClassBySpringCGLIB$$da2f2ae2.invoke(<generated>) ~[classes!/:na]
reportportal-jobs  |    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.30.jar!/:5.3.30]
reportportal-jobs  |    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.30.jar!/:5.3.30]
reportportal-jobs  |    at com.epam.reportportal.config.rabbit.AnalyzerRabbitMqConfiguration$$EnhancerBySpringCGLIB$$9619fcd1.managementTemplate(<generated>) ~[classes!/:na]
reportportal-jobs  |    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
reportportal-jobs  |    at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
reportportal-jobs  |    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.30.jar!/:5.3.30]
reportportal-jobs  |    ... 40 common frames omitted
reportportal-jobs  |
reportportal-api  | Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.epam.ta.reportportal.core.analyzer.auto.client.RabbitMqManagementClient]: Factory method 'managementTemplate' threw exception; nested exception is com.epam.ta.reportportal.exception.ReportPortalException: Unclassified Report Portal Error
reportportal-api  |     at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
reportportal-api  |     at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648)
reportportal-api  |     ... 39 common frames omitted
reportportal-api  | Caused by: com.epam.ta.reportportal.exception.ReportPortalException: Unclassified Report Portal Error
reportportal-api  |     at com.epam.ta.reportportal.core.analyzer.auto.client.impl.RabbitMqManagementClientTemplate.<init>(RabbitMqManagementClientTemplate.java:47)
reportportal-api  |     at com.epam.ta.reportportal.core.configs.rabbit.AnalyzerRabbitMqConfiguration.managementTemplate(AnalyzerRabbitMqConfiguration.java:60)
reportportal-api  |     at com.epam.ta.reportportal.core.configs.rabbit.AnalyzerRabbitMqConfiguration$$EnhancerBySpringCGLIB$$90fe7542.CGLIB$managementTemplate$0(<generated>)
reportportal-api  |     at com.epam.ta.reportportal.core.configs.rabbit.AnalyzerRabbitMqConfiguration$$EnhancerBySpringCGLIB$$90fe7542$$FastClassBySpringCGLIB$$c2906a38.invoke(<generated>)
reportportal-api  |     at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
reportportal-api  |     at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
reportportal-api  |     at com.epam.ta.reportportal.core.configs.rabbit.AnalyzerRabbitMqConfiguration$$EnhancerBySpringCGLIB$$90fe7542.managementTemplate(<generated>)
reportportal-api  |     at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
reportportal-api  |     at java.base/java.lang.reflect.Method.invoke(Method.java:580)
reportportal-api  |     at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
reportportal-api  |     ... 40 common frames omitted
nevesing commented 1 month ago

Compose file for api and job service:

api:
  image: reportportal/service-api:5.11.1
  container_name: reportportal-api
  logging:
    <<: *logging
  depends_on:
    gateway:
      condition: service_started
    postgres:
      condition: service_healthy
  environment:
    RP_DB_HOST: postgres
    RP_DB_USER: *db_user
    RP_DB_PASS: *db_password
    RP_DB_NAME: *db_name
    RP_AMQP_HOST: &rabbitmq_host rabbitmq-external.xxx.com
    RP_AMQP_API-ADDRESS: &rabbitmq_api_host https://admin:xxxx@rabbitmq-external-console.xxx.com/api
    RP_AMQP_PORT: &rabbitmq_port 5672
    RP_AMQP_USER: &rabbitmq_user admin
    RP_AMQP_PASS: &rabbitmq_password xxxx
    RP_AMQP_APIUSER: *rabbitmq_user
    RP_AMQP_APIPASS: *rabbitmq_password
    RP_AMQP_ANALYZER-VHOST: fs-qa-reportportal-analyzer-vh
    RP_AMQP_BASE-VHOST: fs-qa-reportportal-api-vh
    DATASTORE_TYPE: filesystem
    LOGGING_LEVEL_ORG_HIBERNATE_SQL: debug
    RP_REQUESTLOGGING: "false"
    AUDIT_LOGGER: "OFF"
    MANAGEMENT_HEALTH_ELASTICSEARCH_ENABLED: "false"
    RP_ENVIRONMENT_VARIABLE_ALLOW_DELETE_ACCOUNT: "false"
    LOGGING_LEVEL_COM_EPAM_TA_REPORTPORTAL_WS_CONTROLLER: debug
    LOGGING_LEVEL_COM_EPAM_TA_REPORTPORTAL_WS_RABBIT: debug
    JAVA_OPTS: >
      -Xmx1g 
      -XX:+HeapDumpOnOutOfMemoryError 
      -XX:HeapDumpPath=/tmp  
      -Dcom.sun.management.jmxremote.rmi.port=12349 
      -Dcom.sun.management.jmxremote 
      -Dcom.sun.management.jmxremote.local.only=false  
      -Dcom.sun.management.jmxremote.port=9010 
      -Dcom.sun.management.jmxremote.authenticate=false 
      -Dcom.sun.management.jmxremote.ssl=false 
      -Djava.rmi.server.hostname=0.0.0.0
    RP_JOBS_BASEURL: http://jobs:8686
    COM_TA_REPORTPORTAL_JOB_INTERRUPT_BROKEN_LAUNCHES_CRON: PT1H
    RP_ENVIRONMENT_VARIABLE_PATTERN-ANALYSIS_BATCH-SIZE: 100
    RP_ENVIRONMENT_VARIABLE_PATTERN-ANALYSIS_PREFETCH-COUNT: 1
    RP_ENVIRONMENT_VARIABLE_PATTERN-ANALYSIS_CONSUMERS-COUNT: 1
  volumes:
    - storage:/data/storage
  healthcheck:
    test: curl -f http://0.0.0.0:8585/health
    interval: 60s
    timeout: 30s
    retries: 10
    start_period: 60s
  labels:
    - "traefik.http.middlewares.api-strip-prefix.stripprefix.prefixes=/api"
    - "traefik.http.routers.api.middlewares=api-strip-prefix@docker"
    - "traefik.http.routers.api.rule=PathPrefix(`/api`)"
    - "traefik.http.routers.api.service=api"
    - "traefik.http.services.api.loadbalancer.server.port=8585"
    - "traefik.http.services.api.loadbalancer.server.scheme=http"
    - "traefik.expose=true"
  networks:
    - reportportal
  restart: always

jobs:
  image: reportportal/service-jobs:5.11.1
  container_name: reportportal-jobs
  logging:
    <<: *logging
  depends_on:
    gateway:
      condition: service_started
  environment:
    RP_DB_HOST: postgres
    RP_DB_USER: *db_user
    RP_DB_PASS: *db_password
    RP_DB_NAME: *db_name
    RP_AMQP_HOST: *rabbitmq_host
    RP_AMQP_PORT: *rabbitmq_port
    RP_AMQP_USER: *rabbitmq_user
    RP_AMQP_PASS: *rabbitmq_password
    RP_AMQP_API-ADDRESS: *rabbitmq_api_host
    RP_AMQP_APIUSER: *rabbitmq_user
    RP_AMQP_APIPASS: *rabbitmq_password
    RP_AMQP_ANALYZER-VHOST: fs-qa-reportportal-analyzer-vh
    RP_AMQP_BASE-VHOST: fs-qa-reportportal-api-vh
    DATASTORE_TYPE: filesystem
    RP_ENVIRONMENT_VARIABLE_CLEAN_ATTACHMENT_CRON: 0 0 */24 * * *
    RP_ENVIRONMENT_VARIABLE_CLEAN_LOG_CRON: 0 0 */24 * * *
    RP_ENVIRONMENT_VARIABLE_CLEAN_LAUNCH_CRON: 0 0 */24 * * *
    RP_ENVIRONMENT_VARIABLE_CLEAN_STORAGE_CRON: 0 0 */24 * * *
    RP_ENVIRONMENT_VARIABLE_STORAGE_PROJECT_CRON: 0 */5 * * * *
    RP_ENVIRONMENT_VARIABLE_CLEAN_EXPIREDUSER_CRON:  0 0 */24 * * *
    RP_ENVIRONMENT_VARIABLE_CLEAN_EXPIREDUSER_RETENTIONPERIOD: 365
    RP_ENVIRONMENT_VARIABLE_NOTIFICATION_EXPIREDUSER_CRON: 0 0 */24 * * * 
    RP_ENVIRONMENT_VARIABLE_CLEAN_EVENTS_RETENTIONPERIOD: 365
    RP_ENVIRONMENT_VARIABLE_CLEAN_EVENTS_CRON: 0 30 05 * * *
    RP_ENVIRONMENT_VARIABLE_CLEAN_STORAGE_CHUNKSIZE: 20000
    RP_PROCESSING_LOG_MAXBATCHSIZE: 2000
    RP_PROCESSING_LOG_MAXBATCHTIMEOUT: 6000
    RP_AMQP_MAXLOGCONSUMER: 1
    JAVA_OPTS: >
      -Djava.security.egd=file:/dev/./urandom
      -XX:+UseG1GC
      -XX:+UseStringDeduplication
      -XX:G1ReservePercent=20
      -XX:InitiatingHeapOccupancyPercent=60
      -XX:MaxRAMPercentage=70.0
      -XX:+HeapDumpOnOutOfMemoryError
      -XX:HeapDumpPath=/tmp
  volumes:
    - storage:/data/storage
  healthcheck:
    test: curl -f http://0.0.0.0:8686/health || exit 1
    interval: 60s
    timeout: 30s
    retries: 10
    start_period: 60s
  labels:
    - traefik.http.middlewares.jobs-strip-prefix.stripprefix.prefixes=/jobs
    - traefik.http.routers.jobs.middlewares=jobs-strip-prefix@docker
    - traefik.http.routers.jobs.rule=PathPrefix(`/jobs`)
    - traefik.http.routers.jobs.service=jobs
    - traefik.http.services.jobs.loadbalancer.server.port=8686
    - traefik.http.services.jobs.loadbalancer.server.scheme=http
    - traefik.expose=true
  networks:
    - reportportal
  restart: always
raikbitters commented 1 month ago

@hlebkanonik hello. Could you check the configuration? Maybe I'm missing something.

raikbitters commented 1 month ago

Thanks @raikbitters. I see the same error "Not administrator user" and my changes are below. API credentials are correct otherwise we will not see this error. It is still trying to createfs-qa-reportportal-analyzer-vh and the PUT fails. The on-prem instance already has both the vhosts created and access granted for same user. Please help.

RP_AMQP_API-ADDRESS: https://xxx:xxxx@rabbitmq-external-console.xxx.com/api
RP_AMQP_ANALYZER-VHOST: fs-qa-reportportal-analyzer-vh
RP_AMQP_BASE-VHOST: fs-qa-reportportal-api-vh

@nevesing hello. Did you provide credentials of admin user?

@raikbitters yes the admin credentials I used is for the vhosts (fs-qa-reportportal-analyzer-vh and fs-qa-reportportal-api-vh) only (not for the entire managed rabbitmq instance)

@nevesing, could you give temporary admin access to the whole instance for testing? Maybe API Service use some common API.

nevesing commented 1 month ago

Thanks @raikbitters. I see the same error "Not administrator user" and my changes are below. API credentials are correct otherwise we will not see this error. It is still trying to createfs-qa-reportportal-analyzer-vh and the PUT fails. The on-prem instance already has both the vhosts created and access granted for same user. Please help.

RP_AMQP_API-ADDRESS: https://xxx:xxxx@rabbitmq-external-console.xxx.com/api
RP_AMQP_ANALYZER-VHOST: fs-qa-reportportal-analyzer-vh
RP_AMQP_BASE-VHOST: fs-qa-reportportal-api-vh

@nevesing hello. Did you provide credentials of admin user?

@raikbitters yes the admin credentials I used is for the vhosts (fs-qa-reportportal-analyzer-vh and fs-qa-reportportal-api-vh) only (not for the entire managed rabbitmq instance)

@nevesing, could you give temporary admin access to the whole instance for testing? Maybe API Service use some common API.

@raikbitters Yes the global admin works always. However it is not allowed since I can create 100s of new vhosts as i wish.

https://www.rabbitmq.com/docs/vhosts#using-http-api

A virtual host can be created using the PUT /api/vhosts/{name} HTTP API endpoint where {name} is the name of the virtual host