continuous-integration - Travis CI 中的 PostgreSQL 12 连接错误
问题描述
这是我的 Travis YML 文件:
language: php
dist: focal
services:
- postgresql
addons:
postgresql: '12'
apt:
packages:
- postgresql-12
- postgresql-client-12
cache:
directories:
- $HOME/.composer/cache/files
matrix:
fast_finish: true
include:
- php: 7.4
env:
- SYMFONY_VERSION="5.*" DB=postgresql PGPORT=5432
before_install:
- composer self-update
install:
- composer install
- psql -c 'create database testbase;' -U postgres
- php ./bin/console doctrine:migrations:migrate --no-interaction
script:
- phpunit
在构建过程中,在这一行:
$ psql -c 'create database testbase;' -U postgres
我收到此错误:
psql: error: could not connect to server: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
The command "psql -c 'create database testbase;' -U postgres" failed and exited with 2 during .
我也尝试了 PostgreSQL 11 和 10 的版本,但同样的错误。当我将构建分发从焦点切换到 xenial 时,构建和测试将通过。但是我们的生产服务器是焦点,所以这不是我们的解决方案。
解决方案
推荐阅读
- python - Django 3 OperationalError:没有这样的表'web_user'
- r - dplyr::mutate 是否适用于记录样式的列?
- ssl - NGINX 预留代理 SSL_ERROR_RX_RECORD_TOO_LONG
- java - Android:用于设置 NestedScrollView 最大高度的自定义类不起作用(没有滚动条)
- node.js - 在 Nodejs 中,我不断收到 Sequelize.js - “未关联到”错误
- python - 如何在python中使用两个或多个分隔符和split()
- java - 如何在没有登录功能的情况下在 android 中使用 firebase 创建一个基于回合的应用程序?关闭
- sql - 动态运行 SQL 查询
- python - 如何在kivy窗口中放置两个按钮?
- php - For 循环为同一查询提供两个答案