Skip to content

Commit

Permalink
feat: ngrok static domain (keephq#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren authored Dec 4, 2023
1 parent d87a125 commit 39ff781
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 27 deletions.
1 change: 0 additions & 1 deletion docker-compose-with-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ services:
- PUSHER_PORT=6001
volumes:
- ./state:/state
# command: --multi-tenant
keep-websocket-server:
image: quay.io/soketi/soketi:1.4-16-debian
ports:
Expand Down
24 changes: 9 additions & 15 deletions docker-compose-with-otel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ services:

ports:
- "3100:3100"
command: [ "-config.file=/etc/loki/local-config.yaml"]
command: ["-config.file=/etc/loki/local-config.yaml"]

tempo:
image: grafana/tempo:latest
profiles:
- otel
command: [ "-config.file=/etc/tempo.yaml" ]
command: ["-config.file=/etc/tempo.yaml"]
volumes:
- ./otel-shared/tempo.yaml:/etc/tempo.yaml
- ./tempo-data:/tmp/tempo
ports:
- "14268:14268" # jaeger ingest
- "3200:3200" # tempo
- "14268:14268" # jaeger ingest
- "3200:3200" # tempo
- "9095:9095" # tempo grpc
- "4317:4317" # otlp grpc
- "4318:4318" # otlp http
- "9411:9411" # zipkin
- "4317:4317" # otlp grpc
- "4318:4318" # otlp http
- "9411:9411" # zipkin

prometheus:
image: prom/prometheus:latest
Expand All @@ -50,7 +50,6 @@ services:
command:
- "--config.file=/etc/alertmanager/alertmanager.yml"


grafana:
image: grafana/grafana:10.0.3
profiles:
Expand All @@ -70,7 +69,6 @@ services:
ports:
- "3001:3000"


# OpenTelemetry collector. Make sure you set USERID and GOOGLE_APPLICATION_CREDENTIALS
# environment variables for your container to authenticate correctly
otel-collector:
Expand All @@ -86,15 +84,12 @@ services:
volumes:
- ./otel-shared/otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml




keep-frontend-dev:
build:
context: .
dockerfile: docker/Dockerfile.dev.ui
ports:
- '3000:3000'
- "3000:3000"
environment:
- NEXTAUTH_SECRET=secret
- NEXTAUTH_URL=http://localhost:3001
Expand All @@ -119,7 +114,7 @@ services:
- vector_scrape=true
- service=keep-api
ports:
- '8080:8080'
- "8080:8080"
environment:
- OTEL_SERVICE_NAME=keephq
- OTLP_ENDPOINT=http://otel-collector:4317
Expand All @@ -136,7 +131,6 @@ services:
volumes:
- ./keep/keep:/code/keep
- ./state:/state

keep-websocket-server:
image: quay.io/soketi/soketi:1.4-16-debian
ports:
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ services:
- PUSHER_PORT=6001
volumes:
- ./state:/state
# command: --multi-tenant
keep-websocket-server:
image: quay.io/soketi/soketi:1.4-16-debian
ports:
Expand Down
13 changes: 12 additions & 1 deletion keep/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,19 @@ async def log_middeware(request: Request, call_next):

if os.environ.get("USE_NGROK", "false") == "true":
from pyngrok import ngrok
from pyngrok.conf import PyngrokConfig

public_url = ngrok.connect(PORT).public_url
ngrok_config = PyngrokConfig(
auth_token=os.environ.get("NGROK_AUTH_TOKEN", None)
)
# If you want to use a custom domain, set the NGROK_DOMAIN & NGROK_AUTH_TOKEN environment variables
# read https://ngrok.com/blog-post/free-static-domains-ngrok-users -> https://dashboard.ngrok.com/cloud-edge/domains
ngrok_connection = ngrok.connect(
PORT,
pyngrok_config=ngrok_config,
domain=os.environ.get("NGROK_DOMAIN", None),
)
public_url = ngrok_connection.public_url
logger.info(f"ngrok tunnel: {public_url}")
os.environ["KEEP_API_URL"] = public_url

Expand Down
40 changes: 32 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ opentelemetry-sdk = "^1.20.0"
opentelemetry-instrumentation-fastapi = "^0.41b0"
opentelemetry-instrumentation-logging = "^0.41b0"
opentelemetry-propagator-gcp = "^1.5.0"
pyngrok = "^6.0.0"
pyngrok = "^7.0.2"
google-cloud-bigquery = "^3.11.0"
websocket-client = "^1.6.0"
posthog = "^3.0.1"
Expand Down

0 comments on commit 39ff781

Please sign in to comment.