problems when deploying laravel app with postgresql database
pedrosanch3z
TRIALOP

2 years 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, pg_total_relation_size(c.oid) as size, obj_description(c.oid, 'pg_class') as comment from pg_class c, pg_namespace n where c.relkind in ('r', 'p') and n.oid = c.relnamespace and n.nspname not in ('pg_catalog', '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 "APP_NAME=Laravel APP_ENV=production

APP_KEY=base64:uW7QwTPVp3h2J/3segnJJhZ23uMpnCyvvr1mV7Ei8Tc= APP_DEBUG=true

APP_TIMEZONE=UTC APP_URL=https://tareas-api-production.up.railway.app/

APP_LOCALE=en APP_FALLBACK_LOCALE=en APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file

APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12 LOG_CHANNEL=stack

LOG_STACK=single LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug

DATABASE_URL=postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}

DB_CONNECTION=pgsql DB_HOST=${{RAILWAY_PRIVATE_DOMAIN}}

DB_PORT=5432 DB_DATABASE=${{POSTGRES_DB}} DB_USERNAME=${{POSTGRES_USER}} DB_PASSWORD=${{POSTGRES_PASSWORD}} SESSION_DRIVER=database

SESSION_LIFETIME=120 SESSION_ENCRYPT=false

SESSION_PATH=/ SESSION_DOMAIN=null

BROADCAST_CONNECTION=log FILESYSTEM_DISK=local

QUEUE_CONNECTION=database CACHE_STORE=database

CACHE_PREFIX= MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis REDIS_HOST=127.0.0.1

REDIS_PASSWORD=null REDIS_PORT=6379

MAIL_MAILER=log MAIL_HOST=127.0.0.1

MAIL_PORT=2525 MAIL_USERNAME=null

MAIL_PASSWORD=null MAIL_ENCRYPTION=null

MAIL_FROM_ADDRESS=hello@example.com

MAIL_FROM_NAME=${APP_NAME} AWS_ACCESS_KEY_ID=

AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET=

AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME=${APP_NAME} NIXPACKS_BUILD_CMD=composer install && npm install && php artisan && php artisan optimize && php artisan migrate --force POSTGRES_DB=railway

POSTGRES_PASSWORD=***_

_POSTGRES_USER=postgres

SSL_CERT_DAYS=820"

1 Replies

2 years ago

Try enabling the new builder in your service settings.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...