Skip to content

Commit

Permalink
Add support for clickhouse proxy inside of reverse-proxy config
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Nov 25, 2024
1 parent 986701a commit d6ccc86
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ooniapi/services/reverseproxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM nginx:1.27.1
ENV TARGET_URL="https://backend-hel.ooni.org"
ENV CLICKHOUSE_STREAM_TARGET="clickhouse1.prod.ooni.io:9000"

COPY default.conf.template /etc/nginx/templates/
COPY templates/backend-proxy.conf.template /etc/nginx/templates/
COPY templates/clickhouse-proxy.conf.stream-template /etc/nginx/templates/
29 changes: 29 additions & 0 deletions ooniapi/services/reverseproxy/buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 0.2
env:
variables:
OONI_CODE_PATH: ooniapi/services/reverseproxy
DOCKERHUB_SECRET_ID: oonidevops/dockerhub/access_token

phases:
install:
runtime-versions:
python: 3.11

pre_build:
commands:
- echo "Logging in to dockerhub"
- DOCKER_SECRET=$(aws secretsmanager get-secret-value --secret-id $DOCKERHUB_SECRET_ID --query SecretString --output text)
- echo $DOCKER_SECRET | docker login --username ooni --password-stdin

build:
commands:
- export GIT_FULL_SHA=${CODEBUILD_RESOLVED_SOURCE_VERSION}
- cd $OONI_CODE_PATH
- make docker-build
- make docker-smoketest
- make docker-push
- make imagedefinitions.json
- cat imagedefinitions.json | tee ${CODEBUILD_SRC_DIR}/imagedefinitions.json

artifacts:
files: imagedefinitions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
upstream clickhouse_backend {
server ${CLICKHOUSE_STREAM_TARGET};
}

server {
listen 9000;
proxy_pass clickhouse_backend;
}

0 comments on commit d6ccc86

Please sign in to comment.