-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #424 from yetanalytics/proxy_example
proxy example with addtl path
- Loading branch information
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
version: "3.9" | ||
# README: | ||
# Runs a SQL LRS container and a proxy (nginx) which serves the LRS on a special path (/foo). | ||
|
||
# To run: | ||
# 1. From the load_balanced dir: docker compose up | ||
# 2. Access on port 8083 in your browser. | ||
|
||
# See the Docker Compose docs for more info: https://docs.docker.com/compose/ | ||
configs: | ||
px_config: | ||
file: ./nginx.conf | ||
|
||
volumes: | ||
db_data: | ||
|
||
services: | ||
db: | ||
image: postgres | ||
volumes: | ||
- db_data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: lrsql_user | ||
POSTGRES_PASSWORD: lrsql_password | ||
POSTGRES_DB: lrsql_db | ||
lrs: | ||
# build: ../.. # switch to this for active dev | ||
image: yetanalytics/lrsql:latest | ||
command: | ||
- /lrsql/bin/run_postgres.sh | ||
ports: | ||
- "8080:8080" | ||
depends_on: | ||
- db | ||
healthcheck: | ||
test: wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1 | ||
interval: 5s | ||
timeout: 5s | ||
retries: 10 | ||
environment: | ||
LRSQL_API_KEY_DEFAULT: my_key | ||
LRSQL_API_SECRET_DEFAULT: my_secret | ||
LRSQL_ADMIN_USER_DEFAULT: my_username | ||
LRSQL_ADMIN_PASS_DEFAULT: my_password | ||
LRSQL_ALLOW_ALL_ORIGINS: "true" | ||
#NOTE: this path var is needed to inform the frontend behavior once the app is proxied | ||
LRSQL_PROXY_PATH: /foo | ||
LRSQL_DB_HOST: db | ||
LRSQL_DB_NAME: lrsql_db | ||
LRSQL_DB_USER: lrsql_user | ||
LRSQL_DB_PASSWORD: lrsql_password | ||
# If Postgres is too slow to start, increase this | ||
LRSQL_POOL_INITIALIZATION_FAIL_TIMEOUT: 10000 | ||
LRSQL_JWT_COMMON_SECRET: sandwich #in production, this should be between 32 and 64 chars for security | ||
proxy: | ||
image: nginx:stable-alpine | ||
configs: | ||
- source: px_config | ||
target: /etc/nginx/conf.d/default.conf | ||
ports: | ||
- "8083:8083" | ||
depends_on: | ||
lrs: | ||
condition: service_healthy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
upstream backend { | ||
server lrs:8080; | ||
} | ||
|
||
server { | ||
listen 8083; | ||
|
||
include /etc/nginx/mime.types; | ||
|
||
location /foo { | ||
rewrite /foo/(.*) /$1 break; | ||
proxy_pass http://backend/; | ||
proxy_redirect off; | ||
proxy_set_header Host $host; | ||
} | ||
} |