Start an instance when deploying app on railway

My app requires program to start an instance of huey object (module similar to Celery) before starting the Flask application. Does railway have a place where I can run a command during deployment process?
9 Replies
Percy
Percy10mo ago
Project ID: N/A
LargeEdition
LargeEdition10mo ago
N/A to elaborate
LargeEdition
LargeEdition10mo ago
No description
LargeEdition
LargeEdition10mo ago
this is my cwd and to run app on local machine (not on railway), I have to run the command "huey_consumer start_huey.run" in one terminal and "py run.py" in another terminal is there a way I can do this when deploying on railway? I'm assuming you would need to add a RUN command in dockerfile?
ARG PORT=443
FROM cypress/browsers:latest

RUN apt-get install python3 -y

RUN echo $(python3 -m site --user-base)

COPY requirements.txt .

ENV PATH /home/root/.local/bin:${PATH}

RUN apt-get update && apt-get install -y python3-pip && pip install -r requirements.txt && pip install huey

RUN huey_consumer app.huey.run

COPY . .

CMD uvicorn main:app --host 0.0.0.0 --port $PORT
ARG PORT=443
FROM cypress/browsers:latest

RUN apt-get install python3 -y

RUN echo $(python3 -m site --user-base)

COPY requirements.txt .

ENV PATH /home/root/.local/bin:${PATH}

RUN apt-get update && apt-get install -y python3-pip && pip install -r requirements.txt && pip install huey

RUN huey_consumer app.huey.run

COPY . .

CMD uvicorn main:app --host 0.0.0.0 --port $PORT
this is my current dockerfile could someone help pls
Brody
Brody10mo ago
if Huey is anything like celery you absolutely don't want it to be ran during build because that's a long lived process, you would want to run it in a separate railway service
LargeEdition
LargeEdition10mo ago
kk i was able to run it in the end using a supervisor
Brody
Brody10mo ago
that works too, fwiw a separate railway service is the preferred method
LargeEdition
LargeEdition10mo ago
ahh i see thank you!
Brody
Brody10mo ago
no problem!
Want results from more Discord servers?
Add your server