Closed hongbo-miao closed 2 years ago
Hi @Hongbo-Miao, silly question - but can you make sure the master branch indeed exists on the repo?
Github changed the default branch name to "main" a while back, so it could be that your branch name should be "main".
In that case you should set:
OPAL_POLICY_REPO_MAIN_BRANCH=<your_branch_name>
Oh, it is exact same repo with https://github.com/authorizon/opal-example-policy-repo but private. master
branch does exist:
As long as I change the repo to public, the error
ValueError: Reference at 'refs/heads/master' does not exist
will be gone.
For private repo, after this error shows a few times, it will eventually show Clone succeeded
, and seems all function well.
If only main
branch exists without OPAL_POLICY_REPO_MAIN_BRANCH=main
, it will fail without Clone succeeded
.
Hey @Hongbo-Miao , i sent you a docker compose file privately on slack. Can you please try to run it?
You will need this command:
docker compose -f ./docker-compose-example.yml up --force-recreate
It has a private key and uses our own private repo.
If my compose file works for you, then something in your docker compose or repo is not configured correctly. You are welcome to give me permissions on your repo and i can help you debug :)
I replaced https://github.com/authorizon/opal/blob/3e04a8e185bb8b0894c56c06ab919c5de8fefd06/docker/docker-compose-example.yml to the file you sent me.
Still got same error
Yeah, need some help for debugging 😃
Sure, i am quite available tomorrow. How about we do a zoom call and debug together?
just book something through my calendly
Close for now as it is a little bit low priority. Will post back in future if find anything!
Hi @Hongbo-Miao :) Let's keep this open until we are sure we solved it.
What i think is happening is some race condition while opal server is still cloning the repo. i made a small fix in 0.1.14 that might fix this issue.
Can you please check if you get the same issue with 0.1.14?
Hey @Hongbo-Miao - i think this is fixed :) i am closing the issue for now. Feel free to reopen the issue if the error is happening again.
Hi @asafc based on https://github.com/authorizon/opal/discussions/139#discussioncomment-1303934
it works well, it can pull the pricate repo successfully if you search
Clone succeeded
in the log. However, it also has some error logs inside likeHere is the full log:
Click to expand!
```shell ➜ docker compose up --force-recreate [+] Running 4/4 ⠿ Container opal-fetcher-postgres_example_db_1 Recreated 0.2s ⠿ Container opal-fetcher-postgres_broadcast_channel_1 Recreated 0.2s ⠿ Container opal-fetcher-postgres_opal_server_1 Recreated 0.1s ⠿ Container opal-fetcher-postgres_opal_client_1 Recreated 0.1s Attaching to broadcast_channel_1, example_db_1, opal_client_1, opal_server_1 broadcast_channel_1 | broadcast_channel_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization broadcast_channel_1 | broadcast_channel_1 | 2021-09-10 20:12:20.222 UTC [1] LOG: starting PostgreSQL 13.4 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424, 64-bit broadcast_channel_1 | 2021-09-10 20:12:20.222 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 broadcast_channel_1 | 2021-09-10 20:12:20.222 UTC [1] LOG: listening on IPv6 address "::", port 5432 broadcast_channel_1 | 2021-09-10 20:12:20.231 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" broadcast_channel_1 | 2021-09-10 20:12:20.237 UTC [22] LOG: database system was shut down at 2021-09-10 20:11:56 UTC broadcast_channel_1 | 2021-09-10 20:12:20.242 UTC [1] LOG: database system is ready to accept connections example_db_1 | example_db_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization example_db_1 | example_db_1 | 2021-09-10 20:12:20.377 UTC [1] LOG: starting PostgreSQL 13.4 (Debian 13.4-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit example_db_1 | 2021-09-10 20:12:20.377 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 example_db_1 | 2021-09-10 20:12:20.377 UTC [1] LOG: listening on IPv6 address "::", port 5432 example_db_1 | 2021-09-10 20:12:20.382 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" example_db_1 | 2021-09-10 20:12:20.389 UTC [28] LOG: database system was shut down at 2021-09-10 20:11:55 UTC example_db_1 | 2021-09-10 20:12:20.396 UTC [1] LOG: database system is ready to accept connections opal_server_1 | [2021-09-10 20:12:21 +0000] [1] [INFO] Starting gunicorn 20.1.0 opal_server_1 | [2021-09-10 20:12:21 +0000] [1] [INFO] Listening at: http://0.0.0.0:7002 (1) opal_server_1 | [2021-09-10 20:12:21 +0000] [1] [INFO] Using worker: uvicorn.workers.UvicornWorker opal_server_1 | [2021-09-10 20:12:21 +0000] [9] [INFO] Booting worker with pid: 9 opal_server_1 | [2021-09-10 20:12:21 +0000] [10] [INFO] Booting worker with pid: 10 opal_server_1 | [2021-09-10 20:12:21 +0000] [11] [INFO] Booting worker with pid: 11 opal_server_1 | [2021-09-10 20:12:21 +0000] [12] [INFO] Booting worker with pid: 12 opal_server_1 | 2021-09-10T20:12:22.469124+0000 |opal_common.authentication.signer | INFO | OPAL was not provided with JWT encryption keys, cannot verify api requests! opal_server_1 | 2021-09-10T20:12:22.469185+0000 |opal_common.authentication.signer | INFO | OPAL was not provided with JWT encryption keys, cannot verify api requests! opal_server_1 | 2021-09-10T20:12:22.469414+0000 |opal_common.authentication.signer | INFO | OPAL was not provided with JWT encryption keys, cannot verify api requests! opal_server_1 | 2021-09-10T20:12:22.475916+0000 |opal_common.authentication.signer | INFO | OPAL was not provided with JWT encryption keys, cannot verify api requests! opal_server_1 | 2021-09-10T20:12:22.531102+0000 |opal_server.server | INFO | triggered startup event opal_server_1 | 2021-09-10T20:12:22.531362+0000 |opal_common.topics.publisher | INFO | started topic publisher opal_server_1 | 2021-09-10T20:12:22.531265+0000 |opal_server.server | INFO | triggered startup event opal_server_1 | 2021-09-10T20:12:22.531640+0000 |opal_server.server | INFO | leadership lock acquired, leader pid: 11 opal_server_1 | 2021-09-10T20:12:22.531774+0000 |opal_server.server | INFO | listening on webhook topic: 'webhook' opal_server_1 | 2021-09-10T20:12:22.531738+0000 |opal_common.topics.publisher | INFO | started topic publisher opal_server_1 | 2021-09-10T20:12:22.531933+0000 |opal_server.server | INFO | triggered startup event opal_server_1 | 2021-09-10T20:12:22.532309+0000 |opal_common.topics.publisher | INFO | started topic publisher opal_server_1 | 2021-09-10T20:12:22.532634+0000 |fastapi_websocket_pubsub.event_notifier | INFO | New subscription {'id': '598b3711bd6b458392bd973d3ac3b41d', 'subscriber_id': 'd8043eb8ebd046b186a03558f3407340', 'topic': 'webhook', 'callback': functools.partial(