Spring Boot App Restarting on Railway – DB Config Issue?
eyanyehya
PROOP

a year ago

Hey all, I’m trying to deploy a Spring Boot 3.4.2 backend on Railway with PostgreSQL.

My application.properties uses:

spring.datasource.url=${DATABASEURL} spring.datasource.username=${DATABASEUSERNAME}
spring.datasource.password=${DATABASE_PASSWORD}
spring.datasource.driver-class-name=org.postgresql.Driver
On Railway, I’ve set the variables based on the default PostgreSQL plugin values.

Logs show the app starts normally, finds all JPA repositories, then after Tomcat started on port 8080, it just silently restarts.

No obvious exceptions — it seems to crash right after everything boots.

Could this be a DATABASE_URL formatting issue? Or am I missing something about how Railway injects environment variables into the container?

Any help would be appreciated 🙏

Solved

10 Replies

a year ago

check your activity logs, are you running out of memory


eyanyehya
PROOP

a year ago

Yes Im getting an email: Deploy Ran Out of Memory!
Uh oh. Your deployment for tutor-app-platform in beautiful-radiance ran out of memory within the production environment and crashed.


eyanyehya
PROOP

a year ago

Its my first time deploying a spring boot app so I could be missing something obvious


eyanyehya
PROOP

a year ago

Im using dockerfile


a year ago

you are limited to 500mb of memory on trial, since you need more you will need to upgrade to a paid plan


eyanyehya
PROOP

a year ago

Just to check in order to connect Spring boot app to PgSql database I need spring.datasource.url=${DATABASEURL} with DATABASEURL being jdbc:postgresql://postgres.railway.internal:5432/railway


eyanyehya
PROOP

a year ago

But the fact that it seems to restart spring boot without throwing any clear errors makes me think its an issue of misconfigured environment more than memory


eyanyehya
PROOP

a year ago

I appreciate the help Brody


a year ago

the error you got says you ran out of memory


a year ago

!s


Status changed to Solved brody 12 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...