Deploy from connected image not triggering?
I have my deployment connected to an image in ghcr.io. The first time I deployed, it worked fine; however, I just published a new image a few minutes ago, and Railway hasn't picked it up. Does it just take some time?
12fe90d4-42ca-4704-980b-e16da59696c0
Solution:Jump to solution
youd just need the project token - https://docs.railway.app/guides/cli#tokens
and then
railway redeploy -y --service <service_id>
...37 Replies
Project ID:
12fe90d4-42ca-4704-980b-e16da59696c0
we unfortunately do not monitor for newly published images, simply because there is no good way to do that, with GitHub repos, GitHub sends a webhook, but that doesn't happen when new images are publishing
Oh, that’s a shame. What’s the recommended workflow?
Well I'd first have to ask, why not simply attach the GitHub repo to the railway service and let railway build and deploy the image?
I liked the idea of deploying on tag creation vs a push to a branch
fair enough
i assume you have a gh action to build an image right?
Yes
does this action create an image with a different tag every time it builds an image?
Yes, but also updates latest
would you settle for deploying the service from latest when a new image is published?
Tbh that’s what I thought I was doing, or at least attempting
well if you are okay with that, you could call
railway redeploy
in an action?
in an action that runs after a successful image has been built that isAh, sure, I can do that
Thanks
Solution
youd just need the project token - https://docs.railway.app/guides/cli#tokens
and then
railway redeploy -y --service <service_id>
Thanks. I’ll look into it!
let me know if you get stuck!
Would this be correct?
i honestly dont know the syntax for github actions off the top of my head, but id use the docker image for the cli and an environment variable for
<service_id>
Okay, wasn't sure if the service ID should be secret or not
nope, its just a uuid
the docker image for the cliDo you mean my docker image, or is there a Railway image?
do you still need runs-on if you are providing the image? I genuinely don't know, and I'd still use a GitHub secret for the service id, while it's not sensitive, I'd image updating the service id via there GitHub UI is going to be easier / more efficient than editing the action file
the example had the
runs-on
fair, a team member didn't write that, so I'm not sure if it's correct, would you mind fact checking that?
Sure. Will probably be a couple of days before my next deployment 👍
The official GH docs show runs-on with container: https://docs.github.com/en/actions/writing-workflows/choosing-where-your-workflow-runs/running-jobs-in-a-container
GitHub Docs
Running jobs in a container - GitHub Docs
you can still trigger that action via a button though right?
Yeah, this is just the job. I cut out the rest of the workflow, which triggers on tag creation
then the example on our repo is likely correct
Cool, thanks for the help. I'll let you know if it works
(In case it helps anyone else trying the same thing)
sounds good!
@Brody the redeployment triggers work 🙂 (Though they didn't behave as I wanted this time, because my last deployment was via
railway up
, not Docker, so it didn't actually get the new code. I addressed that, so hopefully it will work correctly moving forward)yeah it's only going to deploy whatever the most recent deployment is, of you wanna redeploy from source you will need to call the API manually
Yep, makes sense
It took a moment to figure out how to redeploy via image. I thought unlinking then re-linking would do it, but I had to click redeploy from the original docker deployment
well I'm glad you've solved this