omgnetwork / goban

Development environment bootstrapper for OmiseGO projects using Vagrant and Ansible.
Apache License 2.0
4 stars 1 forks source link

Add ewallet & ledger postgres user with CREATEDB permission #11

Closed unnawut closed 6 years ago

unnawut commented 6 years ago

This PR creates two new database users ewallet and ledger without superuser privileges to better mimic the database settings in the real world, i.e. apps will be accessing the database as a non-superuser.

sirn commented 6 years ago

Just noticed we didn't use vars file here. tl;dr

provisioning/
`- roles/
   `- postgresql/
      `- vars/            <- create this directory
         `- main.yml      <- create this file

with content:

---
ewallet_db_user: ewallet
ewallet_db_password: passw0rd
ledger_db_user: ledger
ledger_db_password: passw0rd

and in .j2 file, we can now refer to these vars with {{ewallet_db_user}}, etc.

unnawut commented 6 years ago

Thanks. That helps save me a lot of time of trial and error :D

unnawut commented 6 years ago

@sirn Please check again. The Goban bootstrap now generates this:

vagrant@ewallet:/vagrant$ docker exec -it postgres psql -U postgres
psql (9.6.9)
Type "help" for help.

postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
 vagrant   | Create DB                                                  | {}