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
Percy11mo ago
Project ID: N/A
LargeEdition
LargeEditionOP11mo ago
N/A to elaborate
LargeEdition
LargeEditionOP11mo ago
No description
LargeEdition
LargeEditionOP11mo 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
Brody11mo 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
LargeEditionOP11mo ago
kk i was able to run it in the end using a supervisor
Brody
Brody11mo ago
that works too, fwiw a separate railway service is the preferred method
LargeEdition
LargeEditionOP11mo ago
ahh i see thank you!
Brody
Brody11mo ago
no problem!
Want results from more Discord servers?
Add your server