Is it possible to run docker compose as a railway service

AnonymousTRIAL

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

AnonymousTRIAL

a year ago

b70c2b91-7e72-49ce-a124-ecb0f1d43ff9


AnonymousTRIAL

a year ago

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?


AnonymousTRIAL

a year ago

Haha yes, it's more of a 'test' if you would. ENV vars are hardcoded


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


AnonymousTRIAL

a year ago

I see. It is running with this configuration on my machine, but I imagine it would be different running in a railway environment>?


AnonymousTRIAL

a year ago

?*


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


AnonymousTRIAL

a year ago

Well yes, again I was more interested in a quick test and this would never actually come close to production


AnonymousTRIAL

a year ago

or anything that anybody could use


AnonymousTRIAL

a year ago

before I could delete it


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


AnonymousTRIAL

a year ago

Totally


AnonymousTRIAL

a year ago

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


AnonymousTRIAL

a year ago

It's an old application of mine, was trying to port for fun


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 ❤️


AnonymousTRIAL

a year ago

hahaha


AnonymousTRIAL

a year ago

none taken


AnonymousTRIAL

a year ago

lol


AnonymousTRIAL

a year ago

i respect it


AnonymousTRIAL

a year ago

this is horrible secrets management


AnonymousTRIAL

a year ago

do not attempt at home


AnonymousTRIAL

a year ago

kids** if you're reading


a year ago

i mean even supabase has a bad compose file, so its not even really your fault


AnonymousTRIAL

a year ago

that makes me feel a bit better


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


AnonymousTRIAL

a year ago

I'll come back to you


a year ago

sounds good