R
Railwayβ€’8mo ago
luckylukeSVK

Github SECRETs as base64 to FILE in JAVA SPRING project with railway ?

Hi i have simple webapp in java spring, running on tomcat server on railway.app hosting. I need insert SLL primary key and certificate files via github secrets and actions. the files will be encoded by Base64 to github secrets. Than i need by GitHub actions convert this secrets to files and put them to folder in project. The deploying off app is now automated, it deploys every time when i push to master branch. How can i do it ? Can you help me? I cannot find some deep tutorial with examples. All documentation which I found is hard to understand. srvice ID: 8a5bdf0b-f4eb-4868-a0b0-e39a55f7aa88
Solution:
Again, why are you using custom SSL certificates? Railway handles HTTPS for you.
Jump to solution
9 Replies
Percy
Percyβ€’8mo ago
Project ID: 8a5bdf0b-f4eb-4868-a0b0-e39a55f7aa88
Brody
Brodyβ€’8mo ago
@interstellartaco any ideas? πŸ™‚
root
rootβ€’8mo ago
What are you using your own SSL certificate for?
luckylukeSVK
luckylukeSVKβ€’8mo ago
ok i find another solution, where i dont need files, only env variables. it is possible to use env variables, if you have key/certificate in form of PEM style text. you need use soring sll bundle pem spring.ssl.bundle.pem.mybundle.keystore.certificate=${PRIVATE_KEY} spring.ssl.bundle.pem.mybundle.keystore.private-key=${CERTIFICATE_CRT} spring.ssl.bundle.pem.mybundle.truststore.certificate=${CA_BUNDLE} server.port=8443 server.ssl.bundle=mybundle spring dont have this clearly writen in theri documentation
Solution
root
rootβ€’8mo ago
Again, why are you using custom SSL certificates? Railway handles HTTPS for you.
root
rootβ€’8mo ago
Also, you should probably set server.port=${PORT} instead of hardcoding it.
luckylukeSVK
luckylukeSVKβ€’8mo ago
so you want to say that the everything what i need to do in spring app to enable HTTPS is what? only set server.port=${PORT} ?
root
rootβ€’8mo ago
Correct.
luckylukeSVK
luckylukeSVKβ€’8mo ago
didnt know it. i was wondering, why my page have SLL certificate before i did set the variables ..... i know the answer now, πŸ‘