Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

darrenlr's avatar

Vapor Deploy failure when running migrate

We currently have a bunch of projects all running fine on Vapor. This morning we have tried to deploy a new one, and everything seems to by ok apart from when we try to run the migrations we get an error as, for some reason, it's trying to run them on localhost:

SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? (SQL: select * from information_schema.tables where table_catalog = forge and ta ble_schema = public and table_name = migrations and table_type = 'BASE TABL E')

This is the .env.staging:

APP_NAME="ODSPreview"
APP_KEY={key}
APP_DEBUG=false

MAIL_DRIVER=log
MAIL_MAILER=log

DB_CONNECTION=mysql
DB_DATABASE=ods

TELESCOPE_ENABLED=false

And this is the vapor.yml for staging:

id: {id}
name: ods
environments:
  staging:
    memory: 1024
    cli-memory: 512
    runtime: 'php-8.1:al2'
    network: vapor-network-1111111111
    database: DB_TWO
    queue-concurrency: 10
    cli-timeout: 600
    timeout: 120
    cache: name-cache
    storage: name-two
    build:
      - 'COMPOSER_MIRROR_PATH_REPOS=1 composer install --no-dev'
      - 'php artisan event:cache'
    #           - 'npm ci && npm run dev && rm -rf node_modules'
	deploy:
       - 'php artisan migrate --force'
    firewall:
      rate-limit: 1000
      bot-control:
        - CategorySearchEngine
        - CategorySocialMedia
        - CategoryScrapingFramework
        - SignalNonBrowserUserAgent
        - CategoryMiscellaneous
        - CategoryScrapingFramework

Note: we have create the db ods within the DB_TWO instance. It seems like it's trying to take the default info from database.php in config but I don't know why. We haven't has this issue with any of our other projects.

Does anyone have any ideas as to why it's doing this?

0 likes
1 reply
darrenlr's avatar
darrenlr
OP
Best Answer
Level 5

Managed to figure this out. A Config::set was being used unnecessarily in a couple of import commands.

Please or to participate in this conversation.