bcgov / vc-authn-oidc

Apache License 2.0
142 stars 74 forks source link

Bugs when completing VC AuthN Demo Applications #302

Closed finnformica closed 1 year ago

finnformica commented 1 year ago

Hi all,

I'm new to this space and trying to run through some demos to get up to speed. I'm currently completing this demo and have run into an issue. When trying to execute the build command in vc-authn-oidc/demo/docker by running ./manage build I receive the following problem below. At the same time I ran vc-authn-oidc/docker/manage build without any issue so the Docker daemon is definitely running. I am using an M1 Macbook Pro, Ventura 13.2.1 and my Docker Desktop is 4.21.1 which is the latest version available.

Building oidc-django image from centos/python-36-centos7...
error: Unable to load docker config: json: cannot unmarshal string into Go value of type docker.dockerConfig
FATAL: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Any help with this issue would be greatly appreciated thank you!

swcurran commented 1 year ago

@esune — does anyone on the BCGov team have an M1 that could try this? Should @finnformica be using the v2 branch — and would it be better?

WadeBarnes commented 1 year ago

@finnformica, what version of s2i do you have installed? I recall people having build issues with some versions of s2i. I'm on Windows 11, but I use s2i v1.3.1, and that works for me.

The vc-authn-oidc/demo/docker build uses s2i the vc-authn-oidc/docker does not.

swcurran commented 1 year ago

Presumably, we need to eliminate the use of s2i in this, right? @esune — is it used on the v2 branch? Also, are we still using/evolving the demo apps as needed — e.g., just make sure they keep working?

finnformica commented 1 year ago

@WadeBarnes I'm using version 1.3.8, would it be worth downgrading to 1.3.1 to see if that helps?

And yep its just the demo/docker build command that is failing

WadeBarnes commented 1 year ago

@WadeBarnes I'm using version 1.3.8, would it be worth downgrading to 1.3.1 to see if that helps?

Yes

WadeBarnes commented 1 year ago

Presumably, we need to eliminate the use of s2i in this, right? @esune — is it used on the v2 branch? Also, are we still using/evolving the demo apps as needed — e.g., just make sure they keep working?

The v2 branch does not use s2i for any of the builds.

finnformica commented 1 year ago

@WadeBarnes using brew doesn't seem to allow me to install s2i 1.3.1, I'll try the v2 branch

Edit: doesn't seem like the demo folder is available in the 2.0-development

WadeBarnes commented 1 year ago

@WadeBarnes using brew doesn't seem to allow me to install s2i 1.3.1, I'll try the v2 branch

So brew install source-to-image@1.3.1 does not work? How far back will it let you go, and do one of those versions work?

finnformica commented 1 year ago

I don't think it lets me use the @x.x.x notation, I tried 1.3.7 and 1.3.8 and it couldn't find those either:

Warning: No available formula with the name "source-to-image@1.3.8". Did you mean source-to-image?

esune commented 1 year ago

@finnformica please follow the instructions on the main readme (see here) for an interactive demo in vc-authn 2.0.

I have access to an M1 Mac, however I am reluctant to fix issues in the 1.0 version since it is now out of support - 2.0 should work without issues as we did away with s2i altogether.

swcurran commented 1 year ago

Definitely need to move away from 1.0 to the 2.0 version. Hope we can make the transition soon!

finnformica commented 1 year ago

@esune thank you for letting me know. When trying to complete the 2.0 demo from within demo/vue I got an error when running docker compose up:

failed to solve: process "/bin/sh -c npm run all:ci && npm run all:build && npm run frontend:purge" did not complete successfully: exit code: 1

esune commented 1 year ago

I assume this is when running the vue frontend, correct? Did you run docker compose build before starting the app? The error message isn't too helpful unfortunately.

finnformica commented 1 year ago

Hi @esune, yes this is when running the vue front-end. Running docker compose build yields the same error:

failed to solve: process "/bin/sh -c npm run all:ci && npm run all:build && npm run frontend:purge" did not complete successfully: exit code: 1

esune commented 1 year ago

@finnformica I'll take a look today and see if I can push a fix for it

esune commented 1 year ago

@finnformica you can try running my branch with fixes, I have an open PR here: https://github.com/bcgov/vc-authn-oidc/pull/303

I am having issues with Keycloak now on M1, it might take me a bit longer to sort those out though...

finnformica commented 1 year ago

@esune thank you very much, I can successfully run docker compose build and docker compose up but I'm struggling to get the VC-AuthN instance up and running for what looks like a similar issue with M1 Silicon chips:

! keycloak The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 0.0s ! aca-py The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 0.0s

The front-end demo won't load but I'm assuming its due to issues with the authn instance? Thanks for your help!

esune commented 1 year ago

@finnformica yes, that is what I am trying to resolve now. Will update my PR as I make progress.

