R
Railway•3mo ago
Patrick Piel

Docker based application cannot be redeployed successfully (502 Gateway Error)

Hello everybody, Since a month we have a issue with one specific service within our production environment. After the first request the deployed instance crashes. The instance is "just" a Java (Spring) application living inside a Docker container. The codebase as the corresponding Dockerfile didn't changed.
FROM maven:3-amazoncorretto-21 AS build
COPY . /home/app
RUN mvn -f /home/app/pom.xml clean package

FROM amazoncorretto:21
COPY --from=build /home/app/bot/target/bot-1.0.0-SNAPSHOT.jar /usr/local/lib/stage.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/usr/local/lib/stage.jar", "--spring.profiles.active=prod"]
FROM maven:3-amazoncorretto-21 AS build
COPY . /home/app
RUN mvn -f /home/app/pom.xml clean package

FROM amazoncorretto:21
COPY --from=build /home/app/bot/target/bot-1.0.0-SNAPSHOT.jar /usr/local/lib/stage.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/usr/local/lib/stage.jar", "--spring.profiles.active=prod"]
The railway.json file:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "DOCKERFILE"
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "DOCKERFILE"
}
}
15 Replies
Percy
Percy•3mo ago
Project ID: a2d3c3f9-f5e5-4456-bb12-a749673c197d
Patrick Piel
Patrick PielOP•3mo ago
a2d3c3f9-f5e5-4456-bb12-a749673c197d
Brody
Brody•3mo ago
have you pointed the domain to the correct port?
Patrick Piel
Patrick PielOP•3mo ago
Yes, we changed nothing.
Brody
Brody•3mo ago
please send the domain in question
Patrick Piel
Patrick PielOP•3mo ago
vectorsphere-backend-production.up.railway.app
Brody
Brody•3mo ago
application failed to respond means your application failed to respond. please check that you are listening on the host 0.0.0.0 and your domain is pointing to the correct port.
Patrick Piel
Patrick PielOP•3mo ago
We checked. Nothing changed in the configuration. The application listens to 0.0.0.0 and points to :8080. Also the instance crashes without any error in the Observability log.
Brody
Brody•3mo ago
if it's crashing without any logs that means your application is not logging anything
Patrick Piel
Patrick PielOP•3mo ago
It should 😄 And it has before^^ Was there any changes to how docker builds are treated?
Brody
Brody•3mo ago
there has not been, this would be an application level issue, as long as your application prints logs unbuffered to stdout / stderr you will see them in the deploys logs
Patrick Piel
Patrick PielOP•3mo ago
Yes, that was the case two weeks ago. It is even possible to run the docker container locally. Could there be something else that we miss in the railway configuration?
Brody
Brody•3mo ago
yes that possible, I would focus on adding more verbose logging so you can find out why your application is crashing
Patrick Piel
Patrick PielOP•3mo ago
Okay, we will try our best^^ Thank you anyway 🙂
Brody
Brody•3mo ago
sorry i couldn't give you the answer, but railway doesn’t have any more observability into what your code does or doesn’t do than you would.
Want results from more Discord servers?
Add your server