<p>Seems like, because the application has security enabled, the health check was not able to hit the / endpoint and the health check was failing.  When I removed the health check block I was able to access the application.  I'll add a globally-open health check endpoint and that should fix the problem I think.</p>

CC BY-SA 4.0
2019-12-03T16:03:49.310Z
2019-12-03T16:03:49.310Z
Ertai87
<p>I'm very new to DevOps but I'm trying to learn some of it a bit.  I'm working with Terraform, trying to get a service to run on AWS using Fargate and Docker.  I've successfully set up my ECR repositories, and I walked through <a href="https://medium.com/@bradford_hamilton/deploying-containers-on-amazons-ecs-using-fargate-and-terraform-part-2-2e6f6a3a957f" rel="nofollow noreferrer">this tutorial</a> on getting a service set up in Fargate.  However, I'm having a bit of a problem.  When I walked through the tutorial, everything worked more or less fine (there were some small issues but it was mostly pilot error), but when I tried to deploy my own application everything kind of exploded, and I can't figure out why.</p>

<ul>
<li>The error I'm getting is 502 Bad Gateway.</li>
<li>The application is a Java Spring application with embedded Tomcat.  I haven't changed any run configurations from the default Spring config.</li>
<li>I am able to build and Dockerize my application locally and run it through Docker on my local machine and everything works fine.</li>
<li>The only changes from the tutorial code (linked above) that I made was changing the Docker image and changing the app_port from 3000 to 8080 (I also enabled Access Logging and added an S3 bucket for that purpose)</li>
<li>The application has some auth security enabled, and when I try to hit the LB I get a login screen, so I know at least my Docker image is being pulled correctly</li>
<li>One of the errors in the task logs of my ECS instances says something about failing a health check, although I'm not able to figure out anything more than that.</li>
</ul>

<p>To be honest I'm a total newbie at DevOps anything so I have no idea what I'm doing.  Can anyone point me in some direction to help me get started?</p>

CC BY-SA 4.0
2019-12-03T15:29:35.360Z
Do you have any logs from your service?
schaiba
CC BY-SA 4.0
2019-12-03T15:36:14.687Z
Based on the logs it looks like the application successfully started using Spring (it gives all the standard Spring output all the way to where it says "Started APP_NAME", and then it just exits.  No error, no exception, nothing.
Ertai87
<docker><amazon-web-services><terraform><spring-boot>
Having some trouble getting service running with Docker and Terraform
Ertai87
# Having some trouble getting service running with Docker and Terraform

(Asked by: username_0 on 2019-12-03)

I'm very new to DevOps but I'm trying to learn some of it a bit. I'm working with Terraform, trying to get a service to run on AWS using Fargate and Docker. I've successfully set up my ECR repositories, and I walked through [this tutorial](https://medium.com/@bradford_hamilton/deploying-containers-on-amazons-ecs-using-fargate-and-terraform-part-2-2e6f6a3a957f) on getting a service set up in Fargate. However, I'm having a bit of a problem. When I walked through the tutorial, everything worked more or less fine (there were some small issues but it was mostly pilot error), but when I tried to deploy my own application everything kind of exploded, and I can't figure out why.

* The error I'm getting is 502 Bad Gateway.
* The application is a Java Spring application with embedded Tomcat. I haven't changed any run configurations from the default Spring config.
* I am able to build and Dockerize my application locally and run it through Docker on my local machine and everything works fine.
* The only changes from the tutorial code (linked above) that I made was changing the Docker image and changing the app\_port from 3000 to 8080 (I also enabled Access Logging and added an S3 bucket for that purpose)
* The application has some auth security enabled, and when I try to hit the LB I get a login screen, so I know at least my Docker image is being pulled correctly
* One of the errors in the task logs of my ECS instances says something about failing a health check, although I'm not able to figure out anything more than that.

To be honest I'm a total newbie at DevOps anything so I have no idea what I'm doing. Can anyone point me in some direction to help me get started?

**Tags:** docker, amazon-web-services, terraform, spring-boot

> **Comments:**
> **username_1**: Do you have any logs from your service?  
> **username_0**: Based on the logs it looks like the application successfully started using Spring (it gives all the standard Spring output all the way to where it says "Started APP_NAME", and then it just exits.  No error, no exception, nothing.  

---

## 1 answers

### Answer by username_0 on 2019-12-03. Score: 1 | Accepted answer

Seems like, because the application has security enabled, the health check was not able to hit the / endpoint and the health check was failing. When I removed the health check block I was able to access the application. I'll add a globally-open health check endpoint and that should fix the problem I think.


---

