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

Point dockerized shiny app at different instances of the API #168

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

dtenenba
Copy link
Contributor

This enables testers to run the shiny app and have it point to different versions of the PROOF API.

Until now, it was a bit of a pain to test changes to the PROOF API that were in dev - you couldn't do it with the shiny app. You had to use proofr (being sure to set the PROOF_API_BASE_URL to https://proof-api-dev.fredhutch.org) or the swagger UI at https://proof-api-dev.fredhutch.org .

This builds on the previously added ability for testers to run different versions of the shiny app locally using Docker:

make branch=branch_name run_branch

Assuming branch_name is a valid branch of this repo, which has built successfully, this command will run the Docker image of that branch, which you can then access at http://localhost:3838 .

The present change enables two new Makefile targets:

make branch=branch_name run_branch_dev_api

That will run the shiny app and it will point at the dev version of the API.

For developers of the API (mostly me), you can also do this:

make branch=branch_name url=http://gizmo666:2112 run_branch_custom_api

Assuming you had an instance of the PROOF API at that URL, this would connect to it.

If the app goes grey

If you do all this, you may see the app go grey, and the following message in the terminal:

Warning: Error in req_perform: HTTP 401 Unauthorized.
• Additional context: No user for this token

If that happens, delete the cookies for the site. Basically, the app is getting confused because the dev version of the app uses different tokens than the production version. Deleting cookies and logging in again will solve this (and you should do this again when you switch back to using the prod version of the app, or running it locally).

Deleting cookies for a specific site works differently in each browser, but in Firefox you can click the lock to the left of the URL bar and then click Clear cookies and site data....

image

A note about branches

The above examples use a non-existent branch name called branch_name. In reality you would pick the branch of the app you want to test. If you are not testing anything specific in the shiny app (just functionality in the API) then you can choose the main or dev branch (or you will be able to do that, once this PR is merged into those branches).

@dtenenba
Copy link
Contributor Author

I should mention that there is no change here to the code or functionality of the app.
So it should be safe to merge this, but please test it.
All that has been added are a couple of Makefile targets.
You can test it with the branch name add-custom-api-targets-to-makefile.

Copy link
Collaborator

@sckott sckott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants