I can't deploy my application
nhatminhgit
FREEOP

a year ago

When Deploying my application was completed , I open the link to (https://amusing-adaptation-production.up.railway.app/) but it is a bad gateway 502.

Can someone help solve this problem ?

51 Replies

smoothcubegit
HOBBY

a year ago

Can you type N/A or your project ID

Else this will be closed automatically by @Percy


nhatminhgit
FREEOP

a year ago

MySQL-8daA


nhatminhgit
FREEOP

a year ago

N/A


smoothcubegit
HOBBY

a year ago

can you share the deployment logs?


nhatminhgit
FREEOP

a year ago

Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/5d5e3f28-b1ae-4059-8080-89521d502fdb/vol_tjr5lr8ublg0xs8w

Starting Container

2025-05-05 08:09:26+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.3.0-1.el9 started.

2025-05-05 08:09:27+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'

2025-05-05 08:09:27+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 9.3.0-1.el9 started.

'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'

2025-05-05T08:09:28.650305Z 0 [System] [MY-015015] [Server] MySQL Server - start.

2025-05-05T08:09:28.786758Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 9.3.0) starting as process 1

2025-05-05T08:09:28.794878Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

2025-05-05T08:09:29.949931Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.

2025-05-05T08:09:31.016432Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.

2025-05-05T08:09:31.016487Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.

2025-05-05T08:09:31.022240Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.

2025-05-05T08:09:31.065971Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock

2025-05-05T08:09:31.066089Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '9.3.0' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.


smoothcubegit
HOBBY

a year ago

are there any more logs that you could share?


nhatminhgit
FREEOP

a year ago


smoothcubegit
HOBBY

a year ago

The root of your crash: An infinite restart loop

Your app is repeatedly restarting:

Starting FashionWebApplication v0.0.1-SNAPSHOT using Java 17.0.7 with PID 1 ...

This exact log appears twice within ~30 seconds, and nothing indicates clean shutdown or startup success. That means:

Your Spring Boot app starts, logs a bunch of info, Then crashes silently.

Railway restarts it automatically, which creates the illusion of a "crash loop" with no obvious error.

.


smoothcubegit
HOBBY

a year ago

To debug you can...

Set logging.level.root=DEBUG in your application.properties

Add --debug to your Spring Boot startup command


smoothcubegit
HOBBY

a year ago

This means...

Set server.port=${PORT} in your application.properties