esune commented 1 year ago

@finnformica I updated my branch, haven't fully tested it and still need to clean a couple of things up, but I think it should work now

finnformica commented 1 year ago

@esune I'm getting a slightly different error now:

! aca-py The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 0.0s Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:5000 -> 0.0.0.0:0: listen tcp 0.0.0.0:5000: bind: address already in use

I checked and nothing is running on the port except the Docker instance itself, and I tried killing the process on it and restarting my computer but the error persists

swcurran commented 1 year ago

There is an Apple service running on 5000. You’ll have to use a different port.

finnformica commented 1 year ago

@esune I'm getting a slightly different error now:

! aca-py The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 0.0s Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:5000 -> 0.0.0.0:0: listen tcp 0.0.0.0:5000: bind: address already in use

I checked and nothing is running on the port except the Docker instance itself, and I tried killing the process on it and restarting my computer but the error persists

So turns out MacOS Ventura actually uses port 5000 for Airplay Receiver, I've turned that off the start command works, however, I can't view the swagger UI still:

vc-authn-aca-py-1         | 2023-08-02 03:08:24,007 aries_askar.native.aries_askar.ffi.store INFO   src/ffi/store.rs:1010 | Closed session SessionHandle(4)
vc-authn-aca-py-1         | 2023-08-02 03:08:24,007 aries_askar.native.aries_askar.backend.db_utils INFO src/backend/db_utils.rs:168 | Dropped pool connection
vc-authn-aca-py-1         | 2023-08-02 03:08:24,008 aries_cloudagent.core.event_bus DEBUG Notifying subscribers: <Event topic=acapy::core::startup, payload={}>
vc-authn-aca-py-1         | 2023-08-02 03:08:28,969 aries_cloudagent.ledger.indy_vdr DEBUG Closing pool ledger after timeout
finnformica commented 1 year ago

There is an Apple service running on 5000. You’ll have to use a different port.

Where can I change this? I've tried the manage.sh file and docker-compose file but it continues to run on localhost:5000

manage.sh

export CONTROLLER_SERVICE_PORT="5001"
WadeBarnes commented 1 year ago

It looks like it's hard coded to 5000; https://github.com/bcgov/vc-authn-oidc/blob/2.0-development/docker/manage#L160C10-L161

Code should be updated to allow the port to be overridden similar to what's done further down in the code; https://github.com/bcgov/vc-authn-oidc/blob/2.0-development/docker/manage#L183-L184

swcurran commented 1 year ago

There are also places where the environment variables are put into a .env if it doesn’t exist, and that file is removed when the ./manage down is used. I’ve made a copy of the file with my settings in it, and copy it to .env, so it is not recreated on ./manage start. I would suggest removing the the creation/removal of the .env from the ./manage script, and have creating/updating the file in the instructions, to be used for local overrides of the settings. This is done in Traction and works pretty well.

I’m working on some updates and will include those changes.

finnformica commented 1 year ago

It looks like it's hard coded to 5000; https://github.com/bcgov/vc-authn-oidc/blob/2.0-development/docker/manage#L160C10-L161

Code should be updated to allow the port to be overridden similar to what's done further down in the code; https://github.com/bcgov/vc-authn-oidc/blob/2.0-development/docker/manage#L183-L184

@WadeBarnes I tried updating that exact line to export CONTROLLER_SERVICE_PORT=5001 but I still couldn't get the swagger UI to load, is there maybe somewhere else that needs changing too?

esune commented 1 year ago

If you are using the code from my fork (make sure to pull), the code allows you to override the variable - see https://github.com/esune/vc-authn-oidc/blob/33c4b291657153a71574e41abe55470ba1e8712f/docker/manage#L160

CONTROLLER_SERVICE_PORT=5050 ./manage start will work (I am using it on my Mac). I'll do another round of testing and see if I can find issues with swagger, I didn't get to it yesterday as stated previously.

esune commented 1 year ago

This was resolved by #303. @finnformica please feel free to reopen if you still encounter issues.

finnformica commented 1 year ago

@esune thank you for your help, I can confirm that both the vue front-end and swagger UI for the controller are loading properly now.

However, after submitting the curl requests to localhost:5000 I'm unable to login using the 'Verified Credential Access' causing an Internal Server Error to be loaded in the front end and this error in the controller terminal:

{"event": "Exception in ASGI application\n", "exc_info": ["<class 'UnboundLocalError'>", "UnboundLocalError(\"cannot access local variable 'response' where it is not associated with a value\")", "<traceback object at 0xffff9051adc0>"], "logger": "uvicorn.error", "level": "error", "timestamp": "2023-08-09T00:56:47.888210Z"}

Did you manage to make it through this on your M1?

(don't think I have permissions to re-open the issue myself)