a year ago
Hello, I would like when deploying my application to synchronize the migrations with the database that I also have on railway. So I added this command during the build.
"build": "prisma migrate deploy && nest build"
but unfortunately I have this error. I also had it when I put it on the script to start the application after building, and it only worked when I restarted the server.
0 Replies
a year ago
the private network is not available during build yet
for DATABASE_URL
variable i use the ref to ${{Postgres.DATABASE_PRIVATE_URL}}
a year ago
because you would need to have a 3 second delay before attempting to connect to a private service
a year ago
yes you would have to use the public url if you want to run migrations during build, or continue using the private network and run the migrations at runtime before starting your app
a year ago
before you change anything, try enabling their new builder, I forget if it is a part of the private network, but I know it would be the end goal so maybe it's already implemented
a year ago
not necessarily, why do you ask?
a year ago
I'm not sure what you mean, you need to set that variable as a service variable, have you?
a year ago
How were you previously setting your start command?
it does not use the custom start command that I put in the parameters of my service
I would therefore like to create a nixpacks configuration file, but the problem is that I don't know what to put in nixPckgs apart from nodejs
because when I don't use the nixpacks file, by default it uses nodejs, npm and openssl
a year ago
so you already have a nixpacks.toml file?
a year ago
okay, you're all over the place and I don't know what the current issue is.
so let's start off without a nixpacks.toml file, what kind of app do you have?
my question is but is it recommended to do the migration during the build or start?
a year ago
start because then you can use the private network. but I have asked you to try running the migration during build with the v2 builder
a year ago
why is that
I had the bug concerning prisma which could not connect to my database during the build via the internal url, because during the build there is no access to the internal network. You therefore suggested that I use the builder v2 which could potentially solve this problem. So I activated the builder v2 via the variables. But I noticed that it does not find a start command even though I put a custom start command on the settings of my backend service (on railway directly). So I wanted to create a nixpacks.toml configuration file to define the build, start, etc. commands… But the problem is that I noticed that I didn't know what to put in nixPcks in the setup phase. Because without a nixpacks.toml file, it has nodejs20, npm9 and openssl as default. And in mine I just put nodejs, and I didn't know if I should put other things.
So I'm just wondering if it's better to migrate my database during start or during build. To me this makes more sense during the build. But in this case, I would like someone to explain the nixpacks.toml configuration file to me.
@Brody If you have any questions do not hesitate. sorry I wasn't on my pc before
a year ago
I'm sorry but I don't currently have the time to read all that, instead I would greatly appreciate if you could directly answer my previous question
I noticed that it does not find a start command even though I put a custom start command on the settings of my backend service (on railway directly).
a year ago
thank you for this clear and concise answer, try adding a start
script to your package.json instead
I see that it deletes lots of files, why?
60 store paths deleted, 512.58 MiB freed
a year ago
the new builder is much more verbose, I don't think you need to pay much mind to what it prints
a year ago
with what error
[phases.build]
cmds = ['npm run build']
[start]
cmd = 'sleep 3 && npm run prisma migrate deploy && npm run start'