Application Error, app not listening on $PORT?

i uploaded an app with the railway cli and setted the env variable called PORT, but it's still broken..
38 Replies
Neto
Neto3y ago
what start command have you used? because it needs the port like next start -p $PORT
samuele
samueleOP3y ago
it's a lavavel application
Neto
Neto3y ago
have you set the port on .env? just did a small instance https://laravel-production-f233.up.railway.app/ SERVER_PORT=${PORT} on the env variables
samuele
samueleOP3y ago
it must be SERVER_PORT=${PORT}?
Neto
Neto3y ago
ye the ${PORT} is set by railway itself
samuele
samueleOP3y ago
i written on the .env vars PORT=${PORT}
Neto
Neto3y ago
its SERVER_PORT laravel
samuele
samueleOP3y ago
oh ok SERVER_PORT=8000 it's ok?
Neto
Neto3y ago
railway defines the port for the most part SERVER_PORT=${PORT} is the config on .env and thats it
samuele
samueleOP3y ago
how does it start tho? with a cmd? or in auto?
Neto
Neto3y ago
nixpacks
Neto
Neto3y ago
on deploy logs they show the port
Neto
Neto3y ago
but you dont define directly with suck as 7078 is the pipeline running? deploying*
samuele
samueleOP3y ago
samuele
samueleOP3y ago
yeah
Neto
Neto3y ago
check deploy logs and have you set the other env variables?
samuele
samueleOP3y ago
yeah wait you mean the one the i use there are others env vars to make railway service works?
Neto
Neto3y ago
like
Neto
Neto3y ago
i just did copy from the local .env put APP_ENV=production and SERVER_PORT=${PORT} and was working
samuele
samueleOP3y ago
samuele
samueleOP3y ago
wait i had the app_env on local maybe that's it
samuele
samueleOP3y ago
noup
Neto
Neto3y ago
there was any log on build logs? before the
samuele
samueleOP3y ago
oh wait
Neto
Neto3y ago

================
Publishing Image
================

================
Publishing Image
================
samuele
samueleOP3y ago
do you have a dockerfile?
Neto
Neto3y ago
i did their default template
samuele
samueleOP3y ago
mhhh can u link me the github repo? nvm i found it
Neto
Neto3y ago
with adding a new service you can spawn a new one
samuele
samueleOP3y ago
i dont have the same structure tho
Neto
Neto3y ago
adds a database and laravel if you can run locally with docker should work fine on railway
samuele
samueleOP3y ago
i run it locally only using the cmd php artisan serve not the dockerfile
Neto
Neto3y ago
you should check the build logs maybe there is a clue there
samuele
samueleOP3y ago
on the template that they have i dont find the DockerFile i use the docker-compose that it's not usable on railway... do u know hot to convert it to a DockerFile?
Neto
Neto3y ago
usually laravel uses sail
Neto
Neto3y ago
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Neto
Neto3y ago
im not the biggest fan from the framework if the issue is railway relatedf you can maybe get more help from their discord server
Want results from more Discord servers?
Add your server