Hello,
I’m trying to setup a postgres instance in a macos environment, so I’m using the macos executor with homebrew. Unfortunately, I end up with psql: could not connect to server: Connection refused
when trying to create a postgres role (or sometimes I’ll get psql: FATAL: role "ubuntu" does not exist
which is baffling as I do not set the POSTGRES_USER to ubuntu
in any the yaml merge key environment settings. The commented out lines are things I’ve tried to no avail (I set POSTGRES_USER to distiller)
Some preliminary searching revealed I had to edit the pg_hba.conf, but that seems like impossible in a circle ci build configuration, so I opted to add this line run: /usr/local/Cellar/postgresql@9.6/9.6.11/bin/initdb /usr/local/var/postgres --auth=trust --auth-host=trust --auth-local=trust
. Can anyone point out a solution? The whole point of this is to spin up postgres in a MacOS environment that can then be used with a web application.
ios:
macos:
xcode: "10.0.0"
<<: *app-environment
<<: *ios-environment
steps:
#- run: brew install elixir
- run: brew install postgresql@9.6
- run: brew services start postgresql@9.6
- run:
name: "echo v"
command: |
V=$(ls /usr/local/Cellar/postgresql@9.6)
echo $V
- run: whoami
- run: echo $POSTGRES_USER
- run: /usr/local/Cellar/postgresql@9.6/9.6.11/bin/initdb /usr/local/var/postgres --auth=trust --auth-host=trust --auth-local=trust
#- run: /usr/local/Cellar/postgresql@9.6/9.6.11/bin/pg_ctl -D /usr/local/var/postgres -l logfile start
- run: /usr/local/Cellar/postgresql@9.6/9.6.11/bin/createuser -U $POSTGRES_USER
- run: /usr/local/Cellar/postgresql@9.6/9.6.11/bin/createuser -s $POSTGRES_USER
- run: |
/usr/local/Cellar/postgresql@9.6/9.6.11/bin/psql --host=127.0.0.1 --command="CREATE ROLE postgres;"
- run: |
/usr/local/Cellar/postgresql@9.6/9.6.11/bin/psql --host=127.0.0.1 --command="\du"
#- run: brew services stop postgresql@9.6
#- run: brew services start postgresql@9.6
- checkout