deploy template api
danny
PROOP

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

danny
PROOP

2 years ago

N/A


danny
PROOP

2 years ago

Here's my fetch

1265762453694976070


danny
PROOP

2 years ago

and here's the result

1265762509516701700


brody
EMPLOYEE

2 years ago

you are calling templateDeploy aka v1, you should call templateDeployV2 with the correct serialized config structure


danny
PROOP

2 years ago

aah, didnt know there was a v2


danny
PROOP

2 years ago

thanks, ill look into it!


danny
PROOP

2 years ago

i cant seem to find templatedeployv2 in the graphiql docs?


danny
PROOP

2 years ago

it really does not want me to use it

1265970332716499000


brody
EMPLOYEE

2 years ago

use the internal endpoint


danny
PROOP

2 years ago

Where is the internal endpoint?


brody
EMPLOYEE

2 years ago


danny
PROOP

2 years ago

Aha, thanks! I hope i can figure it out


brody
EMPLOYEE

2 years ago

a surefire way would be just to simply watch the network calls the dashboard makes


brody
EMPLOYEE

2 years ago

i would love to know your usecase though?


danny
PROOP

2 years ago

Yeah, i tried that, but it uses the v1 deployment which is a bit weird


danny
PROOP

2 years ago

We're making a SaaS app, that has a seperate instance per customer


danny
PROOP

2 years ago

We've already got r2 buckets + turnstile working, so railways the last step to get the db + front & back up


brody
EMPLOYEE

2 years ago

and you want to deploy a template automatically on sign up or something?


danny
PROOP

2 years ago

So we can just click 1 button that sets up an entire instance


danny
PROOP

2 years ago

Yea


danny
PROOP

2 years ago

Or well, we click the create button


brody
EMPLOYEE

2 years ago

single tenant app eh?


danny
PROOP

2 years ago

Yeah, we built an app for 1 client and are scaling it to work for multiple


danny
PROOP

2 years ago

And we thought this'd be cool


danny
PROOP

2 years ago

( and look good on our portfolios )


brody
EMPLOYEE

2 years ago

you dont think your time would be better spent converting it to a multi tenant app for better scalability?


danny
PROOP

2 years ago

Ehh, maybe


danny
PROOP

2 years ago

But it'd take a while


danny
PROOP

2 years ago

Cause its a pretty big app


danny
PROOP

2 years ago

Entire radio management system


danny
PROOP

2 years ago

And we're not planning on a lot of clientd


brody
EMPLOYEE

2 years ago

fair enough


danny
PROOP

2 years ago

And we just thought this would be fun haha



danny
PROOP

2 years ago

This is only the sidebar


brody
EMPLOYEE

2 years ago

damn


brody
EMPLOYEE

2 years ago

hey i have an idea


danny
PROOP

2 years ago

👂


brody
EMPLOYEE

2 years ago

lol my cli is out of date, one sec


brody
EMPLOYEE

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 version

danny
PROOP

2 years ago

oooo


danny
PROOP

2 years ago

Yea that'd be way easier


brody
EMPLOYEE

2 years ago

what language where you planning to write the code to deploy a template in?


danny
PROOP

2 years ago

Node


brody
EMPLOYEE

2 years ago

then you could call out to the cli


danny
PROOP

2 years ago

(or bun if we're specific <:bun:1150878419282821313> )


danny
PROOP

2 years ago

Yeah, i'll try that probablh


brody
EMPLOYEE

2 years ago

bun has great support for calling out to cli apps doesnt it?


danny
PROOP

2 years ago

Oh yeah they introduced that lately


danny
PROOP

2 years ago

I'll see how it goes!


brody
EMPLOYEE

2 years ago

let me know too!



danny
PROOP

2 years ago

Will do


danny
PROOP

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


danny
PROOP

2 years ago

is that a bug with railway(cli) or an issue on our end


brody
EMPLOYEE

2 years ago

let's see a service source in your template?


danny
PROOP

2 years ago

1266121934995980500


brody
EMPLOYEE

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



oscarnow
PRO

2 years ago

Thanks for your help, hope this gets fixed.


brody
EMPLOYEE

2 years ago

perfect thanks!


brody
EMPLOYEE

2 years ago

@Danny just to confirm again, you have deployed this exact same template in the dashboard just fine?


danny
PROOP

2 years ago

yep


brody
EMPLOYEE

2 years ago

@evan - the cli's deploy command is deploying GitHub repo's as docker images


brody
EMPLOYEE

2 years ago

!t


brody
EMPLOYEE

2 years ago

This thread has been escalated to the Railway team.

Status changed to Awaiting Railway Response brody over 1 year ago


evancloutier
PRO

2 years ago

ack’d


evancloutier
PRO

2 years ago

this may just be a visual bug


brody
EMPLOYEE

2 years ago

oh yeah? I'm out so I can't test right now


evancloutier
PRO

2 years ago

thanks for the deets - i’ll follow up later tonight once i’ve dug in a bit more


brody
EMPLOYEE

2 years ago

I'll test when I can and update with more info too


evancloutier
PRO

2 years ago

<: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


evancloutier
PRO

2 years ago

(even though it is a template)


danny
PROOP

2 years ago

sorry but im not quite getting you, what do you mean exactly


evancloutier
PRO

2 years ago

this template is getting deployed via the cli, right? (like, that is the trigger)


danny
PROOP

2 years ago

yea thats correct


evancloutier
PRO

2 years ago

so - even though it is connected to a source repository (ie. the template), you're manually triggering a CLI deployment


evancloutier
PRO

2 years ago

so we're keying off of that


evancloutier
PRO

2 years ago

does that make sense?


danny
PROOP

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


evancloutier
PRO

2 years ago

do you mind sending me a link to the project?


brody
EMPLOYEE

2 years ago


danny
PROOP

2 years ago

a thanks, yh thats basically the same


evancloutier
PRO

2 years ago

o ye das weird


evancloutier
PRO

2 years ago

thx brody


evancloutier
PRO

2 years ago

will dive in 🏊‍♂️


danny
PROOP

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


evancloutier
PRO

2 years ago

this shouldn’t be blocking - the deploy still goes out?


danny
PROOP

2 years ago

it blocks our deploy, because it attempts do deploy via docker, which wil lalways fail


evancloutier
PRO

2 years ago

hmm ok i thought it was just a visual thing - do you have the link to your project?


danny
PROOP

2 years ago

give me a sec, ill generate one


evancloutier
PRO

2 years ago

can just copy the url and send it here



danny
PROOP

2 years ago

while its set to gh from the templates


danny
PROOP

2 years ago

its not a visual bug, because it actually deploys images via docker

1267114755072725000


evancloutier
PRO

2 years ago

lookin


danny
PROOP

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

1267115255633416400


evancloutier
PRO

2 years ago

so how do you actually want this to deploy?


danny
PROOP

2 years ago

i want this to deploy via my github repo i have set in the template


danny
PROOP

2 years ago

it is a private repo, but it should work fine as im authorized to access it from my acc


danny
PROOP

2 years ago

might be causing the issue tho


evancloutier
PRO

2 years ago

it says "source image" in the config


evancloutier
PRO

2 years ago

1267115574325149700


evancloutier
PRO

2 years ago

so that's why it is trying to deploy as an image


danny
PROOP

2 years ago

yh thats the issue


evancloutier
PRO

2 years ago

swap that to be source repo


evancloutier
PRO

2 years ago

can you link me to the template?


evancloutier
PRO

2 years ago

you can unblock yourself here by swapping to the gh repo?


danny
PROOP

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


danny
PROOP

2 years ago

could i send it in DM? its not really a public template


evancloutier
PRO

2 years ago

if it isn't a public template, nobody will be able to access it


evancloutier
PRO

2 years ago

(i will be able to see it b/c admin)


danny
PROOP

2 years ago

oh i can access it from incognito, prob didnt set it as a private template then <:PES3_Smile:771029769268494378>


evancloutier
PRO

2 years ago

will need to see the template to understand further



evancloutier
PRO

2 years ago

404?


danny
PROOP

2 years ago

uhh


danny
PROOP

2 years ago

thats weird



evancloutier
PRO

2 years ago

is it a published template?


evancloutier
PRO

2 years ago

ok got it now


danny
PROOP

2 years ago

idk whats different bout the urls but the second one works somehow


evancloutier
PRO

2 years ago

second character is i vs l in second link i think


evancloutier
PRO

2 years ago

hmm nvm case sensitivity


danny
PROOP

2 years ago

aaa my clipboard lowercased it for some reason haha


danny
PROOP

2 years ago

nice


evancloutier
PRO

2 years ago

and you said if you deploy through the dashboard, its fine?


danny
PROOP

2 years ago

yep


evancloutier
PRO

2 years ago

odd


evancloutier
PRO

2 years ago

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


danny
PROOP

2 years ago

alrighty, thanku


evancloutier
PRO

2 years ago

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


danny
PROOP

2 years ago

yep, will do


evancloutier
PRO

2 years ago

also - you may want to look into environments depending on your use case? may be more helpful than creating projects


danny
PROOP

2 years ago

hmm yh that might be a good one


danny
PROOP

2 years ago

ill look into it


fp
EMPLOYEE

2 years ago

.


fp
EMPLOYEE

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.


brody
EMPLOYEE

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


fp
EMPLOYEE

2 years ago

Seems like the attached repos don't exist anymore? Is this using private repos?


brody
EMPLOYEE

2 years ago

example project and template


brody
EMPLOYEE

2 years ago

yeah it's private, not sure if that's a factor


fp
EMPLOYEE

2 years ago

Could you check if you can reproduce it with a template with a public repo?


brody
EMPLOYEE

2 years ago

I can tomorrow as it's quite late for me (3:40am)


fp
EMPLOYEE

2 years ago

You should sleep. 😴


fp
EMPLOYEE

2 years ago

I've checked + reproduced with a template with a public repo.


fp
EMPLOYEE

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.


fp
EMPLOYEE

2 years ago

Should be fixed in the latest release. Could you try it and let me know?


brody
EMPLOYEE

2 years ago

(v3.11.2) - release is still running


fp
EMPLOYEE

2 years ago

Was fixed in 3.11.1 no?


fp
EMPLOYEE

2 years ago

.2 is JRs.


brody
EMPLOYEE

2 years ago

haha i know but it caught me off guard <:kekw:788259314607325204>

1267943963516731400


brody
EMPLOYEE

2 years ago

update, works!


Loading...