problems when deploying laravel app with postgresql database

pedrosanch3zTRIAL

9 months ago

During the deployment of my Laravel app, when I execute the command "php artisan migrate --force" it gives me this error "#15 4.165

15 4.165 Illuminate\Database\QueryException

15 4.165

15 4.165 SQLSTATE[08006] [7] could not translate host name "tareas-api.railway.internal" to address: Name or service not known (Connection: pgsql, SQL: select c.relname as name, n.nspname as schema, pgtotalrelationsize(c.oid) as size, objdescription(c.oid, 'pgclass') as comment from pgclass c, pgnamespace n where c.relkind in ('r', 'p') and n.oid = c.relnamespace and n.nspname not in ('pgcatalog', 'information_schema') order by c.relname)

15 4.165

15 4.165 at vendor/laravel/framework/src/Illuminate/Database/Connection.php:813

15 4.170 809▕ $this->getName(), $query, $this->prepareBindings($bindings), $e

15 4.170 810▕ );

15 4.170 811▕ }

15 4.170 812▕

15 4.170 ➜ 813▕ throw new QueryException(

15 4.170 814▕ $this->getName(), $query, $this->prepareBindings($bindings), $e

15 4.170 815▕ );

15 4.170 816▕ }

15 4.170 817▕ }

15 4.170

15 4.170 +41 vendor frames

15 4.170

15 4.170 42 artisan:13

15 4.170 Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))

15 4.170

15 ERROR: process "/bin/bash -ol pipefail -c composer install && npm install && php artisan && php artisan optimize && php artisan migrate --force" did not complete successfully: exit code: 1

[11/12] RUN composer install && npm install && php artisan && php artisan optimize && php artisan migrate --force:

4.170 814▕ $this->getName(), $query, $this->prepareBindings($bindings), $e

4.170 815▕ );

4.170 816▕ }

4.170 817▕ }

4.170

4.170 +41 vendor frames

4.170

4.170 42 artisan:13

4.170 Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))

4.170

Dockerfile:25

23 | # build phase

24 | COPY . /app/.

25 | >>> RUN composer install && npm install && php artisan && php artisan optimize && php artisan migrate --force

26 |

27 |

ERROR: failed to solve: process "/bin/bash -ol pipefail -c composer install && npm install && php artisan && php artisan optimize && php artisan migrate --force" did not complete successfully: exit code: 1

Error: Docker build failed" these are my environment configurations "APPNAME=Laravel APPENV=production
APPKEY=base64:uW7QwTPVp3h2J/3segnJJhZ23uMpnCyvvr1mV7Ei8Tc= APPDEBUG=true
APPTIMEZONE=UTC APPURL=https://tareas-api-production.up.railway.app/
APPLOCALE=en APPFALLBACKLOCALE=en APPFAKERLOCALE=enUS
APPMAINTENANCEDRIVER=file
APPMAINTENANCESTORE=database
BCRYPTROUNDS=12 LOGCHANNEL=stack
LOGSTACK=single LOGDEPRECATIONSCHANNEL=null LOGLEVEL=debug
DATABASEURL=postgresql://${{PGUSER}}:${{POSTGRESPASSWORD}}@${{RAILWAYPRIVATEDOMAIN}}:5432/${{PGDATABASE}}
DBCONNECTION=pgsql DBHOST=${{RAILWAYPRIVATEDOMAIN}}
DBPORT=5432 DBDATABASE=${{POSTGRESDB}} DBUSERNAME=${{POSTGRESUSER}} DBPASSWORD=${{POSTGRESPASSWORD}} SESSIONDRIVER=database
SESSIONLIFETIME=120 SESSIONENCRYPT=false
SESSIONPATH=/ SESSIONDOMAIN=null
BROADCASTCONNECTION=log FILESYSTEMDISK=local
QUEUECONNECTION=database CACHESTORE=database
CACHEPREFIX= MEMCACHEDHOST=127.0.0.1
REDISCLIENT=phpredis REDISHOST=127.0.0.1
REDISPASSWORD=null REDISPORT=6379
MAILMAILER=log MAILHOST=127.0.0.1
MAILPORT=2525 MAILUSERNAME=null
MAILPASSWORD=null MAILENCRYPTION=null
MAILFROMADDRESS=hello@example.com
MAILFROMNAME=${APPNAME} AWSACCESSKEYID=
AWSSECRETACCESSKEY= AWSDEFAULTREGION=us-east-1 AWSBUCKET=
AWSUSEPATHSTYLEENDPOINT=false
VITEAPPNAME=${APPNAME} NIXPACKSBUILDCMD=composer install && npm install && php artisan && php artisan optimize && php artisan migrate --force POSTGRESDB=railway
POSTGRESPASSWORD=***
POSTGRES
USER=postgres
SSLCERTDAYS=820"

1 Replies

9 months ago

Try enabling the new builder in your service settings.