Laravel app works but without DB and CSS
Project ID: e5ad79e4-c4f3-4ed9-81df-2556a6ae460e
I managed to deploy on Railway my Laravel app so it works, but in very basic form only. No styles are displayed, and database is also not working.
I am a new guy here, so some help would be much appreciated, 'cause no clear step-by-step tutorial how to deploy and debug deployments was found by me.
So, what I did: copied my .env file content into variables here using raw editor. I updated DB settings there, the values took from credentials of PostgreSQL I had attached to my project earlier.
For starting assigned "make start" command, which in my Makefile stands for
PHP_CLI_SERVER_WORKERS=5 php -S 0.0.0.0:$(PORT) -t public
After this, as I said, my app starts, the homepage is being displayed. But without any css, and when I go to other pages generated from DB the errors pop out as if tables were not generated (am I supposed to run php artisan migrate?)
11 Replies
Project ID:
e5ad79e4-c4f3-4ed9-81df-2556a6ae460e
You might find these helpful:
- Deploy Vite + React project
- Use Notion as a CMS for your NextJS blog
- Rails app 404
⚠️ experimental feature
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Thank you, I used your advise
if($this->app->environment('production')) {
\URL::forceScheme('https');
}
and it loads my assets now.
But could you please elaborate a bit on databases. 'Cause you advised exactly what I had done and it did not work out. It throws error: "Undefined table: 7 ERROR: relation "task_statuses" does not exist LINE 1: select * from "task_statuses" ^ (Connection: pgsql, SQL: select * from "task_statuses")"Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Sorry, I can't get what you mean
I will elaborate on what I had done:
1) cretated new DB on Railway, it got attached to my project automatically
2) copied my .env file to variables using RAW editor
3) changed these lines in it according to what I could find in DB attached to my project on step 1:
DB_CONNECTION=pgsql DB_HOST=containers-us-west-199.railway.app DB_PORT=7483 DB_DATABASE=railway DB_USERNAME=postgres DB_PASSWORD=my_password_from_step1
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
nope. how am I supposed to do that?
i tried to include "php artisan migrate" in my start command "make start" in my Makefile, just before "PHP_CLI_SERVER_WORKERS=5 php -S 0.0.0.0:$(PORT) -t public", but it threw error "are you sure you wanna migrate now in production env? Y/n" (i could see it only in deploy logs and couldn't press yes or no)
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah, I have just googled it on my own! Returned to write here about it. Thanks for help, man!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View