From 5fbbfba593730e49a241775d82794a92027284dc Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Fri, 1 May 2020 17:42:59 -0400 Subject: [PATCH 1/8] Configure endpoint for healthcheck --- server/Dockerfile | 14 +++++++++++++- server/nginx.conf | 10 ++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 server/nginx.conf diff --git a/server/Dockerfile b/server/Dockerfile index 7c6cc7f..1499287 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,6 +1,7 @@ FROM fedora:32 -RUN /bin/bash -c "dnf install g++ enet-devel gtest gmock gmock-devel gtest-devel -y" +# Build and setup app +RUN dnf install g++ enet-devel gtest gmock gmock-devel gtest-devel -y ADD / /dt @@ -8,4 +9,15 @@ RUN cd /dt; /dt/build.sh CMD ["/dt/builds/server.out"] +# Setup status endpoint +RUN dnf install nginx -y + +COPY nginx.conf /etc/nginx/conf.d/nginx.conf + +RUN rm /etc/nginx/conf.d/default.conf + +RUN systemctl start nginx.service + + +EXPOSE 80/tcp EXPOSE 7777/udp \ No newline at end of file diff --git a/server/nginx.conf b/server/nginx.conf new file mode 100644 index 0000000..1477c33 --- /dev/null +++ b/server/nginx.conf @@ -0,0 +1,10 @@ +server { + location / { + root /usr/share/nginx/html; + } + + location /health { + return 200 'alive'; + add_header Content-Type text/plain; + } +} \ No newline at end of file From fb236647a3a25f098c8a4c9a07c77ed629800b20 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Fri, 1 May 2020 17:43:26 -0400 Subject: [PATCH 2/8] Configure endpoint for healthcheck --- server/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/Dockerfile b/server/Dockerfile index 1499287..a27ebde 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -16,7 +16,7 @@ COPY nginx.conf /etc/nginx/conf.d/nginx.conf RUN rm /etc/nginx/conf.d/default.conf -RUN systemctl start nginx.service +RUN systemctl enable nginx.service EXPOSE 80/tcp From 15f6a8df22c955c6bd1c2bd3f8dfae8828b2d54c Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Fri, 1 May 2020 23:45:13 -0400 Subject: [PATCH 3/8] Update healthcheck to run --- infrastructure/cloudformation/dt/load_balancing.yaml | 2 ++ server/Dockerfile | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/infrastructure/cloudformation/dt/load_balancing.yaml b/infrastructure/cloudformation/dt/load_balancing.yaml index 471b2f8..6d4c666 100644 --- a/infrastructure/cloudformation/dt/load_balancing.yaml +++ b/infrastructure/cloudformation/dt/load_balancing.yaml @@ -37,6 +37,8 @@ Resources: NlbTargetGroup: Type: AWS::ElasticLoadBalancingV2::TargetGroup Properties: + HealthCheckPort: 80 + HealthCheckProtocol: HTTP Port: 7777 Protocol: TCP_UDP TargetGroupAttributes: diff --git a/server/Dockerfile b/server/Dockerfile index a27ebde..ea72233 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -14,10 +14,7 @@ RUN dnf install nginx -y COPY nginx.conf /etc/nginx/conf.d/nginx.conf -RUN rm /etc/nginx/conf.d/default.conf - RUN systemctl enable nginx.service - EXPOSE 80/tcp EXPOSE 7777/udp \ No newline at end of file From 4caab6926662340ed7121d972c6fe34fa00d8477 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Fri, 1 May 2020 23:52:20 -0400 Subject: [PATCH 4/8] HOTFIX: Fix healthcheck protocol --- infrastructure/cloudformation/dt/load_balancing.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/cloudformation/dt/load_balancing.yaml b/infrastructure/cloudformation/dt/load_balancing.yaml index 6d4c666..f923999 100644 --- a/infrastructure/cloudformation/dt/load_balancing.yaml +++ b/infrastructure/cloudformation/dt/load_balancing.yaml @@ -38,7 +38,7 @@ Resources: Type: AWS::ElasticLoadBalancingV2::TargetGroup Properties: HealthCheckPort: 80 - HealthCheckProtocol: HTTP + HealthCheckProtocol: TCP Port: 7777 Protocol: TCP_UDP TargetGroupAttributes: From f4e1d3a3b896ea4a0a7629f9a5bd40dc3040b9cf Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Fri, 1 May 2020 23:57:09 -0400 Subject: [PATCH 5/8] HOTFIX: Expose healthcheck port task --- infrastructure/cloudformation/dt/task.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/infrastructure/cloudformation/dt/task.yaml b/infrastructure/cloudformation/dt/task.yaml index 0de2430..498f09b 100644 --- a/infrastructure/cloudformation/dt/task.yaml +++ b/infrastructure/cloudformation/dt/task.yaml @@ -36,6 +36,9 @@ Resources: - HostPort: 0 ContainerPort: 7777 Protocol: udp + - HostPort: 0 + ContainerPort: 80 + Protocol: tcp LogConfiguration: LogDriver: awslogs Options: From 11a41fdca791f0eb563ed5453da5c4c1da23f91a Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Sat, 2 May 2020 00:02:21 -0400 Subject: [PATCH 6/8] HOTFIX: Make healthcheck UDP & remove TCP endpoint --- infrastructure/cloudformation/dt/load_balancing.yaml | 6 ++---- infrastructure/cloudformation/dt/task.yaml | 3 --- server/Dockerfile | 8 -------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/infrastructure/cloudformation/dt/load_balancing.yaml b/infrastructure/cloudformation/dt/load_balancing.yaml index f923999..3c4a1bf 100644 --- a/infrastructure/cloudformation/dt/load_balancing.yaml +++ b/infrastructure/cloudformation/dt/load_balancing.yaml @@ -37,10 +37,8 @@ Resources: NlbTargetGroup: Type: AWS::ElasticLoadBalancingV2::TargetGroup Properties: - HealthCheckPort: 80 - HealthCheckProtocol: TCP Port: 7777 - Protocol: TCP_UDP + Protocol: UDP TargetGroupAttributes: - Key: deregistration_delay.timeout_seconds Value: '20' @@ -57,7 +55,7 @@ Resources: TargetGroupArn: !Ref NlbTargetGroup LoadBalancerArn: !Ref PublicNLB Port: 7777 - Protocol: TCP_UDP + Protocol: UDP Outputs: diff --git a/infrastructure/cloudformation/dt/task.yaml b/infrastructure/cloudformation/dt/task.yaml index 498f09b..0de2430 100644 --- a/infrastructure/cloudformation/dt/task.yaml +++ b/infrastructure/cloudformation/dt/task.yaml @@ -36,9 +36,6 @@ Resources: - HostPort: 0 ContainerPort: 7777 Protocol: udp - - HostPort: 0 - ContainerPort: 80 - Protocol: tcp LogConfiguration: LogDriver: awslogs Options: diff --git a/server/Dockerfile b/server/Dockerfile index ea72233..6822f5b 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -9,12 +9,4 @@ RUN cd /dt; /dt/build.sh CMD ["/dt/builds/server.out"] -# Setup status endpoint -RUN dnf install nginx -y - -COPY nginx.conf /etc/nginx/conf.d/nginx.conf - -RUN systemctl enable nginx.service - -EXPOSE 80/tcp EXPOSE 7777/udp \ No newline at end of file From db37a8c924f97c056ed717050e2bbed80ac0d3fa Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Sat, 2 May 2020 00:16:51 -0400 Subject: [PATCH 7/8] Reimplement healthcheck without forcing port --- infrastructure/cloudformation/dt/task.yaml | 3 +++ server/Dockerfile | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/infrastructure/cloudformation/dt/task.yaml b/infrastructure/cloudformation/dt/task.yaml index 0de2430..498f09b 100644 --- a/infrastructure/cloudformation/dt/task.yaml +++ b/infrastructure/cloudformation/dt/task.yaml @@ -36,6 +36,9 @@ Resources: - HostPort: 0 ContainerPort: 7777 Protocol: udp + - HostPort: 0 + ContainerPort: 80 + Protocol: tcp LogConfiguration: LogDriver: awslogs Options: diff --git a/server/Dockerfile b/server/Dockerfile index 6822f5b..ea72233 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -9,4 +9,12 @@ RUN cd /dt; /dt/build.sh CMD ["/dt/builds/server.out"] +# Setup status endpoint +RUN dnf install nginx -y + +COPY nginx.conf /etc/nginx/conf.d/nginx.conf + +RUN systemctl enable nginx.service + +EXPOSE 80/tcp EXPOSE 7777/udp \ No newline at end of file From 31831ff9d1015992bc58f703997aa97a533bf193 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Sat, 2 May 2020 00:31:34 -0400 Subject: [PATCH 8/8] Reimplement healthcheck without forcing port --- infrastructure/cloudformation/dt/load_balancing.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/cloudformation/dt/load_balancing.yaml b/infrastructure/cloudformation/dt/load_balancing.yaml index 3c4a1bf..471b2f8 100644 --- a/infrastructure/cloudformation/dt/load_balancing.yaml +++ b/infrastructure/cloudformation/dt/load_balancing.yaml @@ -38,7 +38,7 @@ Resources: Type: AWS::ElasticLoadBalancingV2::TargetGroup Properties: Port: 7777 - Protocol: UDP + Protocol: TCP_UDP TargetGroupAttributes: - Key: deregistration_delay.timeout_seconds Value: '20' @@ -55,7 +55,7 @@ Resources: TargetGroupArn: !Ref NlbTargetGroup LoadBalancerArn: !Ref PublicNLB Port: 7777 - Protocol: UDP + Protocol: TCP_UDP Outputs: