123 Replies
Project ID:
N/A
It seems this requires me to use a public repo?
573f673d-17f9-4c3b-b05f-91f672f1d889
would you really want to deploy a whole new project per chat?
just a github repo at the moment
right but wouldnt it make more sense to deploy a new service instead?
yes ideally, but I don't want to do it manually. I'de like a way to create it by the API? And I think that requires a template right?
there's this
maybe this works?
will that add a new service?
what im thinking is building your own little terraformer, have a single base project, with a service that will orchestrate deploying additional services within that same project
yes that's it
looking at the API, looks like serviceCreate() is the right mutation
and I can pass it a github repo
would each service need different variables?
yes
then you will have to make a few api calls one after the other
let me figure out what calls you need to make and in what order
^.^
I'll get to grips with calling the api with that graphql library
would each service need its own domain?
yes
i can use DNSimple to update dnsrecords
so custom domain?
community_id.custom_domain.xyz
- mutation
serviceCreate
- to create the empty service
- mutation customDomainCreate
- to add a custom domain, returns the cname
- mutation variableCollectionUpsert
- to add the needed custom variables
- mutation serviceInstanceUpdate
- likely needed to modify service settings like the health check endpoint
- mutation serviceConnect
- to add your repo and kick off a deployment
you might be able to do customDomainCreate
, variableCollectionUpsert
, and serviceInstanceUpdate
concurrentlyalright ^.^
thankyou brody
no problem ๐
just getting started here
let me know if you run into any issues, while i havent used the api to do this, i have used the api with go
there was a unknown scalar type : ServiceVariables, but otherwise generated fine!
looks good to me
any idea what the Environment_ID might be? I'm guessing it's "Production"
Project ID i got
it would be uuid for the environment within the project you want to create a service in
ahh
found it
so since you are deploying into the same environment using that environment variable is perfect
now that golang runs at less than 20x of the memory, I might even be able to have a staging environment lol
you can have a staging environment with ruby apps too, just sleep them
true
I'm doing something wrong but not sure what the issue is
setup the railway client
i'm sending the auth token I generated in the Railway app
but when I call serviceCreate it gives me Not Authorized
what type of token did you create?
all that looks fine, can you show me how you are using the client?
ok
well you dont want to add a repo at that stage
as for the unauthed, i have no clue
ok
lets try without a service?
i mean
without a repo
but... that's weird, how can you create a service without a repo
empty service
i see
you have never created one of those in the UI?
same error ๐ฆ
i better start coding
no don't leave me
code to solve this
oh
maybe that'll help
it will, ill see what i can whip up
what are you using the service query for though?
to create a service
and then query it later (for its deployment)
i will poll the service until its status is deployed
use a webhook
oo
yeah i'll use a webhook
the webhook you set in the project will send you a request for each stage
ok
alright its nearly 2am here
and i better sleep
>.<
ill have some example code for you
will be hyped to wake up to that then!
thankyou for the help today brody!!
no problem!
hope this helps https://github.com/brody192/smol_terraformer
this helps so much
I'm still stuck on this though, weirdly getting the unauthorized error
I've got Proxy logs to show i'm sending the request correctly
I'm wondering if it's an issue with team plan / tokens?
can DM you anything when you're ๐
alright we figured it out @Sang Dang ty!
it was because I needed to use a personal token ๐ confusingly the tokens issuesd from the team page don't seem to work with this API
but creating from account then selecting team drop down does
yeah I still don't know exactly what is the differents, just notice they have 2 places to create token and it's also confused me until now
gotcha
thankyou Sang
use a team token when manipulating stuff on a team, use a personal token when manipulating stuff on the personal account
@Brody thats the weird. thing
its resources within the team
thats why I was so surprised
interesting
let me show you
I believe you
thats the team project
these tokens (from project settings in the team) don't work
that's a project token
that I know for sure wouldn't work for what you are doing
honestly no idea but Railway doesn't make that clear at all
that's fair
you don't know what token can do what
pretty much
it's all working great though now
but figured i'de let you know
was the code I wrote useful?
super useful
awesome
i'm gonna use App sleeping also to keep the costs down, I think this will be an excellent improvement
I had to fork the graphql generator library lol
so someone creates a free chat server, and then if it's not used it will sleep
oh man really wtf?
I didn't encounter that requirement yet?
yeah, the original library would send empty fields to the backboard instead of omitting them
oh
yes i noticed that
although I expect its because the GraphQL schema is saying SomethingInput has a field of type String!
the backboard didn't like that, so I modified the generator's code to always add an omitempty tag on the json structs so that the api calls always omit any empty fields
if the field has a ! in it, it will be required to send something
there was tags that didn't have a
!
that weren't being marked as non required for some reasondamn >.< well props for fixing that, I might have to use your fork
I'd be lying if I said I wasn't confused as to how it's not been an issue for you, aren't you calling service instance update?
unless you are just using my generated.go file?
this part is working ok
but I havent done service instance yet
okay well that explains why you haven't gotten any errors haha
well when you do, use my library fork and use it to generate new code and that should be all you need to do
i'm lookin at the generated code though and you're right this is the behaviour
how on earth is this a thing lol;
man this is dumb
I have no clue how fields don't have omitempty by default, every api request railways dashboard makes omits empty fields
it had decorators for generating the types
does this work? it threw errors when I tried to use this to set fields omitempty value
GitHub
Global omitempty option ยท Issue #260 ยท Khan/genqlient
Let's say a graphql query accepts an input object, which has an optional string in it, if I use the input object, and not give a value to that string, it should be committed, that's just ho...
just reading the issue here, maybe there's a solution, but it seems like people have run into this (obvious) defect
i expect the maintainers are thinking about it
it is not normal graphql behaviour
yep and that's why I needed to fork, we can't wait for a fix
but then it will just send null, that would likely just break other things
nil would be fine
i will try it one sec
null* this is json
but this means you have to have pointers to strings, not ideal from a development standpoint
this should be fine, i've not seen a graphql server not handle null before
well there wasn't a problem with that api call, try making the same service instance update call I do in my code where you only update the healthcheck
ok, I will try
i'm gonna make some bacon and eggs, I'll update later ๐ seriously thanks again, I'm really enjoyingthis project and your help has made it even more enjoyable
why did you turn on
use_extensions
though?
this is fun for me too!just to see what extensions are generated ๐ I beleive there's some rate limiting sometimes those are exposed though extensions, wasn't sure
if I get alot of people making chat servers I could get rate limited
I think it's like 1000 api calls per hour?
yes it is
yeah it's about that
I mean, its unlikely
but I think setup of a server costs maybe 5 api calls
per server
so 200 servers per hour, that's alot
yeah that's plenty for now
business class when?
hehe
can't wait to show you the MVP ^.^
MVP?
ohh right, yeah this is a new product
zenshop is on pause for the moment, and I'm gonna work on this app until mid January i think
more apps are more better
yeah