Is it possible to run docker compose as a railway service
dontstoplovingmebaby
PROOP

2 years 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

30 Replies

dontstoplovingmebaby
PROOP

2 years ago

b70c2b91-7e72-49ce-a124-ecb0f1d43ff9


dontstoplovingmebaby
PROOP

2 years ago

Also, if this question has been answered, I would greatly appreciate a point in the right direction. Thanks.


2 years ago

railway does not support docker compose, and if it did, this file only has one environment variable?


dontstoplovingmebaby
PROOP

2 years ago

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


2 years ago

test or not, never hardcode variables, it creates fragile systems


2 years ago

mongo alone would need about 5 variables to be setup properly


dontstoplovingmebaby
PROOP

2 years ago

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


dontstoplovingmebaby
PROOP

2 years ago

?*


2 years 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


dontstoplovingmebaby
PROOP

2 years ago

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


dontstoplovingmebaby
PROOP

2 years ago

or anything that anybody could use


dontstoplovingmebaby
PROOP

2 years ago

before I could delete it


2 years ago

i understand, but i believe good practices should still be used, even for testing


2 years 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


dontstoplovingmebaby
PROOP

2 years ago

Totally


dontstoplovingmebaby
PROOP

2 years 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


dontstoplovingmebaby
PROOP

2 years ago

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


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


dontstoplovingmebaby
PROOP

2 years ago

hahaha


dontstoplovingmebaby
PROOP

2 years ago

none taken


dontstoplovingmebaby
PROOP

2 years ago

lol


dontstoplovingmebaby
PROOP

2 years ago

i respect it


dontstoplovingmebaby
PROOP

2 years ago

this is horrible secrets management


dontstoplovingmebaby
PROOP

2 years ago

do not attempt at home


dontstoplovingmebaby
PROOP

2 years ago

kids** if you're reading


2 years ago

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


dontstoplovingmebaby
PROOP

2 years ago

that makes me feel a bit better


2 years 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


dontstoplovingmebaby
PROOP

2 years ago

I'll come back to you


2 years ago

sounds good


Loading...