Postgresql setup

hello i’m trying to configure postgres 9.6 on circleCI, however i get the error unknown user: postgres. My circleCI config is:

- image: postgres:9.6
# other config
- run:
      name: Setup postgresql user
      command: sudo -u postgres psql -p 5432 -c "create user testuser with password 'testpass';"
      command: sudo -u postgres psql -p 5432 -c "alter user testuser with superuser;"
      command: sudo -u postgres psql -p 5432 -c "create database testdb;"
      command: sudo -u postgres psql -p 5432 -c "grant all privileges on database testdb to testuser;"

Hello,

The run section is running on the first image which I assume is not Postgres. the best way to add a customer user and a database is to set them as ENVARS as described here and show here.

Thanks, @levlaz I configured the ENVVARS and its working perfectly! cheers!

1 Like

Glad to hear that it worked for you. Happy hacking :slight_smile: