R
Railway4mo ago
Faith

Help with setup of laravel cmds on project deployment

Hello everyone so im hosting a laravel rest api but i cant seem to access the terminal and run cmds to seed the database etc, i want to seed the database on every start up
36 Replies
Percy
Percy4mo ago
Project ID: c93cd254-9d7c-42ba-ac53-835e0f60c9cc
Faith
Faith4mo ago
c93cd254-9d7c-42ba-ac53-835e0f60c9cc
Faith
Faith4mo ago
No description
Faith
Faith4mo ago
also now i get this issue for some reason
Medim
Medim4mo ago
There's no terminal in railway nor SSH connection
Faith
Faith4mo ago
ye i thought imma just do it in the build step
Medim
Medim4mo ago
Yep, add migration command to the start command
Faith
Faith4mo ago
but now im getting this issue and i dont seem to quite understand why it is doing it
Medim
Medim4mo ago
Just be careful with the seeder since it will seed everytime u build
Faith
Faith4mo ago
does it not wipe the databse on new deploys?
Medim
Medim4mo ago
Seems like its Railway related, just try again No
Faith
Faith4mo ago
aight imma try
Medim
Medim4mo ago
Only if ur code does that, but Railway Dbs are persistent
Faith
Faith4mo ago
tbh it just to host a quick thing not suppose to be useable alright i retried now lets see
Faith
Faith4mo ago
No description
Faith
Faith4mo ago
damn it usually dont take this long with my other servers it works now but it dont seem to run the migrations do i need to make a complete new build step for this?
Medim
Medim4mo ago
run the migrations on the start command eg: run migration && run start
Faith
Faith4mo ago

[build]
builder = "NIXPACKS"

[build]
buildCommand = "php artisan serve"

[deploy]
startCommand = "php artisan migrate && php artisan db:seed --class=TruckSeeder"

[build]
builder = "NIXPACKS"

[build]
buildCommand = "php artisan serve"

[deploy]
startCommand = "php artisan migrate && php artisan db:seed --class=TruckSeeder"
i did this @Medim i think this sis the same
Faith
Faith4mo ago
No description
Faith
Faith4mo ago
i did it in here
Medim
Medim4mo ago
yes, its the same
Faith
Faith4mo ago
aight bet its some how not working?
Faith
Faith4mo ago
No description
Faith
Faith4mo ago
i served it but it serves to port 8000 what port was it that railway expected it to serve on? i removed the start functions since i dont need them lets see what that does hehe
Medim
Medim4mo ago
Do you have a PORT env var?
Faith
Faith4mo ago
nawh do i need one but it worked before?
Faith
Faith4mo ago
it works now
Medim
Medim4mo ago
Then it just wasn't 'there yet'
Faith
Faith4mo ago
No description
Faith
Faith4mo ago
now im getting this issue wth
Medim
Medim4mo ago
And I guess this issue didn't happen locally ?
Faith
Faith4mo ago
nah
Medim
Medim4mo ago
Hmm, I suspect your laravel app is missing some config for prod But I never used Laravel in my entire life
Faith
Faith4mo ago
hmm maybe
Medim
Medim4mo ago
So I don't think I can help u there :copium: