R
Railway9mo 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
Percy9mo ago
Project ID: c93cd254-9d7c-42ba-ac53-835e0f60c9cc
Faith
FaithOP9mo ago
c93cd254-9d7c-42ba-ac53-835e0f60c9cc
Faith
FaithOP9mo ago
No description
Faith
FaithOP9mo ago
also now i get this issue for some reason
Medim
Medim9mo ago
There's no terminal in railway nor SSH connection
Faith
FaithOP9mo ago
ye i thought imma just do it in the build step
Medim
Medim9mo ago
Yep, add migration command to the start command
Faith
FaithOP9mo ago
but now im getting this issue and i dont seem to quite understand why it is doing it
Medim
Medim9mo ago
Just be careful with the seeder since it will seed everytime u build
Faith
FaithOP9mo ago
does it not wipe the databse on new deploys?
Medim
Medim9mo ago
Seems like its Railway related, just try again No
Faith
FaithOP9mo ago
aight imma try
Medim
Medim9mo ago
Only if ur code does that, but Railway Dbs are persistent
Faith
FaithOP9mo ago
tbh it just to host a quick thing not suppose to be useable alright i retried now lets see
Faith
FaithOP9mo ago
No description
Faith
FaithOP9mo 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
Medim9mo ago
run the migrations on the start command eg: run migration && run start
Faith
FaithOP9mo 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
FaithOP9mo ago
No description
Faith
FaithOP9mo ago
i did it in here
Medim
Medim9mo ago
yes, its the same
Faith
FaithOP9mo ago
aight bet its some how not working?
Faith
FaithOP9mo ago
No description
Faith
FaithOP9mo 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
Medim9mo ago
Do you have a PORT env var?
Faith
FaithOP9mo ago
nawh do i need one but it worked before?
Faith
FaithOP9mo ago
it works now
Medim
Medim9mo ago
Then it just wasn't 'there yet'
Faith
FaithOP9mo ago
No description
Faith
FaithOP9mo ago
now im getting this issue wth
Medim
Medim9mo ago
And I guess this issue didn't happen locally ?
Faith
FaithOP9mo ago
nah
Medim
Medim9mo ago
Hmm, I suspect your laravel app is missing some config for prod But I never used Laravel in my entire life
Faith
FaithOP9mo ago
hmm maybe
Medim
Medim9mo ago
So I don't think I can help u there :copium:
Want results from more Discord servers?
Add your server