Slackbot
02/28/2023, 2:53 PMOmer Zuarets
02/28/2023, 2:58 PMAsaf Cohen
02/28/2023, 3:01 PMenteries
is not a typo?Asaf Cohen
02/28/2023, 3:02 PMentries
Asaf Cohen
02/28/2023, 3:03 PMRo'e Katz
02/28/2023, 3:43 PMJack Geek
02/28/2023, 5:51 PMJack Geek
02/28/2023, 5:52 PMOmer Zuarets
03/01/2023, 9:46 AMentries
key need to be nested under config
key, you can see the model definition here .
A valid json would be:
{
"config": {
"entries": []
}
}
The second one is that it looks like it fails to decode the json ( might be because of the \"
escaping), try removing the escaping part, if this doesn’t work please provide us your docker run command ( without any private data ) so we could check it.Jack Geek
03/01/2023, 11:35 AMJack Geek
03/01/2023, 12:11 PMJack Geek
03/01/2023, 12:22 PMOmer Zuarets
03/01/2023, 3:47 PMJack Geek
03/01/2023, 8:13 PMJack Geek
03/01/2023, 8:13 PMAsaf Cohen
03/01/2023, 8:16 PMAsaf Cohen
03/01/2023, 8:17 PMJack Geek
03/01/2023, 8:18 PMAsaf Cohen
03/01/2023, 8:19 PMJack Geek
03/01/2023, 8:25 PMAsaf Cohen
03/01/2023, 8:27 PMOPAL_DATA_CONFIG_SOURCES={"config":{"entries":[]}}
or something elseAsaf Cohen
03/01/2023, 8:27 PMJack Geek
03/01/2023, 8:33 PMAsaf Cohen
03/01/2023, 8:54 PMversion: "3.8"
services:
# When scaling the opal-server to multiple nodes and/or multiple workers, we use
# a *broadcast* channel to sync between all the instances of opal-server.
# Under the hood, this channel is implemented by encode/broadcaster (see link below).
# At the moment, the broadcast channel can be either: postgresdb, redis or kafka.
# The format of the broadcaster URI string (the one we pass to opal server as `OPAL_BROADCAST_URI`) is specified here:
# <https://github.com/encode/broadcaster#available-backends>
broadcast_channel:
image: postgres:alpine
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
opal_server:
# by default we run opal-server from latest official image
image: permitio/opal-server:0.5.0
environment:
# the broadcast backbone uri used by opal server workers (see comments above for: broadcast_channel)
- OPAL_BROADCAST_URI=<postgres://postgres:postgres@broadcast_channel:5432/postgres>
# number of uvicorn workers to run inside the opal-server container
- UVICORN_NUM_WORKERS=4
# the git repo hosting our policy
# - if this repo is not public, you can pass an ssh key via `OPAL_POLICY_REPO_SSH_KEY`)
# - the repo we pass in this example is *public* and acts as an example repo with dummy rego policy
# - for more info, see: <https://docs.opal.ac/tutorials/track_a_git_repo>
- OPAL_POLICY_REPO_URL=<https://github.com/permitio/opal-example-policy-repo>
# in this example we will use a polling interval of 30 seconds to check for new policy updates (git commits affecting the rego policy).
# however, it is better to utilize a git *webhook* to trigger the server to check for changes only when the repo has new commits.
# for more info see: <https://docs.opal.ac/tutorials/track_a_git_repo>
- OPAL_POLICY_REPO_POLLING_INTERVAL=30
# configures from where the opal client should initially fetch data (when it first goes up, after disconnection, etc).
# the data sources represents from where the opal clients should get a "complete picture" of the data they need.
# after the initial sources are fetched, the client will subscribe only to update notifications sent by the server.
- OPAL_DATA_CONFIG_SOURCES={"config":{"entries":[]}}
- OPAL_LOG_FORMAT_INCLUDE_PID=true
ports:
# exposes opal server on the host machine, you can access the server at: <http://localhost:7002>
- "7002:7002"
depends_on:
- broadcast_channel
opal_client:
# by default we run opal-client from 0.5.0 official image
image: permitio/opal-client:0.5.0
environment:
- OPAL_SERVER_URL=<http://opal_server:7002>
- OPAL_LOG_FORMAT_INCLUDE_PID=true
- OPAL_INLINE_OPA_LOG_FORMAT=http
ports:
# exposes opal client on the host machine, you can access the client at: <http://localhost:7000>
- "7766:7000"
# exposes the OPA agent (being run by OPAL) on the host machine
# you can access the OPA api that you know and love at: <http://localhost:8181>
# OPA api docs are at: <https://www.openpolicyagent.org/docs/latest/rest-api/>
- "8181:8181"
depends_on:
- opal_server
# this command is not necessary when deploying OPAL for real, it is simply a trick for dev environments
# to make sure that opal-server is already up before starting the client.
command: sh -c "./wait-for.sh opal_server:7002 --timeout=20 -- ./start.sh"
while this produces an error:
version: "3.8"
services:
# When scaling the opal-server to multiple nodes and/or multiple workers, we use
# a *broadcast* channel to sync between all the instances of opal-server.
# Under the hood, this channel is implemented by encode/broadcaster (see link below).
# At the moment, the broadcast channel can be either: postgresdb, redis or kafka.
# The format of the broadcaster URI string (the one we pass to opal server as `OPAL_BROADCAST_URI`) is specified here:
# <https://github.com/encode/broadcaster#available-backends>
broadcast_channel:
image: postgres:alpine
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
opal_server:
# by default we run opal-server from latest official image
image: permitio/opal-server:0.5.0
environment:
# the broadcast backbone uri used by opal server workers (see comments above for: broadcast_channel)
- OPAL_BROADCAST_URI=<postgres://postgres:postgres@broadcast_channel:5432/postgres>
# number of uvicorn workers to run inside the opal-server container
- UVICORN_NUM_WORKERS=4
# the git repo hosting our policy
# - if this repo is not public, you can pass an ssh key via `OPAL_POLICY_REPO_SSH_KEY`)
# - the repo we pass in this example is *public* and acts as an example repo with dummy rego policy
# - for more info, see: <https://docs.opal.ac/tutorials/track_a_git_repo>
- OPAL_POLICY_REPO_URL=<https://github.com/permitio/opal-example-policy-repo>
# in this example we will use a polling interval of 30 seconds to check for new policy updates (git commits affecting the rego policy).
# however, it is better to utilize a git *webhook* to trigger the server to check for changes only when the repo has new commits.
# for more info see: <https://docs.opal.ac/tutorials/track_a_git_repo>
- OPAL_POLICY_REPO_POLLING_INTERVAL=30
# configures from where the opal client should initially fetch data (when it first goes up, after disconnection, etc).
# the data sources represents from where the opal clients should get a "complete picture" of the data they need.
# after the initial sources are fetched, the client will subscribe only to update notifications sent by the server.
- OPAL_DATA_CONFIG_SOURCES="{\"config\":{\"entries\":[]}}"
- OPAL_LOG_FORMAT_INCLUDE_PID=true
ports:
# exposes opal server on the host machine, you can access the server at: <http://localhost:7002>
- "7002:7002"
depends_on:
- broadcast_channel
opal_client:
# by default we run opal-client from 0.5.0 official image
image: permitio/opal-client:0.5.0
environment:
- OPAL_SERVER_URL=<http://opal_server:7002>
- OPAL_LOG_FORMAT_INCLUDE_PID=true
- OPAL_INLINE_OPA_LOG_FORMAT=http
ports:
# exposes opal client on the host machine, you can access the client at: <http://localhost:7000>
- "7766:7000"
# exposes the OPA agent (being run by OPAL) on the host machine
# you can access the OPA api that you know and love at: <http://localhost:8181>
# OPA api docs are at: <https://www.openpolicyagent.org/docs/latest/rest-api/>
- "8181:8181"
depends_on:
- opal_server
# this command is not necessary when deploying OPAL for real, it is simply a trick for dev environments
# to make sure that opal-server is already up before starting the client.
command: sh -c "./wait-for.sh opal_server:7002 --timeout=20 -- ./start.sh"
Asaf Cohen
03/01/2023, 8:57 PMAsaf Cohen
03/01/2023, 8:57 PM- name: SPRING_APPLICATION_JSON
value: {{ .Values.service.spring_application_json | toJson | quote }}
to encode a jsonJack Geek
03/01/2023, 8:59 PMJack Geek
03/01/2023, 9:00 PMAsaf Cohen
03/01/2023, 9:00 PMAsaf Cohen
03/01/2023, 9:00 PM- name: FOO
value: |
{"foo":"bar"}
Jack Geek
03/01/2023, 9:08 PMJack Geek
03/01/2023, 9:08 PMAsaf Cohen
03/01/2023, 9:09 PMAsaf Cohen
03/01/2023, 9:09 PMAsaf Cohen
03/01/2023, 9:11 PMAsaf Cohen
03/01/2023, 9:11 PMJack Geek
03/01/2023, 9:11 PMAsaf Cohen
03/01/2023, 9:12 PMAsaf Cohen
03/02/2023, 8:32 PMinvalid literal for int() with base 10: '<tcp://10.116.5.135:80>'
◦ Where is <tcp://10.116.5.135:80>
passed? is it part of OPAL_DATA_CONFIG_SOURCES
?
◦ It looks like this value is passed instead of something that is expected to be an int.
◦ Can you extract all the environment variables you are passing to OPAL and check where this value is located? if you give the exact config var that is problematic and the value (assuming it's not sensitive, if so - redact the sensitive stuff) i would be able to reproduce this on my end
Sorry i couldn't fix this faster, in the meanwhile please use 0.4.0 until we can narrow it down.Jack Geek
03/06/2023, 4:21 PMAsaf Cohen
03/06/2023, 4:32 PMinvalid literal for int()
error 😞Asaf Cohen
03/06/2023, 4:33 PMOr Weis
03/06/2023, 5:03 PMJack Geek
03/06/2023, 5:18 PMOr Weis
03/06/2023, 5:28 PMJack Geek
03/06/2023, 5:43 PMOr Weis
03/06/2023, 7:17 PMOPAL_IS_STRICT_CONFIG=False
https://github.com/permitio/opal/pull/399
@Asaf Cohen for your reviewRo'e Katz
03/07/2023, 5:37 PMOPAL_SERVER_PORT='<tcp://10.116.5.135:80>'
, which is unfortunately one of Opal’s configuration options and is expected to be an integer. (as mentioned - since 0.5.0 we don’t fallback to using default values on parsing errors).
An easy fix would be setting OPAL_SERVER_PORT='7002'
explicitly. Or to rename your deployment/service to another name 🙂
Disabling strict parsing as @Or Weis suggested would also work of course - but we recommend testing those options first.
(We’re gonna discuss what’s be the best way to avoid this issue in the future - but letting you know first so you can move forward)Jack Geek
03/07/2023, 6:08 PMJack Geek
03/07/2023, 6:10 PMgit_http_url
coming from the Gitlab webhook request.Or Weis
03/07/2023, 6:22 PMOr Weis
03/07/2023, 6:22 PMJack Geek
03/07/2023, 6:24 PMOr Weis
03/07/2023, 6:25 PMOr Weis
03/07/2023, 6:26 PMJack Geek
03/07/2023, 6:40 PMOr Weis
03/07/2023, 6:41 PMOr Weis
03/07/2023, 6:41 PMJack Geek
03/07/2023, 6:44 PMJack Geek
03/07/2023, 6:45 PM