deploy template api
Hi everyone! I'm attempting to use a template via the API, but am running into some issues. Firstly, i (for some reason) need to pass in the entire template data when publishing a template, while the templateid is sent along with the request? thats kinda weird.
Also, i filled out the entire request, only to get a vague "Failed to process request" error. Any ideas?
108 Replies
Project ID:
N/A
N/A
Here's my fetch
and here's the result
you are calling templateDeploy aka v1, you should call templateDeployV2 with the correct serialized config structure
aah, didnt know there was a v2
thanks, ill look into it!
i cant seem to find templatedeployv2 in the graphiql docs?
it really does not want me to use it
use the internal endpoint
Where is the internal endpoint?
Aha, thanks! I hope i can figure it out :happi:
a surefire way would be just to simply watch the network calls the dashboard makes
i would love to know your usecase though?
Yeah, i tried that, but it uses the v1 deployment which is a bit weird
We're making a SaaS app, that has a seperate instance per customer
We've already got r2 buckets + turnstile working, so railways the last step to get the db + front & back up
and you want to deploy a template automatically on sign up or something?
So we can just click 1 button that sets up an entire instance
Yea
Or well, we click the create button
single tenant app eh?
Yeah, we built an app for 1 client and are scaling it to work for multiple
And we thought this'd be cool
( and look good on our portfolios )
you dont think your time would be better spent converting it to a multi tenant app for better scalability?
Ehh, maybe
But it'd take a while
Cause its a pretty big app
Entire radio management system
And we're not planning on a lot of clientd
fair enough
And we just thought this would be fun haha
This is only the sidebar :NM_PepeExplode:
damn
hey i have an idea
👂
lol my cli is out of date, one sec
oooo
Yea that'd be way easier
what language where you planning to write the code to deploy a template in?
Node
then you could call out to the cli
(or bun if we're specific :bun: )
Yeah, i'll try that probablh
bun has great support for calling out to cli apps doesnt it?
Oh yeah they introduced that lately
I'll see how it goes!
let me know too!
Bun
$ Shell – API | Bun Docs
Bun's cross-platform shell-scripting API makes shell scripting with JavaScript fun
Will do
hi @Brody im continuing to harrass you, we got it (mostly) working, however the deployed template is deploying everything with docker instead of github for some reason.
so for example, we have a github repo called user/repo, but its instead read as dockerhub user/repo
is that a bug with railway(cli) or an issue on our end
let's see a service source in your template?
then yeah it's an issue with the cli, please open an issue on the repo and I will notify the person who implemented the command
GitHub
Template github source gets converted to dockerhub when using CLI t...
Hello, I'm attempting to deploy a user template using the Railway CLI. However, the GitHub source i gave to the template, gets converted to a docker source when using the Railway CLI railway de...
New reply sent from Help Station thread:
Thanks for your help, hope this gets fixed.You're seeing this because this thread has been automatically linked to the Help Station thread.
perfect thanks!
@Danny just to confirm again, you have deployed this exact same template in the dashboard just fine?
yep
@evan - the cli's deploy command is deploying GitHub repo's as docker images
!t
New reply sent from Help Station thread:
This thread has been escalated to the Railway team.You're seeing this because this thread has been automatically linked to the Help Station thread.
ack’d
this may just be a visual bug
oh yeah? I'm out so I can't test right now
thanks for the deets - i’ll follow up later tonight once i’ve dug in a bit more
I'll test when I can and update with more info too
:hmm: looking at this again - i think the UI might make sense here? since you're deploying via CLI, we're keying off of that
(even though it is a template)
sorry but im not quite getting you, what do you mean exactly
this template is getting deployed via the cli, right? (like, that is the trigger)
yea thats correct
so - even though it is connected to a source repository (ie. the template), you're manually triggering a CLI deployment
so we're keying off of that
does that make sense?
yeh, that makes sense, but i still think its a bug. when i deployed it did show some connection to a source, but it was dockerhub user/repo instead of github user/repo
do you mind sending me a link to the project?
a thanks, yh thats basically the same
o ye das weird
thx brody
will dive in 🏊♂️
heya, sorry for the ping but any updates just yet? we're kinda stuck with our project right now, no pressure of course :happi:
this shouldn’t be blocking - the deploy still goes out?
it blocks our deploy, because it attempts do deploy via docker, which wil lalways fail
hmm ok i thought it was just a visual thing - do you have the link to your project?
give me a sec, ill generate one
can just copy the url and send it here
sum small bugfixes later https://railway.app/project/9e8dfc9b-6e9e-4b3e-9b7a-0e005c42d096
Railway
Railway
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
while its set to gh from the templates
its not a visual bug, because it actually deploys images via docker
lookin
oh and it also seems like its not even trying to deploy? that might just be from the missing docker image tho
so how do you actually want this to deploy?
i want this to deploy via my github repo i have set in the template
it is a private repo, but it should work fine as im authorized to access it from my acc
might be causing the issue tho
it says "source image" in the config
so that's why it is trying to deploy as an image
yh thats the issue
swap that to be source repo
can you link me to the template?
you can unblock yourself here by swapping to the gh repo?
yea i can, but we're creating these projects programmatically, so that wouldnt really solve the main issue. ill do it ig so i can continue testng on 1 instance
could i send it in DM? its not really a public template
if it isn't a public template, nobody will be able to access it
(i will be able to see it b/c admin)
oh i can access it from incognito, prob didnt set it as a private template then :PES3_Smile:
will need to see the template to understand further
404?
uhh
thats weird
https://railway.app/template/fI0ltx
is it a published template?
ok got it now
idk whats different bout the urls but the second one works somehow :NM_peepoIdk:
second character is
i
vs l
in second link i think
hmm nvm case sensitivityaaa my clipboard lowercased it for some reason haha
nice
and you said if you deploy through the dashboard, its fine?
yep
odd
ok i've captured this all and the team member who has built all of the template stuff is on-call starting tmrw, so they should have some better context on what's going wrong here than myself
alrighty, thanku :happi:
but if you want to unblock any dev beyond deploying the template, just swap it in the dashboard to be the gh repo source obvi
yep, will do
also - you may want to look into environments depending on your use case? may be more helpful than creating projects
hmm yh that might be a good one
ill look into it
.
Confirming I understand correctly. There is a template which works fine upon deploying via the dashboard but doesn't work properly when deploying via the CLI.
Correct, the template has a service with a GitHub source, when deployed from the dashboard the service is deployed from GitHub, but when deploying the same template from the cli it's treated as an image source and it tries to pull it from the registry
Seems like the attached repos don't exist anymore? Is this using private repos?
example project and template
yeah it's private, not sure if that's a factor
Could you check if you can reproduce it with a template with a public repo?
I can tomorrow as it's quite late for me (3:40am)
You should sleep. 😴
I've checked + reproduced with a template with a public repo.
I've PR-ed a fix (https://github.com/railwayapp/cli/pull/523). Will merge upon review as I've never written Rust before.
Solution
Should be fixed in the latest release. Could you try it and let me know?
(v3.11.2) - release is still running
Was fixed in 3.11.1 no?
.2
is JRs.haha i know but it caught me off guard :kekw:
update, works!