Double-check DB connection values (use Railway's environment variables)

Enable debug logging for more output:

logging.level.root=DEBUG

spring.main.banner-mode=log

If possible, run the .jar locally with the same environment to reproduce the crash.


smoothcubegit
HOBBY

a year ago

Does this make sense? Or do you need clarification?

If it doesn't work you can message back!


nhatminhgit
FREEOP

a year ago

Thank you very much


nhatminhgit
FREEOP

a year ago

@OctoCubee I still encounter this error even though I have set server.port=${8080} and logging.level.root=DEBUG spring.main.banner-mode=log

1368892841601794110


nhatminhgit
FREEOP

a year ago

and I also ran to check my .jar successfully


smoothcubegit
HOBBY

a year ago

The message that shows up means that there's an issue in your code on deploy. Do you have any code that could be causing this?


nhatminhgit
FREEOP

a year ago

I don't know because my code seem run fine


smoothcubegit
HOBBY

a year ago

You might need to add logging in your code for deploy so we can workout what the issue is


nhatminhgit
FREEOP

a year ago

Okay let me do that, thank you <:salute:1137099685417451530>


nhatminhgit
FREEOP

a year ago

@OctoCubee oh I got this email

1368898525542219867


nhatminhgit
FREEOP

a year ago

My account still have memory


smoothcubegit
HOBBY

a year ago

are you using the trial plan?


nhatminhgit
FREEOP

a year ago

yes


smoothcubegit
HOBBY

a year ago

your "amusing adaption" doesnt have enough memory


smoothcubegit
HOBBY

a year ago

can you go to the metrics for it?


smoothcubegit
HOBBY

a year ago

example

1368898981345759312


nhatminhgit
FREEOP

a year ago

1368899019111403530


smoothcubegit
HOBBY

a year ago

You seem to peak to the very top when you start the deployment


smoothcubegit
HOBBY

a year ago

Im not too sure sorry, you need to add logging and look through your code to see where it could crash


nhatminhgit
FREEOP

a year ago

Okay thank you


nhatminhgit
FREEOP

a year ago

@OctoCubee May you teach me how to log ? I am so confused rn


smoothcubegit
HOBBY

a year ago

I don't have any detail on what language you're using and other things


nhatminhgit
FREEOP

a year ago

I use java with spring boot and html, css and js and also I store pics on cloudinary


smoothcubegit
HOBBY

a year ago

okay, to log you can do > System.out.println("This is a log message.");


nhatminhgit
FREEOP

a year ago

@OctoCubee Excuse me but is it possible to have error here ?

1368902596760178739


smoothcubegit
HOBBY

a year ago

I would say to use the generated domain rather than TCP, so yes probably some sort of error xD


nhatminhgit
FREEOP

a year ago

spring.application.name=Fashion_Web

server.port=${PORT:8080}

Railway database

spring.datasource.url=jdbc:mariadb://turntable.proxy.rlwy.net:59479/railway?useSSL=false

spring.datasource.username=root

spring.datasource.password=

spring.datasource.driver-class-name=org.mariadb.jdbc.Driver

spring.jpa.hibernate.ddl-auto=update

spring.jpa.show-sql=true

spring.mvc.view.prefix=classpath:/templates/

spring.mvc.view.suffix=.html

Bạn có thể giữ lại cấu hình database local (đã comment) để dễ dàng chuyển đổi khi cần

#Local database

spring.datasource.url=jdbc:mariadb://localhost:3306/fashionshop?useSSL=false

spring.messages.encoding=UTF-8

server.servlet.encoding.force=true

server.servlet.encoding.charset=UTF-8

logging.level.org.hibernate.SQL=debug

logging.level.org.hibernate.type.descriptor.sql.BasicBinder=trace

#Chat bot api

gemini.api.key=

qdrant.url=http://localhost:6333

#Cloudinary api

cloudinary.cloud_name=dgtfqxgvx

cloudinary.api_key=

cloudinary.api_secret=

spring.servlet.multipart.max-file-size=10MB

spring.servlet.multipart.max-request-size=10MB

C?u hình Elasticsearch

spring.elasticsearch.rest.uris=https://my-elasticsearch-project-ada03b.es.us-east-1.aws.elastic.cloud:443

spring.elasticsearch.rest.username= # N?u Elasticsearch có authentication

logging.level.root=DEBUG

spring.main.banner-mode=log

here is my application.properties


nhatminhgit
FREEOP

a year ago

Do I config it correctly ?


smoothcubegit
HOBBY

a year ago

warning! You've shared some sensitive credentials!!

passwords etc


nhatminhgit
FREEOP

a year ago

I deleted other key


smoothcubegit
HOBBY

a year ago

amazing!


smoothcubegit
HOBBY

a year ago

okay a few things i can see


smoothcubegit
HOBBY

a year ago

spring.datasource.url=jdbc:mariadb://turntable.proxy.rlwy.net:59479/railway?useSSL=false

Railway uses SSL by itself


smoothcubegit
HOBBY

a year ago

so you can set it to true


smoothcubegit
HOBBY

a year ago

Your application.properties file is mostly correct, but to make it more secure and flexible, you should move sensitive information like database passwords and API keys to environment variables, ensure only one database configuration is active at a time (comment the other), and consider using separate configuration profiles (e.g., application-dev.properties and application-prod.properties) to easily switch between local and production environments.


nhatminhgit
FREEOP

a year ago

Thanks for the advices ❤️


smoothcubegit
HOBBY

a year ago

Mysql isnt that well known to me, so you can always use AI to debug and hopefully fix it :)


nhatminhgit
FREEOP

a year ago

@OctoCubee Please excuse but is this cause 502 error ?

1368912532303118498


smoothcubegit
HOBBY

a year ago

Im sorry, I cannot assist any further


nhatminhgit
FREEOP

a year ago

@OctoCubee Once again, thanks for your help <:salute:1137099685417451530> . Last night I deployed it successfully.


smoothcubegit
HOBBY

a year ago

No problemo!


a year ago

thanks @OctoCubee <:salute:1137099685417451530>


Welcome!

Sign in to your Railway account to join the conversation.

Loading...