daisy / pipeline

Super-project that aggregates all Pipeline related code, provides a common tracker for Pipeline related issues and holds the Pipeline website
http://daisy.github.io/pipeline
20 stars 20 forks source link

Binding to PIPELINE2_WS_HOST #717

Closed josteinaj closed 9 months ago

josteinaj commented 10 months ago

We have a file ("docker-entrypoint.sh") which I have set up to be used as the entrypoint when running Pipeline 2 in our docker environment (docker swarm):

#!/bin/bash -e

# Make sure that the Pipeline 2 Web Service can bind to the remote endpoint.
# For instance, if container is exposed as pipeline.example.com, then PIPELINE2_WS_HOST
# must be set to pipeline.example.com so that the web service responses include the
# correct hostname when returning URLs. However, the web service will also try to bind
# to the host declared in PIPELINE2_WS_HOST (this cannot be declared separately), so
# we map PIPELINE2_WS_HOST to 0.0.0.0 ("all interfaces") in /etc/hosts so that Pipeline 2
# are able to bind to the correct interface and listen for requests.

if [ "$PIPELINE2_WS_HOST" != "" ] && [ "$PIPELINE2_WS_HOST" != "0.0.0.0" ] ; then
    echo "0.0.0.0 $PIPELINE2_WS_HOST" >> /etc/hosts
fi

/opt/daisy-pipeline2/bin/pipeline2 "$@"

Let's say PIPELINE2_WS_HOST is example.com. This setup will make it bind to and use example.com as 0.0.0.0 internally, while still using example.com in API responses where there are URLs to jobs, scripts etc.

I'm not sure if this is a docker specific issue, or if it's a more general networking issue. But maybe there should be a separate environment variable for which host to bind to.

This couldmake docker setup easier, as was brought up in https://github.com/daisy/pipeline/discussions/709

bertfrees commented 9 months ago

Is this related to these issues?

I may have fixed this last year, in commit https://github.com/daisy/pipeline-framework/commit/37cf09ed474eed0ba17f8ac6c37de7338177be5e. Can you check?

josteinaj commented 9 months ago

Ah, yes, I thought I might have brought this up before. So this is a duplicate.

I'll let you know on those issues when I've tried 👍