R
Railway•14mo ago
nicholaskillin

Rails asset precompliation

Hey, I have a pretty basic Rails app that I'm trying to deploy. Ever since the switch to nixpacks the builds fail, they used to work fine. I was watching the build logs today and noticed this line: #18 [stage-0 14/18] RUN bundle exec rake assets:procompile #18 2.072 Did you mean? assets:precompile So I opened up by codebase and did a search for procompile thinking I made a typo, but I can't find one anywhere. Anyone else run into something like this? My project id is a87e38b2-00d5-4aeb-bbde-7d8281cf6715
Solution:
I don't see the typo either, perhaps you have a build command set in the service settings?
Jump to solution
33 Replies
Percy
Percy•14mo ago
Project ID: a87e38b2-00d5-4aeb-bbde-7d8281cf6715
Brody
Brody•14mo ago
railway's nixpacks will try to determine what commands to run but it won't always get it right, you do have full control over what command gets run at any phase, so you can change that command https://nixpacks.com/docs/configuration/file#commands
nicholaskillin
nicholaskillin•14mo ago
I mean, I don't think bundle exec rake assets:procompile is ever a valid command for Rails. According to the docs it will use the Ruby config if Gemfile is detected, which it should be. And the docs say that the Build command for ruby is bundle exec rake assets:precompile, which is correct. Is it possible I'm somehow using a version of nixpacks that had a bug that has since been fixed?
Brody
Brody•14mo ago
it's more possible that nixpacks just doesn't have great support for rails but the current nixpacks version in use by railway is 1.16.0 as of typing this, you can see the version your build uses by looking at the build table at the top of the build logs
nicholaskillin
nicholaskillin•14mo ago
hm, yeah it used the latest. I'm happy to add a config file I suppose. Does the config file need to have config for each step of the build process, or can I let it use default for all the steps that work and just include
[phases.build]
cmd='bundle exec rake assets:precompile'
[phases.build]
cmd='bundle exec rake assets:precompile'
Brody
Brody•14mo ago
you only need to provide what you want changed though that's already not valid https://nixpacks.com/docs/guides/configuring-builds#custom-build-command
nicholaskillin
nicholaskillin•14mo ago
ah, the build phase only accepts cmds with an array of commands?
Brody
Brody•14mo ago
I wouldn't say only, that's just the syntax gonna also tag in @jr here
nicholaskillin
nicholaskillin•14mo ago
Thanks, I appreciate all of your help so far Brody. Clearly nixpacks is new to me.
Brody
Brody•14mo ago
no worries at all
nicholaskillin
nicholaskillin•14mo ago
Hm, still not working. Looks like it's still running the invalid command.
nicholaskillin
nicholaskillin•14mo ago
GitHub
gameshelf/nixpacks.toml at master · nicholaskillin/gameshelf
This app allows you to set up your game library (imports from Board Game Geek) and then share it with your friends. - nicholaskillin/gameshelf
nicholaskillin
nicholaskillin•14mo ago
Here is what I'm seeing in the build logs
nicholaskillin
nicholaskillin•14mo ago
No description
Brody
Brody•14mo ago
can you send the full build logs? use this please https://bookmarklets.up.railway.app/log-downloader/
Brody
Brody•14mo ago
it's cut off, how about just a screenshot of the nixpacks build table?
nicholaskillin
nicholaskillin•14mo ago
No description
Brody
Brody•14mo ago
looks like the build command is reflecting what you have in your nixpacks.toml file just fine?
nicholaskillin
nicholaskillin•14mo ago
Nope. The table shows procompile. My config says precompile
Brody
Brody•14mo ago
does that just mean there is a typo in nixpacks lol
nicholaskillin
nicholaskillin•14mo ago
I think so I searched their repo and didn't see it, but that is what it seems like to me To be fair, I've typed procompile on accident many times. I was sure this was my fault when I started. 🤣 I still don't see the typo in the nixpacks repo. Perhaps the config lives in the docker image?
Solution
Brody
Brody•14mo ago
I don't see the typo either, perhaps you have a build command set in the service settings?
nicholaskillin
nicholaskillin•14mo ago
Well 💩. There it is. 🤣
Brody
Brody•14mo ago
no need for the nixpacks.toml file then
nicholaskillin
nicholaskillin•14mo ago
Hm, actually I can see it in the settings, but I'm not sure it's one I set or how to change it ha, nevermind Found it
nicholaskillin
nicholaskillin•14mo ago
No description
nicholaskillin
nicholaskillin•14mo ago
🎉
Brody
Brody•14mo ago
damn what going on with your logs rake should just support procompile missed opportunity
nicholaskillin
nicholaskillin•14mo ago
Sounds more advanced than precompile
Brody
Brody•14mo ago
🤣
nicholaskillin
nicholaskillin•14mo ago
My app is back up and running. Thanks again for helping me track down my own typo. I had a bad feeling when I first saw the logs that this was my fault somehow. 🤣
Brody
Brody•14mo ago
no prob, happy to help!
Want results from more Discord servers?
Add your server