Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local deploy tries to connect to keycloak #1141

Closed
grzanka opened this issue Aug 6, 2023 · 5 comments
Closed

Local deploy tries to connect to keycloak #1141

grzanka opened this issue Aug 6, 2023 · 5 comments
Assignees
Labels
bug EuroHPC features created within EuroHPC project Fluka Right now as the many-core CPUs are so popular we can switch to parallel compilation.
Milestone

Comments

@grzanka
Copy link
Contributor

grzanka commented Aug 6, 2023

We should consider reconfiguring or disabling keycloak service for local deployment.

The steps to reproduce:

  1. Clone backend (master) and bring it up with docker compose up -d --build
  2. Once ready add first local user: docker exec -w /usr/local/app/ yaptide_flask python3 yaptide/admin/db_manage.py add-user admin --password mysecretpassword
  3. Clone frontent (master) and bring it up with docker compose up -d --build
  4. Open browser and load frontend using plain (not HTTPS!!!) by typing: http://localhost (not https://localhost !!)
  5. Login as admin/mysecretpassword
  6. Submit some simulation for local execution
  7. After 2.5 minutes (150s) you will be automatically logged out. That should not happen.

Here is the timing of events:

  1. Second 0 we open the app:
    image

  2. At 25s we submit a simulation:
    image

  3. At 1.1 min we have the results:
    image
    image

  4. At 2.5 min we are logged out. There goes a request to sso.pre.plgrid.pl, but I ran the test on my own laptop, hence no access there:
    image

image

@grzanka grzanka added the EuroHPC features created within EuroHPC project label Aug 6, 2023
@grzanka
Copy link
Contributor Author

grzanka commented Aug 6, 2023

We could consider also a way to set a local keycloak, but maybe for local development we can simply disable "plgrid" option ?

@grzanka
Copy link
Contributor Author

grzanka commented Aug 6, 2023

Funny enough the local build has REACT_APP_ALT_AUTH not set.

Dockerfile does:
RUN npx cross-env REACT_APP_DEPLOYMENT=${DEPLOYMENT} npm run build

In package json we have:

		"build": "react-app-rewired build",
		"build-plg": "cross-env REACT_APP_ALT_AUTH=plg npm run build",
		"build-demo": "cross-env REACT_APP_TARGET=demo npm run build",

In the config file we have

const ALT_AUTH = process.env.REACT_APP_ALT_AUTH === 'plg';

The PLGRID login button is disabled hence I would expect that no calls to keycloak are made.

image

@grzanka
Copy link
Contributor Author

grzanka commented Aug 6, 2023

On yap-dev I set REACT_APP_ALT_AUTH to enable PLGRID login on contrary

@grzanka grzanka added the bug label Aug 6, 2023
@grzanka grzanka added this to the 2023 August milestone Aug 6, 2023
@grzanka grzanka modified the milestones: 2023 August, 2023 December Sep 4, 2023
@grzanka grzanka added the Fluka Right now as the many-core CPUs are so popular we can switch to parallel compilation. label Nov 29, 2023
@hendzeld
Copy link
Contributor

Now, we have automatic redirection to HTTPs in local env (nginx).
I had to change the configuration.
Seems that it works fine now.

Logging out

Image

Image

Result, more than 2 minutes, still logged in.

Image

Summary. Seems that it works now.

Build

By default, Docker image is created using prod env

# Default deployment type can be overwritten by docker build --build-arg DEPLOYMENT=dev ...
ARG DEPLOYMENT=prod

RUN echo "Deploying for ${DEPLOYMENT}"

# Build the app.
RUN npx cross-env REACT_APP_DEPLOYMENT=${DEPLOYMENT} npm run build

I had set K8S variables during build, with default DEPLOYMENT value.
I do not see any requests to KC

@hendzeld
Copy link
Contributor

To get full picture, application was tested with npm run start and .env:

REACT_APP_KEYCLOAK_BASE_URL=http://localhost:8080
REACT_APP_KEYCLOAK_REALM=local
REACT_APP_KEYCLOAK_CLIENT_ID=yaptide
REACT_APP_ALT_AUTH=plg

http://localhost:3000/

Local was not logged out.

Image

@grzanka grzanka closed this as completed Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug EuroHPC features created within EuroHPC project Fluka Right now as the many-core CPUs are so popular we can switch to parallel compilation.
Projects
None yet
Development

No branches or pull requests

2 participants