R
Railway8mo ago
maddsua

build fails on redeploy from ui

So I use a dockerfile to deploy my service using cli, the entire image only consist of a single js file and it seems like railway grabs the entire directory anyway and then tries to build the the thing from the wrong files and fails. Is it time to use .railwayignore?
Solution:
tl;dr dont let railway's ui redeploy your service, cancel it and use the bookmarklet
Jump to solution
33 Replies
Percy
Percy8mo ago
Project ID: 1f0944a2-14bd-447c-bb7f-2d7bedb23ed1
maddsua
maddsua8mo ago
1f0944a2-14bd-447c-bb7f-2d7bedb23ed1 dockerfile for the reference:
FROM denoland/deno:alpine

WORKDIR /app/

COPY ./.build/run.js /app/

RUN deno cache -r run.js

EXPOSE 8080

CMD deno run --allow-env --allow-read --allow-net run.js
FROM denoland/deno:alpine

WORKDIR /app/

COPY ./.build/run.js /app/

RUN deno cache -r run.js

EXPOSE 8080

CMD deno run --allow-env --allow-read --allow-net run.js
Brody
Brody8mo ago
yes railway would gzip the entire directory as long as the file / folder is not in either a .gitignore or a .railwayignore
maddsua
maddsua8mo ago
I'll try that oh great now it doesn't see the files kekw I just make it use the same commands as in dockerfile?
Brody
Brody8mo ago
not really how that works
maddsua
maddsua8mo ago
thonk foolery intensifies well I guess I can fix it in cicd
Brody
Brody8mo ago
run.js is going to be the only file copied into the image, what does it matter if the rest of the directory is uploaded?
maddsua
maddsua8mo ago
because railway tries to run index.ts that is also copied and that big boi won't run without being bundled first this is all happening on redeploy
Brody
Brody8mo ago
then railway may be running old code, and thats another issue
maddsua
maddsua8mo ago
thonk
Brody
Brody8mo ago
or you have a start command set in the service settings
maddsua
maddsua8mo ago
nope I don't
Brody
Brody8mo ago
then its the first option use this to do your redeploys https://bookmarklets.up.railway.app/service-redeploy/
maddsua
maddsua8mo ago
railway does it automatically each time an env variable is changed
maddsua
maddsua8mo ago
actually the problematic part is "build" step
No description
maddsua
maddsua8mo ago
where does it even take it from 😁 it just uses the default step for deno which is not required here
Brody
Brody8mo ago
i know, its a bug that im going to be pressing the team to fix it caused a lot of issues when people went to redeploy their services after they went down yesterday
maddsua
maddsua8mo ago
so it shouldn't redeploy when that happens? Im confused (just a bit)
Brody
Brody8mo ago
railways auto redeploy on variable change can deploy old code
maddsua
maddsua8mo ago
oh got it but there's no "old" code per say
Brody
Brody8mo ago
there is somewhere old deployment, same same
maddsua
maddsua8mo ago
you mean like parts of the deploy it takes as the base or one before it? because here it never had that index.ts as the input
Brody
Brody8mo ago
railways auto redeploy on variable change can deploy your very first deployment
maddsua
maddsua8mo ago
okay, got it but I don't think it's related the actual build is handled by gitlab railway just gets the js file
Brody
Brody8mo ago
😐
maddsua
maddsua8mo ago
thonk
Brody
Brody8mo ago
this thread is titled "build fails on redeploy from ui" so yes it is related
maddsua
maddsua8mo ago
it's 11 pm I may be dumb rn yeah but it fails due to railway trying to execute that "build" step, not the old code
Solution
Brody
Brody8mo ago
tl;dr dont let railway's ui redeploy your service, cancel it and use the bookmarklet
maddsua
maddsua8mo ago
okay fair
Brody
Brody8mo ago
trust, auto redeploy is bugged in likely more ways then im describing here
maddsua
maddsua8mo ago
well I'll do more stuff with ci to make it more smooth anyway to give it absolutely zero chances I'm too lazy to cancel =)
Brody
Brody8mo ago
gotta cancel or theres only going to be more head aches nearly everyone who didnt use the bookmarklet and wasn’t deploying an image had issues yesterday