Trying to generate files before runtime
I recently pushed a commit in my project that adds some auto generated files to
.gitignore
. But this broke Railway trying to deploy my app because I don't have those files anymore.
The files in question can be generated by a simple command: sqlc generate
. Though I tried putting this as the build command and start commands but nothing seems to work.
Note: I don't want to use a Dockerfile for something as trivial as this.Solution:Jump to solution
install it from nixpacks on railway too?
nixpacks.toml
```toml
[phases.setup]...
39 Replies
Project ID:
69531a0b-78b7-4a71-9df4-3a8db9703b69
service:
breadboard
thats not a uuidv4
what
Oh
Service:
20823280-db07-46f3-b4a3-1809ce497302
I thought y'all could see names
my badi cant see anything
well, do you know how I can tell Railway to download SQLC and run the command?
what language?
Go
SQLC is a standalone dependency that converts SQL queries into any supported language's functions
how did you read my mind
lol
how would you install sqlc locally?
Well, from my package manager
what is your package manager
Nix
I had also used
pacman
for sqlc
back when I used Manjaro
Oh seems like it can be installed using go install
or go get
Ref: https://docs.sqlc.dev/en/stable/overview/install.htmlSolution
install it from nixpacks on railway too?
nixpacks.toml
That's a nice toml file but I don't want to couple my codebase with hosting mean I'll do it if it's the last option I have
It's defined in my
flake.nix
but sadly no support yet
2 of my other services broke because of the changes here 💀thats the only way i can think of
broke because of the recent nixpacks update?
Can I add it to my
go.mod
so that it will automatically be downloaded and then set my start command as sqlc generate && go run cmd.main.go
?
No, because I made breaking changes to the database and the newer version of my service supports it but that's crashing because of this errori can not recommend that method, i can also not recommend you use
go run
in a production environmentWhy is it not recommended?
Also alternative to
go run
? go build
?respectfully, its a hacky solution
railway builds your go app and then runs the resulting binary, this is the preferred way to run a go app in a production environment
Yeah, makes sense.
Yeah. I just said
go run
as in anything that's used to run a prod environment setup. Not specifically run
Can I expect flake support in the coming months?unlikely tbh
Until then I can afford to just manually do
railway up
with temporarily removing the needed files from gitignore
Damn, ripyou are that opposed to putting a file in your repo?
i cant understand that if im being honest
Oh right I forgot about that option
I mean
I'm not that opposed
It's just I like to stick to some coding principles
The principle here being no coupling: Hosting quirks should stay away from the codebase
Though I plan to stay with Railway for a long time, I don't want vendor lock-in
i mean how would you tell fly to do this?
fly?
I can remove the dots there, right?
no shot you dont know what fly is?
I'm guessing they're just a placeholder
no
no?
is it like a hosting platform
i didnt know it was possible to know about railway without knowing about fly
Can't find anything in my SE because of the generic name
What is it lol
same thing as railway
I see
either way the nixpacks.toml is the way to go
the toml worked btw
awsome