2 years ago
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?
152 Replies
2 years ago
N/A
2 years ago
Here's my fetch
2 years ago
and here's the result

2 years ago
you are calling templateDeploy aka v1, you should call templateDeployV2 with the correct serialized config structure
2 years ago
aah, didnt know there was a v2
2 years ago
thanks, ill look into it!
2 years ago
i cant seem to find templatedeployv2 in the graphiql docs?
2 years ago
it really does not want me to use it

2 years ago
use the internal endpoint
2 years ago
Where is the internal endpoint?
2 years ago
2 years ago
Aha, thanks! I hope i can figure it out
2 years ago
a surefire way would be just to simply watch the network calls the dashboard makes
2 years ago
i would love to know your usecase though?
2 years ago
Yeah, i tried that, but it uses the v1 deployment which is a bit weird
2 years ago
We're making a SaaS app, that has a seperate instance per customer
2 years ago
We've already got r2 buckets + turnstile working, so railways the last step to get the db + front & back up
2 years ago
and you want to deploy a template automatically on sign up or something?
2 years ago
So we can just click 1 button that sets up an entire instance
2 years ago
Yea
2 years ago
Or well, we click the create button
2 years ago
single tenant app eh?
2 years ago
Yeah, we built an app for 1 client and are scaling it to work for multiple
2 years ago
And we thought this'd be cool
2 years ago
( and look good on our portfolios )
2 years ago
you dont think your time would be better spent converting it to a multi tenant app for better scalability?
2 years ago
Ehh, maybe
2 years ago
But it'd take a while
2 years ago
Cause its a pretty big app
2 years ago
Entire radio management system
2 years ago
And we're not planning on a lot of clientd
2 years ago
fair enough
2 years ago
And we just thought this would be fun haha
2 years ago
2 years ago
This is only the sidebar
2 years ago
damn
2 years ago
hey i have an idea
2 years ago
👂
2 years ago
lol my cli is out of date, one sec
2 years ago
> railway deploy --help
Provisions a template into your project
Usage: railway deploy [OPTIONS]
Options:
-t, --template <template>
The code of the template to deploy
-v, --variable
The "{key}={value}" environment variable pair to set the template variables
To specify the variable for a single service prefix it with "{service}." Example:
bash railway deploy -t postgres -v "MY_SPECIAL_ENV_VAR=1" -v "Backend.Port=3000"
--json
Output in JSON format
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version2 years ago
oooo
2 years ago
Yea that'd be way easier
2 years ago
what language where you planning to write the code to deploy a template in?
2 years ago
Node
2 years ago
then you could call out to the cli
2 years ago
(or bun if we're specific <:bun:1150878419282821313> )
2 years ago
Yeah, i'll try that probablh
2 years ago
bun has great support for calling out to cli apps doesnt it?
2 years ago
Oh yeah they introduced that lately
2 years ago
I'll see how it goes!
2 years ago
let me know too!
2 years ago
2 years ago
Will do
2 years ago
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
2 years ago
is that a bug with railway(cli) or an issue on our end
2 years ago
let's see a service source in your template?
2 years ago

2 years ago
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
2 years ago
perfect thanks!
2 years ago
@Danny just to confirm again, you have deployed this exact same template in the dashboard just fine?
2 years ago
yep
2 years ago
@evan - the cli's deploy command is deploying GitHub repo's as docker images
2 years ago
!t
2 years ago
This thread has been escalated to the Railway team.
Status changed to Awaiting Railway Response brody • over 1 year ago
2 years ago
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
2 years ago
I'll test when I can and update with more info too
<:hmm:1228339204048814080> looking at this again - i think the UI might make sense here? since you're deploying via CLI, we're keying off of that
2 years ago
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)
2 years ago
yea thats correct
so - even though it is connected to a source repository (ie. the template), you're manually triggering a CLI deployment
2 years ago
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
2 years ago
2 years ago
a thanks, yh thats basically the same
2 years ago
heya, sorry for the ping but any updates just yet? we're kinda stuck with our project right now, no pressure of course
2 years ago
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?
2 years ago
give me a sec, ill generate one
2 years ago
sum small bugfixes later https://railway.app/project/9e8dfc9b-6e9e-4b3e-9b7a-0e005c42d096
2 years ago
while its set to gh from the templates
2 years ago
its not a visual bug, because it actually deploys images via docker

2 years ago
oh and it also seems like its not even trying to deploy? that might just be from the missing docker image tho

2 years ago
i want this to deploy via my github repo i have set in the template
2 years ago
it is a private repo, but it should work fine as im authorized to access it from my acc
2 years ago
might be causing the issue tho
2 years ago
yh thats the issue
2 years ago
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
2 years ago
could i send it in DM? its not really a public template
2 years ago
oh i can access it from incognito, prob didnt set it as a private template then <:PES3_Smile:771029769268494378>
2 years ago
2 years ago
uhh
2 years ago
thats weird
2 years ago
idk whats different bout the urls but the second one works somehow
2 years ago
aaa my clipboard lowercased it for some reason haha
2 years ago
nice
2 years ago
yep
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
2 years ago
alrighty, thanku
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
2 years ago
yep, will do
also - you may want to look into environments depending on your use case? may be more helpful than creating projects
2 years ago
hmm yh that might be a good one
2 years ago
ill look into it
2 years ago
.
2 years ago
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.
2 years ago
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
2 years ago
Seems like the attached repos don't exist anymore? Is this using private repos?
2 years ago
example project and template
2 years ago
yeah it's private, not sure if that's a factor
2 years ago
Could you check if you can reproduce it with a template with a public repo?
2 years ago
I can tomorrow as it's quite late for me (3:40am)
2 years ago
You should sleep. 😴
2 years ago
I've checked + reproduced with a template with a public repo.
2 years ago
I've PR-ed a fix (https://github.com/railwayapp/cli/pull/523). Will merge upon review as I've never written Rust before.
2 years ago
Should be fixed in the latest release. Could you try it and let me know?
2 years ago
(v3.11.2) - release is still running
2 years ago
Was fixed in 3.11.1 no?
2 years ago
.2 is JRs.
2 years ago
haha i know but it caught me off guard <:kekw:788259314607325204>

2 years ago
update, works!
