I run the cerbos rest-demo <https://github.com/cer...
# community
n
I run the cerbos rest-demo https://github.com/cerbos/demo-rest by "docker-compose up" command. Then it creates 2 containers like image below, and I want to access these containers. @Alex Olivier (Cerbos) can you help me?
a
Hey - once
docker compose up
is up and running you can interact the API via exposed on port 9999
There are example cURL commands at the end of the README.md
message has been deleted
The containers themselves are very lightweight and don’t have a shell in them (the use
<http://gcr.io/distroless/base|gcr.io/distroless/base>
)
n
Ok.
Because I want to use mysql backend
So I try to understand when I call this API, where and how data is strored.
message has been deleted
So, Can you guide me, how to bring data store on disk to MySQL, in case rest-demo?
a
This is just a dummy app whcih stores the data in memory for now. If you want to change out the storage I would suggest forking the repo and implementing the MySQL connection in the go code and run it locally rather than through the container
This is the part where the objects are read/written - currently just held in memory https://github.com/cerbos/demo-rest/tree/main/db
n
ok, thanks Mr. @Alex Olivier (Cerbos). I can run Cerbos locally. I also install MySQL and setup config.yaml to connect MySQL. But, I lack a sample database even though I have a data scheme, it's my trouble.
message has been deleted
o
Hi @Napoleon Ponaparte, From what I understand you have set up
Cerbos
to use a
MySQL
database as a store for your policies. From the looks of your table, you’ve no policies stored in the system. In order to do so, you need to use Admin API of the
Cerbos
. The Admin API must be enabled by setting
server.adminAPI.enabled
to
true
in
config.yaml
. (See the config structure here if you have some doubts how to put
enabled
flag. You may configure
username
and
passwordHash
too.) Once you enable the Admin API with the credentials you have provided in configuration, you are authorized to send a request to an endpoint of Admin API. In your case, you need to use the endpoint
POST /admin/policy
. Please see the documentation for Admin API here. NOTE
Copy code
If you are using curl , you can provide username and password  for the Admin API with -u  flag like this;

curl -u cerbos:cerbosPassw <REST OF THE PARAMS>
n
@oguzhan thank you for your reply. I will check now