R
Railway•11mo ago
drewbie

Cannot change default provider for environment thats created during GitHub Pull Request

I posted about this a while back (https://discord.com/channels/713503345364697088/1126899693549531136) but I cannot seem to get it to work. The default provider thats used when a PR is created is Deno, and I'd like it to be node. Ive added a nixpacks.toml file to the directory of the service thats being deployed but it doesnt seem to take effect. Any help is appreciated.
59 Replies
Percy
Percy•11mo ago
Project ID: d36cedc3-d1a4-453b-9e36-45d7299cabfd
drewbie
drewbie•11mo ago
d36cedc3-d1a4-453b-9e36-45d7299cabfd
Brody
Brody•11mo ago
please show us the nixpacks.toml file
drewbie
drewbie•11mo ago
drewbie
drewbie•11mo ago
the entire monorepo is deployed, and turbopack is used to run the command for this particular app yarn start --filter=relay - the nixpacks file is within the relay directory, not at the root of the application (we have other services that we dont want to use node as a provider for)
Brody
Brody•11mo ago
single providers array with node, that side of things looks good to me do you have a NIXPACKS_CONFIG_FILE variable set in the service?
drewbie
drewbie•11mo ago
Dont appear to. To be clear the production and staging environments use a node provider no problem. Its the auto-generated environments via a pull request that dont use it. Only Nixpacks variable set in production/staging is NIXPACKS_NO_CACHE
Brody
Brody•11mo ago
if you don't have the nixpacks.toml file in the same directory as what set in the service settings railway won't be able to find it, so you'll need to set that variable
drewbie
drewbie•11mo ago
the toml file is in the same directory as the service. What do I set the variable value to? Assuming I add the variable to production and to staging and it will work for the PR environments? Will this effect the prod/staging setups that are already working?
Brody
Brody•11mo ago
okay so first, what is the root directory set to in the service settings? and should the prod/staging environments be using node too?
drewbie
drewbie•11mo ago
root directory is not set -- the entire monorepo is deployed to this service and the command is just filtered to the particular package for this particular service, yes
Brody
Brody•11mo ago
though so, just had to check though okay and what folder is this nixpacks.toml file in and side question, do you know what is causing nixpacks to detect deno?
drewbie
drewbie•11mo ago
root/packages/relay/nixpacks.toml I dont
Brody
Brody•11mo ago
this that is the value you should set your NIXPACKS_CONFIG_FILE variable to well of course minus the root, since I don't actually think you have a folder named root?
drewbie
drewbie•11mo ago
I do not. Can I set this under the Railway Config File Path option for the service? If the env var is set does it need to be set for staging and prod? Not sure what settings the PR environments use Appreciate the help btw!
Brody
Brody•11mo ago
yeah that would achieve the same thing, and that would probably also carry it across the environments too tbh I've done extremely little with multi environments on railway, so my knowledge on the behaviour around this is lacking
drewbie
drewbie•11mo ago
Hmm just tried using that option and it didnt seem to pick it up Railway config path is set to /packages/relay/nixpacks.toml
Brody
Brody•11mo ago
and you're absolutely positively sure that's the correct path
drewbie
drewbie•11mo ago
Yeah
Brody
Brody•11mo ago
also, would you be interested in showing me a screenshot of the files in the root of the project? maybe I'd see a reason for why railway thinks your using deno
drewbie
drewbie•11mo ago
Yeah Im good with that
Brody
Brody•11mo ago
because if railway stopped thinking you where using deno, that would solve your problems too right? you don't use deno for anything in this project, right?
drewbie
drewbie•11mo ago
It would - and there is a service that uses Deno within the packages directory
drewbie
drewbie•11mo ago
Brody
Brody•11mo ago
then that is why, from the nixpacks docs
Deno is detected if there is a deno.{json,jsonc} file found or if any .{ts,tsx,js,jsx} file is found that imports something from deno.land.
so you really can't change the fact that something is importing something from deno land
drewbie
drewbie•11mo ago
Brody
Brody•11mo ago
is it normal to have the rely app inside of the backend folder?
drewbie
drewbie•11mo ago
its not - they are both within /packages
Brody
Brody•11mo ago
ah my bad yeah I see that now lol does that nixpacks.toml file show up in your repo?
drewbie
drewbie•11mo ago
Yeah its in there
Brody
Brody•11mo ago
okay we'll try setting the NIXPACKS_CONFIG_FILE variable for the service
drewbie
drewbie•11mo ago
Ok I just moved the nixpacks file to the root of the entire monorepo, and changed the value of Railway Config File Path to nixpacks.toml and it works Maybe the leading slash when it was within the packages/relay was throwing it off? Going to try that
Brody
Brody•11mo ago
no, you definitely would need the leading forward slash, it's an absolute path after all can I ask why you seem opposed to setting the NIXPACKS_CONFIG_FILE variable?
drewbie
drewbie•11mo ago
Im not - ill give that a try now so set it in production and staging and set its value to /packages/relay/nixpacks.toml?
Brody
Brody•11mo ago
yes, but move the file back into the relay folder since backend is deno right?
drewbie
drewbie•11mo ago
and I just set this for the relay service im guessing, not in project shared we host our search service in relay as well so figured it shouldnt be a global thing
Brody
Brody•11mo ago
gotcha
drewbie
drewbie•11mo ago
Thats still using deno 🤔
Brody
Brody•11mo ago
you've set the NIXPACKS_CONFIG_FILE variable?
drewbie
drewbie•11mo ago
Brody
Brody•11mo ago
show me the build table at the top of the build logs please?
drewbie
drewbie•11mo ago
drewbie
drewbie•11mo ago
thats more promising - before it just couldnt build the app using deno vs node
Brody
Brody•11mo ago
I wouldn't call that deno lol make sure it's in the correct location in the branch you are deploying to railway?
drewbie
drewbie•11mo ago
Yeah its definitely in the repo
Brody
Brody•11mo ago
and you are absolutely sure your root directory is left as / in the service settings?
drewbie
drewbie•11mo ago
it doesnt have any value set I removed the leading slash, and the build doesnt error out not finding the file, but the provider is still deno hmm maybe its using node cause the build even though the provider in the settings still says node, cause the build is underway
Brody
Brody•11mo ago
what does the build table at the top of the build logs say?
drewbie
drewbie•11mo ago
Nixpacks file based configuration is experimental and may change
drewbie
drewbie•11mo ago
Brody
Brody•11mo ago
yeah it says node
drewbie
drewbie•11mo ago
so thats with no root directory set (hasnt changed), and the NIXPACKS_CONFIG_FILE variable set to packages/relay/nixpacks.toml with no leading slash
Brody
Brody•11mo ago
so all good?
drewbie
drewbie•11mo ago
and the provider in the settings still says Deno even though it actually used node
Brody
Brody•11mo ago
haha dont worry about that beta
drewbie
drewbie•11mo ago
yeah its working - this will effect prod and staging too since that variable was set there in the first place so as long as those continue to use node as they were i think were all good!
Brody
Brody•11mo ago
awsome
drewbie
drewbie•11mo ago
Appreciate the help!
Brody
Brody•11mo ago
no problem!