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

shinyproxy user retrival #151

Merged
merged 7 commits into from
Mar 12, 2024
Merged

Conversation

arunkodati77
Copy link
Contributor

@arunkodati77 arunkodati77 commented Mar 7, 2024

In a ShinyProxy environment, the logged-in user will be automatically passed as an environmental variable instead of a session variable. Therefore, if the session is null, added an additional condition to check if username exists as an shinyproxy environmental variable using Sys.getenv("SHINYPROXY_USERNAME").

Follow this steps to test in shinyproxy environment:

  1. install docker and shinyproxy as mentioned in the official shinyproxy documentation
  2. pull the following docker image
    docker pull aruncoolprojects/demotelemetryshinyproxy
  3. overwrite the default shinyproxy configuration by creating a new application.yml in the shinyproxy root folder
    Note: In container-volumes: ["<-path-to-your-local-folder>:/root/shiny/data"], Replace <-path-to-your-local-folder> with your local path such that you can see the telemetry logs.
image

Have you read the Contributing Guidelines?

Issue Fixed # As you can see first line has a username: shinyproxy (he is the user we configured in our application.yml)
image

Changes description

Clearly and concisely describe what's in this pull request. Include screenshots, if necessary.

In Shinyproxy environment the loged in user will be passed as an environmental variable instead of a session variable. Hence if the session is null added additional check for shinyproxy username
@arunkodati77 arunkodati77 requested a review from averissimo March 7, 2024 21:02
@codecov-commenter
Copy link

codecov-commenter commented Mar 7, 2024

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 31.33%. Comparing base (67dc7ed) to head (ff68889).

❗ Current head ff68889 differs from pull request most recent head 00f346b. Consider uploading reports for the commit 00f346b to get more accurate results

Files Patch % Lines
R/telemetry.R 0.00% 5 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #151      +/-   ##
==========================================
- Coverage   31.40%   31.33%   -0.07%     
==========================================
  Files          16       16              
  Lines        1433     1436       +3     
==========================================
  Hits          450      450              
- Misses        983      986       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@averissimo
Copy link
Contributor

Thanks for the PR @arunkodati77!

  • Can you please add instructions on how to test on a shinyproxy environment? docker-compose.yml or Dockerfile
  • Please correct the linter errors as well

Copy link
Contributor

@averissimo averissimo left a comment

Choose a reason for hiding this comment

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

Thanks for the instructions. I was able to setup an instance with the application.yml below

👍 It also works out-of-the-box when authentication: none as it generates a random username hash

application.yml contents
proxy:
  title: Open Analytics Shiny Proxy
  logo-url: https://www.openanalytics.eu/shinyproxy/logo.png
  landing-page: /
  heartbeat-rate: 10000
  heartbeat-timeout: 60000
  port: 8080
  authentication: simple
  admin-groups: scientists
  users:
    - name: shinyproxy
      password: 123
      groups: scientists
    - name: yada
      password: 123
      groups: scientists
  specs:
    - id: demo
      display-name: Demo telemetry
      description: To test
      container-volumes: ["/path/to/valid/folder:/root/shiny/data"]
      container-image: aruncoolprojects/demotelemetryshinyproxy
      access-groups: [scientists]
      
logging:
  file:
    name: shinyproxy.log

I think there's a problem with the code as it will always return "" when not deployed in shinyproxy.io

R/telemetry.R Outdated Show resolved Hide resolved
@averissimo averissimo self-assigned this Mar 11, 2024
Sys.getenv("ANY_VARIABLE") will return "".
Hence updated get_user() such that it will return NULL in non shinyproxy environment
averissimo
averissimo previously approved these changes Mar 12, 2024
Copy link
Contributor

@averissimo averissimo left a comment

Choose a reason for hiding this comment

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

LGTM!! 🚀

@averissimo averissimo dismissed their stale review March 12, 2024 16:26

Forgot about NEWS file

Copy link
Contributor

@averissimo averissimo left a comment

Choose a reason for hiding this comment

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

It looks good, can you add a bullet point item to the NEWS.md files? (under "New Features")

Copy link
Contributor

@averissimo averissimo left a comment

Choose a reason for hiding this comment

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

Looks great! 🚀

NEWS.md Show resolved Hide resolved
@arunkodati77 arunkodati77 merged commit e0549f1 into main Mar 12, 2024
8 checks passed
@arunkodati77 arunkodati77 deleted the feature/#124-shinyProxyUserRetrieval branch March 12, 2024 21:28
@arunkodati77 arunkodati77 linked an issue Mar 12, 2024 that may be closed by this pull request
1 task
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.

[Feature]: Support shinyproxy user retrieval method
3 participants