Skip to content

Commit

Permalink
add test reverse proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
mucsi96 committed Jul 30, 2023
1 parent b1c983e commit 823a20f
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .devcontainer/.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ alias avv='ansible-vault view vars/vault.yaml '
alias avvi='ansible-vault view inventory.yaml'
alias mt='mvn test'
alias mr='mvn spring-boot:run -P local'
alias dc='docker compose up --build'

export WORKSPACE_ROOT=$(docker container inspect "$(hostname)" --format='{{range .Mounts}}{{if eq .Destination "/workspaces"}}{{.Source}}{{end}}{{end}}')/training-log-pro
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ RUN curl -fsSL -o get_node.sh https://deb.nodesource.com/setup_18.x \
&& chmod 700 get_node.sh \
&& ./get_node.sh

RUN apt-get -y install --no-install-recommends \
RUN apt-get update && apt-get -y install --no-install-recommends \
sshpass \
chromium \
chromium-sandbox \
chromium-driver \
temurin-17-jdk \
maven \
docker-ce-cli \
docker-compose-plugin \
nodejs \
python3 \
python3-pip
Expand Down
32 changes: 32 additions & 0 deletions test/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: '3.8'

services:
db:
image: postgres:15.2-bullseye
environment:
POSTGRES_DB: training-log
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
client:
image: mucsi96/training-log-pro-client
server:
image: mucsi96/training-log-pro-server
environment:
POSTGRES_HOSTNAME: db
POSTGRES_PORT: 5432
POSTGRES_DB: training-log
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
SPRING_ACTUATOR_PORT: 8081
SPRING_ADMIN_SERVER_HOST: localhost
SPRING_ADMIN_SERVER_PORT: 9090
WITHINGS_API_URI: https://wbsapi.withings.net
WITHINGS_CLIENT_ID: withings-client-id
WITHINGS_CLIENT_SECRET: withings-client-secret
reverse-proxy:
image: traefik
ports:
- "8080:80"
volumes:
- ${WORKSPACE_ROOT}/test/reverse_proxy/traefik_static_conf.yml:/etc/traefik/traefik.yml
- ${WORKSPACE_ROOT}/test/reverse_proxy/traefik_dynamic_conf.yml:/etc/traefik/traefik_dynamic_conf.yml
22 changes: 22 additions & 0 deletions test/reverse_proxy/traefik_dynamic_conf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
http:
routers:
client:
entryPoints:
- web
service: client
rule: PathPrefix(`/`)
servers:
entryPoints:
- web
service: server
rule: PathPrefix(`/api`)

services:
client:
loadBalancer:
servers:
- url: http://client:80
server:
loadBalancer:
servers:
- url: http://server:8080
6 changes: 6 additions & 0 deletions test/reverse_proxy/traefik_static_conf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
entryPoints:
web:
address: ":80"
providers:
file:
filename: /etc/traefik/traefik_dynamic_conf.yml

0 comments on commit 823a20f

Please sign in to comment.