-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Use nginx to route requests from port 8003 to connector builder #19264
Conversation
@@ -16,7 +16,7 @@ else | |||
TEMPLATE_PATH="/etc/nginx/templates/nginx-auth.conf.template" | |||
fi | |||
|
|||
envsubst '${PROXY_PASS_WEB} ${PROXY_PASS_API} ${PROXY_PASS_RESOLVER}' < $TEMPLATE_PATH > /etc/nginx/nginx.conf | |||
envsubst '${PROXY_PASS_WEB} ${PROXY_PASS_API} ${CONNECTOR_BUILDER_SERVER_API} ${PROXY_PASS_RESOLVER}' < $TEMPLATE_PATH > /etc/nginx/nginx.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
search and replace the patterns with the value of the corresponding bash variable
https://www.baeldung.com/linux/envsubst-command#:~:text=The%20envsubst%20command%20searches%20the,envsubst%20recognizes%20only%20exported%20variables.
@@ -12,6 +12,7 @@ RUN apt-get update -y && apt-get install -y apache2-utils && rm -rf /var/lib/apt | |||
# This variable can be used to update the destintion containers that Nginx proxies to. | |||
ENV PROXY_PASS_WEB "http://airbyte-webapp:80" | |||
ENV PROXY_PASS_API "http://airbyte-server:8001" | |||
ENV CONNECTOR_BUILDER_SERVER_API "http://airbyte-connector-builder-server:80" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requests will come on port 8003, but will be forwarded to the port 80 on the connector-builder-server
docker-compose.yaml
Outdated
container_name: airbyte-connector-builder-server | ||
restart: unless-stopped | ||
ports: | ||
- 80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expose port 80 because the server runs on port 80
docker-compose.yaml
Outdated
airbyte-proxy: | ||
image: airbyte/proxy:${VERSION} | ||
container_name: airbyte-proxy | ||
ports: | ||
- 8000:8000 | ||
- 8001:8001 | ||
#- 8003:8003 FIXME: Uncomment this when enabling airbyte-connector-builder | ||
- 8003:8003 # FIXME: Uncomment this when enabling airbyte-connector-builder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forward the proxy's port 8003 to localhost:8003
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
|
||
proxy_pass "${CONNECTOR_BUILDER_SERVER_API}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#container_name: airbyte-connector-builder-server | ||
#restart: unless-stopped | ||
#ports: | ||
# - 80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expose port 80 because the server runs on port 80
airbyte-proxy: | ||
image: airbyte/proxy:${VERSION} | ||
container_name: airbyte-proxy | ||
ports: | ||
- 8000:8000 | ||
- 8001:8001 | ||
#- 8003:8003 FIXME: Uncomment this when enabling airbyte-connector-builder | ||
#- 8003:8003 # FIXME: Uncomment this when enabling airbyte-connector-builder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forward the proxy's port 8003 to localhost:8003
# auth_basic "Welcome to Airbyte"; | ||
# auth_basic_user_file /etc/nginx/.htpasswd; | ||
|
||
# proxy_pass "${CONNECTOR_BUILDER_SERVER_API}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reverts commit a2305c1.
84b6ac1
to
2e5c014
Compare
@@ -1,3 +1,15 @@ | |||
apiVersion: v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is not imported in the kube deploys (https://github.com/airbytehq/airbyte/blob/master/kube/resources/kustomization.yaml#L7)
This reverts commit 66823f2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small question but otherwise these changes LGTM!
@@ -11,7 +11,7 @@ VERSION="${VERSION:-dev}" # defaults to "dev", otherwise it is set by environmen | |||
echo "testing with proxy container airbyte/proxy:$VERSION" | |||
|
|||
function start_container () { | |||
CMD="docker run -d -p $PORT:8000 --env BASIC_AUTH_USERNAME=$1 --env BASIC_AUTH_PASSWORD=$2 --env PROXY_PASS_WEB=http://localhost --env PROXY_PASS_API=http://localhost --name $NAME airbyte/proxy:$VERSION" | |||
CMD="docker run -d -p $PORT:8000 --env BASIC_AUTH_USERNAME=$1 --env BASIC_AUTH_PASSWORD=$2 --env PROXY_PASS_WEB=http://localhost --env PROXY_PASS_API=http://localhost --env CONNECTOR_BUILDER_SERVER_API=http://localhost --name $NAME airbyte/proxy:$VERSION" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why are these just http://localhost
instead of http://localhost:PORT
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test is not spinning up the whole platform to test the routing. It's only testing that unauthenticated requests fail with a 401 error and that authenticated do not result in a 401 error
What
I misunderstood how to use the proxy to forward requests to the connector-builder-server in my original PR.
This use nginx to route requests sent to localhost:8003 to the connector-builder-server:80.
Everything is still commented out so this PR won't affect production.
How
Recommended reading order
airbyte-proxy/nginx-auth.conf.template
airbyte-proxy/nginx-no-auth.conf.template
airbyte-proxy/Dockerfile
airbyte-proxy/run.sh
airbyte-proxy/test.sh
docker-compose.yaml
🚨 User Impact 🚨
Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.
Pre-merge Checklist
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changesTests
Unit
Put your unit tests output here.
Integration
Put your integration tests output here.
Acceptance
Put your acceptance tests output here.