Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Commit 3d0a846

Browse files
committed
added proxy for nginx
1 parent ef67655 commit 3d0a846

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

awscdk/awscdk/flower.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def __init__(self, scope: core.Construct, id: str, **kwargs,) -> None:
2323
scope.elasticache.elasticache.attr_redis_endpoint_address
2424
)
2525
CELERY_BROKER_URL = f"redis://{REDIS_SERVICE_HOST}:6379/0"
26+
2627
self.flower_task.add_container(
2728
"FlowerContainer",
2829
image=ecs.ContainerImage.from_registry("mher/flower"),
@@ -37,8 +38,12 @@ def __init__(self, scope: core.Construct, id: str, **kwargs,) -> None:
3738
],
3839
)
3940

41+
self.flower_task.add_container(
42+
"FlowerProxyContainer", image=ecs.AssetImage("./nginx/flowerproxy")
43+
)
44+
4045
port_mapping = ecs.PortMapping(
41-
container_port=5555, protocol=ecs.Protocol.TCP
46+
container_port=80, protocol=ecs.Protocol.TCP
4247
)
4348
self.flower_task.default_container.add_port_mappings(port_mapping)
4449

nginx/flowerproxy/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM nginx:1.18.0-alpine
2+
COPY proxy.conf /etc/nginx/nginx.conf
3+
EXPOSE 80
4+
CMD ["nginx", "-g", "daemon off;"]

nginx/flowerproxy/proxy.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
server {
2+
listen 80;
3+
charset utf-8;
4+
5+
location /flower/ {
6+
rewrite ^/flower/(.*)$ /$1 break;
7+
proxy_pass http://localhost:5555;
8+
proxy_set_header Host $host;
9+
proxy_redirect off;
10+
proxy_http_version 1.1;
11+
proxy_set_header Upgrade $http_upgrade;
12+
proxy_set_header Connection "upgrade";
13+
}
14+
}

0 commit comments

Comments
 (0)