[misc]: add http service proxy between ui and api

This commit is contained in:
41666 2019-06-05 14:21:25 -05:00
parent b90bb5c2ed
commit 0f48567f17
No known key found for this signature in database
GPG key ID: DE08FAA8925DC747
3 changed files with 28 additions and 0 deletions

View file

@ -1,6 +1,14 @@
version: '2.1' version: '2.1'
services: services:
proxy:
image: katie/roleypoly-proxy:latest
ports:
- 6770:80
environment:
UI_ADDR: 172.17.0.1:6768
API_ADDR: 172.17.0.1:6769
pg: pg:
image: postgres:10-alpine image: postgres:10-alpine
container_name: roleypoly-pg container_name: roleypoly-pg

3
etc/proxy/Dockerfile Normal file
View file

@ -0,0 +1,3 @@
FROM haproxy:1.9-alpine
ENV UI_ADDR=ui:6768 API_ADDR=api:6769
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg

17
etc/proxy/haproxy.cfg Normal file
View file

@ -0,0 +1,17 @@
frontend www-incoming
bind :80
mode http
default_backend ui
acl api_req path -i -m beg /api
acl api_req path -i -m beg /magic
use_backend api if api_req
backend ui
mode http
balance roundrobin
server server0 ${UI_ADDR} check
backend api
mode http
balance roundrobin
server server0 ${API_ADDR} check