a year ago
I have a fairly straightforward app running via docker compose. Is there way to get this to run on a railway service? I will post the dockerfile below. I expect I would have to make some changes to use private networking if that is the case.
services:
frontend:
build:
context: ./frontend
ports:
- "80:80"
networks:
- osft-network
backend:
build:
context: ./backend
image: osft-backend
ports:
- "3000:3000"
depends_on:
- mongodb
- redis
networks:
- osft-network
mongodb:
image: "mongo:latest"
ports:
- "27017:27017"
networks:
- osft-network
volumes:
- db_data:/data/db
environment:
MONGO_INITDB_DATABASE: osft-local
redis:
image: "redis:latest"
ports:
- "6379:6379"
networks:
- osft-network
networks:
osft-network:
driver: bridge
volumes:
db_data:
driver: local
0 Replies
Also, if this question has been answered, I would greatly appreciate a point in the right direction. Thanks.
a year ago
railway does not support docker compose, and if it did, this file only has one environment variable?
a year ago
test or not, never hardcode variables, it creates fragile systems
a year ago
mongo alone would need about 5 variables to be setup properly
I see. It is running with this configuration on my machine, but I imagine it would be different running in a railway environment>?
a year ago
running is one thing, running properly is a whole other ball game, for example mongo has no password, and your backend has no environment variable to tell it what mongo's hostname would be, same goes for redis, same also goes for the frontend, it doesnt have an environment variable to tell it the url of the backend
Well yes, again I was more interested in a quick test and this would never actually come close to production
a year ago
i understand, but i believe good practices should still be used, even for testing
a year ago
besides, this compose file would be incredibly easy to translate manually into a project, youd spend the most time removing all the hardcoded stuff
I was like 90% on my way to getting the app up and running via compose, and lazily hardcoding got it running. Totally agree that good practices should be used in testing. Thanks for letting me know that compose is not supported via railway
a year ago
well not yet at least, and im not sure how i feel about them adding support for it, after seeing this kind of compose file, no offense ❤️
a year ago
i mean even supabase has a bad compose file, so its not even really your fault
a year ago
remove all the hardcoded stuff from in your code and then id be happy to help you get this up and running on railway
a year ago
sounds good