Hi <@U0283CHN8NA> I knew about Cerbos via Nurul fr...
# community
c
Hi @Emre (Cerbos) I knew about Cerbos via Nurul from Prisma. I have this kind of auth flow to be implemented but now I am curious to know: Is Cerbos only for authorization and then I can build the user tables in my app and do authentication there?
a
Hey! Yes this is a very common model where the users and their roles are stored in your application (and thus you can build a UI around) - and then these are passed in principal object to Cerbos for use in authorization policies. Here is an example of an express app using Prisma and Cerbos https://github.com/cerbos/express-prisma-cerbos/
c
Ok thanks, let me check out the docs for more understanding. I will revert ASAP!
šŸ‘ 1
Hi @Alex Olivier (Cerbos) I am going through the Prisma-Cerbos example but I am getting this error when I attempt to start Cerbos via `sudo docker run -i -t -p 3592:3592 -v $(pwd)/config:/config -v $(pwd)/policies:/policies ghcr.io/cerbos/cerbos:0.6.0 server --config=/config/config.yaml`:
Copy code
/policies     <http://ghcr.io/cerbos/cerbos:0.6.0|ghcr.io/cerbos/cerbos:0.6.0>     server --config=/config/config.yaml
[sudo] password for chaiwa: 
Unable to find image '<http://ghcr.io/cerbos/cerbos:0.6.0|ghcr.io/cerbos/cerbos:0.6.0>' locally
0.6.0: Pulling from cerbos/cerbos
b49b96595fd4: Pull complete 
9411f38bb959: Pull complete 
ae4da295c61e: Pull complete 
5dbfc77bfac5: Pull complete 
Digest: sha256:d7e72e0b13d53297591bc9c1bfe9318afa0ee8582f5f878411e57e54f7560712
Status: Downloaded newer image for <http://ghcr.io/cerbos/cerbos:0.6.0|ghcr.io/cerbos/cerbos:0.6.0>
2022-05-26T13:48:43.262Z	INFO	cerbos.server	maxprocs: Leaving GOMAXPROCS=4: CPU quota undefined
2022-05-26T13:48:43.263Z	INFO	cerbos.server	maxprocs: No GOMAXPROCS change to reset
ERROR: failed to create store: unknown storage driver []
a
Ah i was trying to work out where the out version number from, I realise that articles formatting is abit off and the YAML has lost its indent leading to this error. Your config.yaml file should be formatted like this.
Copy code
server:
  httpListenAddr: ":3592"
storage:
  driver: "disk"
  disk:
    directory: /policies
    watchForChanges: true
and your start command is:
Copy code
sudo docker run -i -t -p 3592:3592 \
    -v $(pwd)/config:/config \
    -v $(pwd)/policies:/policies \
    <http://ghcr.io/cerbos/cerbos:latest|ghcr.io/cerbos/cerbos:latest> \
    server --config=/config/conf.yaml
I’m going to fix that article now. Sorry about that.
c
Running it the second time works. I guess I had removed the
---
from the yaml file.
a
Did the above work?
c
Yes it did but with that
---
at the very top. For some reason I didn't copy that line, initially. So like this, it works:
Copy code
---
server:
  httpListenAddr: ":3592"
storage:
  driver: "disk" # Valid values are "disk" or "git"
  disk: # Only required if "driver" is "disk"
    directory: /policies
    watchForChanges: true
šŸ‘ 1
a
I’d recommend using the
<http://ghcr.io/cerbos/cerbos:latest|ghcr.io/cerbos/cerbos:latest>
or
<http://ghcr.io/cerbos/cerbos:0.16.0|ghcr.io/cerbos/cerbos:0.16.0>
docker tags -
0.6.0
is an old version now
šŸ‘ 1
c
Hi @Alex Olivier (Cerbos) , I now have a quick sense of what is going on. Quick one: In the scenario I shared above, if I used Cerbos for authorization would you recommend I do away with
RolePermission
and
Permission
tables and delegate their definitions to cerbos resource policies? Did I get this right?
a
Yes you can take that and model it in resource policies. Have you seen our playground? It has examples for some common scenarios and lets you experiment right in browser https://play.cerbos.dev/
c
On it!