Travis CI: FATAL: role does not exist
For the record, put something like this in your .travis.yml
:
before_script:
- psql -c "CREATE USER skateparks WITH PASSWORD 'skateparks';" -U postgres
Postgresql database doesn't exist in travis ci after being created
Travis is not creating the myDiary database because the entire line is stringified. Only the command following -c should be a string.
services:
- postgresql
before_script:
- travis_wait 30 yarn install
- psql -c 'create database myDiary;' -U postgres
- travis_wait npm install
- node build/models/database.js
Travis CI: FATAL: database does not exist
I think the file extension should be .yml, not .yaml, as in .travis.yml
Travis-CI and PostgreSQL: psql: error: could not connect to server: No such file or directory
The issues is the Port Number in the error message.
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
On some distros and postgres versions, Postgres runs on port 5432
.
On dist: focal
and services: postgresql
the port is 5433
. The psql
command uses port 5432
.
To solve this, you need to add the -p 5433
to the psql
command:
$ psql -c 'CREATE DATABASE travis_ci_test;' -U postgres -p 5433
This will then give a new error;
psql: error: FATAL: Peer authentication failed for user "postgres"
The command "psql -c 'CREATE DATABASE travis_ci_test;' -U postgres -p 5433" failed and exited with 2 during .
But that is an error for another day.
psql: could not connect to server error on travis-ci
EDITED AFTER SOLUTION:
I was able to find out what was wrong. See below the definitive solution:
First: Travis wasn't compactive with postgres-10 (in the past)
Second: I needed remove the line that create a new database.
services:
- postgresql
addons:
postgresql: '9.6'
before_script:
- cp config/database.yml.travis config/database.yml
language: ruby
rvm:
- 2.5.0
script:
- bundle exec rails db:reset db:setup db:migrate RAILS_ENV=test
- bundle exec rspec
- bundle exec rubocop --config .rubocop.yml
The SDK directory does not exist Travis CI
Do not commit your local.properties file into your repository.
PostgreSQL 12 on Travis-CI taking 5 minutes to startup?
I finally managed to fix it. I pretty much copied the configuration from the default PostgreSQL version installed. Then just sed
it and restart the server. here is the commit and it looks something like this in .travis-ci.yaml
:
addons:
apt:
packages:
- postgresql-12
- postgresql-client-12
before_install:
- sudo sed -i 's/port = 5433/port = 5432/' /etc/postgresql/12/main/postgresql.conf
- sudo cp /etc/postgresql/{9.3,12}/main/pg_hba.conf
- sudo pg_ctlcluster 12 main restart
Build time reduced from ~ 11 min to just ~ 3 min.
Thing is, I've already done this once before with v10. But didn't remember it exactly, until now. But in case you're wondering, this was the .travis-ci.yml
for PostgreSQL v10.
Related Topics
Ruby Indented Multiline Strings
How Do Version Numbers Work for Mri Ruby
Travis Ci: Fatal: Role Does Not Exist
How to Get Long Filename from Argv
Nokogiri: Searching for <Div> Using Xpath
Bundler - Load Multiple Gemfiles
Ruby/Pgsql Error on Rails Start:Cannot Load Such File -- Pg_Ext (Loaderror)
Ruby Equivalent of PHP's ".=" (Dot Equals) Operator
Controller Can Not Detect Ajax Requests
Ruby on Rails 4 - Simple_Form Multiple Select Input
Declaring an Integer Range with Step != 1 in Ruby
Homebrew Install Ruby Keg-Only Can't Find Gem
Creating a Setter Method That Takes Extra Arguments in Ruby