port setup problems using openshift/k8s

Hi all,

having the most strange of problems when setting up prodigy inside a docker container inside of openshift/k8s.

The demo setup is most simply:

{
  "host": "0.0.0.0",
  "port": 8080,
  "db_settings": {"sqlite": {"name": ":memory:"}}
}

with the container exposing 8080.

And it all results in this error:

So, my question is: How does prodigy set the port and may I override this?

It's a weird interaction and confusing me.

Best,

Roland

I think the problem is related to this one here: Deploy prodigy with Kubernetes and SQLite

I'm trying to remove the host/port config no completely as implied by @honnibal's comment.

Nope, wasn't the solution. It now inserts 'localhost' ahead of the tcp string:

@ines, @honnibal - you have any idea what's going on here?

One step forward towards a solution:

apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  annotations:
    openshift.io/generated-by: OpenShiftWebConsole
  creationTimestamp: '2020-03-10T11:51:31Z'
  generation: 12
  labels:
    app: prodigy-container
  name: prodigy-container
  namespace: themachine
  resourceVersion: '54275345'
  selfLink: >-
    /apis/apps.openshift.io/v1/namespaces/themachine/deploymentconfigs/prodigy-container
  uid: 7be9e271-62c5-11ea-9822-fa163efb6a9e
spec:
  replicas: 1
  selector:
    app: prodigy-container
    deploymentconfig: prodigy-container
  strategy:
    activeDeadlineSeconds: 21600
    resources: {}
    rollingParams:
      intervalSeconds: 1
      maxSurge: 25%
      maxUnavailable: 25%
      timeoutSeconds: 600
      updatePeriodSeconds: 1
    type: Rolling
  template:
    metadata:
      annotations:
        openshift.io/generated-by: OpenShiftWebConsole
      creationTimestamp: null
      labels:
        app: prodigy-container
        deploymentconfig: prodigy-container
    spec:
      containers:
        - env:
            - name: PRODIGY_PORT
              value: '8080'
          imagePullPolicy: Always
          name: prodigy-container
          ports:
            - containerPort: 8080
              name: prodigyport
              protocol: TCP

added the PRODIGY_PORT as env-var to the Deploymentconfig.

Together with the initial prodigy.json the above code is the solution. It feels like a workaround, as I still don't understand how k8s/openshift is passing the port, but it works. :slight_smile:

Glad you got it working!

Just caught up on the thread. Also not sure I fully understand what happens here exactly on the container side of things – Prodigy will read the port from the prodigy.json or the PRODIGY_PORT env var. There should be very little magic otherwise :thinking: