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

Queue processor could not get initial token and will terminate. #34

Closed
GamerGun opened this issue Nov 30, 2020 · 6 comments
Closed

Queue processor could not get initial token and will terminate. #34

GamerGun opened this issue Nov 30, 2020 · 6 comments

Comments

@GamerGun
Copy link

GamerGun commented Nov 30, 2020

Hi,

We are in the process of running OEC on a Kubernetes cluster. In order to do so, we created the following Dockerfile;


# Install tooling
RUN apt-get update \
    && apt-get install -y curl git

# Download sources
RUN mkdir -p $GOPATH/src/github.com/opsgenie
RUN git clone https://github.com/opsgenie/oec.git $GOPATH/src/github.com/opsgenie/oec

# Build binary
WORKDIR $GOPATH/src/github.com/opsgenie/oec/main
RUN export GIT_COMMIT=$(git rev-list -1 HEAD) && \
    CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo \
        -ldflags "-X main.OECCommitVersion=$GIT_COMMIT -X main.OECVersion=1.0.1" -o nocgo -o /oec .

# Build OEC based on 
# https://github.com/opsgenie/oec/blob/master/Dockerfile
# 
FROM python:alpine3.12 as base
RUN pip install requests
RUN addgroup -S opsgenie && \
    adduser -S opsgenie -G opsgenie && \
    apk update && \
    apk add --no-cache git ca-certificates && \
    update-ca-certificates
COPY --from=builder /oec /opt/oec
RUN mkdir -p /var/log/opsgenie && \
    chown -R opsgenie:opsgenie /var/log/opsgenie && \
    chown -R opsgenie:opsgenie /opt/oec

COPY scripts /scripts

USER opsgenie
ENTRYPOINT ["/opt/oec"]

And a Helm chart with the following values;

imagePullSecrets:
- name: xxx

oec:
    APIKeySecret:
      name: opsgenie-apikey
      key: api-key
    
    # Config is the opsgenie configuration file
    # See: https://docs.opsgenie.com/docs/oec-configuration for more information
    config: |
      {
        "baseUrl": "https://xxx.opsgenie.com/",
        "logLevel": "DEBUG",
        "globalArgs": [],
        "globalFlags": {
          "url": "https://xxx/jira",
          "username": "oec",
          "password": "xxx",
          "issueTypeName": "Incident",
          "key": "XXX"
        },
        "actionMappings": {
          "createIssue": {
            "filepath": "/scripts/JiraServiceDesk/actionExecutor.py",
            "sourceType": "local",
            "env": [],
            "stdout": "/var/log/opsgenie/createIssue.txt"
          },
          "resolveIssue": {
            "filepath": "/scripts/JiraServiceDesk/actionExecutor.py",
            "sourceType": "local",
            "env": [],
            "stdout": "/var/log/opsgenie/resolveIssue.txt"
          },
          "addComment": {
            "filepath": "/scripts/JiraServiceDesk/actionExecutor.py",
            "sourceType": "local",
            "env": [],
            "stdout": "/var/log/opsgenie/addComment.txt"
          }
        },
        "pollerConf": {
          "pollingWaitIntervalInMillis": 100,
          "visibilityTimeoutInSec": 30,
          "maxNumberOfMessages": 10
        },
        "poolConf": {
          "maxNumberOfWorker": 12,
          "minNumberOfWorker": 4,
          "monitoringPeriodInMillis": 15000,
          "keepAliveTimeInMillis": 6000,
          "queueSize": 0
        }
      }

However, when we deploy this - the following FATAL error occurs;

INFO[2020-11-30T13:33:32.093400979Z] OEC commit version is 75c349516ce16838214e2949637f0770e4bfa8ce
WARNING[2020-11-30T13:33:32.093796687Z] chmod /scripts/JiraServiceDesk/actionExecutor.py: operation not permitted
WARNING[2020-11-30T13:33:32.093828124Z] chmod /scripts/JiraServiceDesk/actionExecutor.py: operation not permitted
WARNING[2020-11-30T13:33:32.093845512Z] chmod /scripts/JiraServiceDesk/actionExecutor.py: operation not permitted
INFO[2020-11-30T13:33:32.093869342Z] Visibility timeout cannot be lesser than 15 seconds or greater than 12 hours, default value[30 s.] is set.
INFO[2020-11-30T13:33:32.094102992Z] OEC-metrics serves in http://localhost:7070/metrics.
INFO[2020-11-30T13:33:32.094221808Z] Queue processor is starting.
ERROR[2020-11-30T13:33:32.23385268Z] Queue processor could not get initial token and will terminate.
FATAL[2020-11-30T13:33:32.233899316Z] EOF

Looking at this file, https://github.com/opsgenie/oec/blob/master/queue/processor.go - it expects some kind of token credentials in /v2/integrations/oec/credentials ? but this file is nowhere to be found nor do i see any references to it in the code or documentation.

What are we missing here? Thank you

@GamerGun
Copy link
Author

Anyone?

@cemkucuk
Copy link
Contributor

Hi @GamerGun! Unfortunately, we don't not provide any support for custom implementations but it may because of your outbound rules. It seems you can not reach out that endpoint.

@metehanozturk
Copy link
Contributor

Could you please be sure you provide correct apiKey and baseUrl? Also you should guarantee that your client is able to reach the endpoint as @cemkucuk said. The endpoint returns the security token which is an internal logic and if the apiKey is correctly provided, no need to worry about the token.

@GamerGun
Copy link
Author

Thank you guys.
We managed to set-up the connection with the endpoint, but now have the following issue
FATAL[2021-02-18T09:32:53.57704062Z] Token could not be received from Opsgenie, status: 403 Forbidden, message: {"message":"UnauthorizedClientException: API Key should belong to an owner to perform this action.","took":0.0,"requestId":"xxx"}
We followed this instruction: https://docs.opsgenie.com/docs/opsgenie-edge-connector-oec-action-channel
Also tried a API key from Opsgenie’s OEC Integration page as stated in https://docs.opsgenie.com/docs/oec-configuration but that didn't work either (same error).

@cemkucuk
Copy link
Contributor

@GamerGun, it should work with given api key after creation of OEC Action Channel. Please use that one because irrelevant api keys of your account can not work with OEC client.

@metehanozturk
Copy link
Contributor

Hi @GamerGun, I hope you solved API Key issue. API Keys that belong to Opsgenie Actions or Integrations would work with OEC. Also, please be sure your configuration file is updated correctly.

You can find open bugs and suggestions for OEC on our public issue tracker. If you are experiencing an issue with OEC, or if you want to raise a new bug or suggestion you can reach out Opsgenie support.

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