Code Monkey home page Code Monkey logo

analytics-platform-control-panel's Introduction

Analytical Platform Control Panel

The Control Panel is a management tool which provides the following features to our main stakeholders, the Ministry of Justice's Data Analysts and Data Scientists:

  • Allow them to access important datasets from across the MoJ easily and securely
  • Allow them to manage their own datasets easily and securely
  • Allow them to explore the data by using our online tooling environment
  • Allow them to deploy customised dashboards on our hosting platform

For administrators, Control Panel offers

  • User management
  • Permission management on datasets
  • Application management

Control Panel interacts heavily with our underlying infrastructure, such as our Kubernetes clusters and S3 buckets (AWS). It also has tight dependencies on the policies and strategies about how we manage our data lake and our infrastructure.

Tech documents

Control Panel is a Django project made up of three parts:

  1. A REST API for creating users, apps, tools & managing permissions in the Analytical Platform Kubernetes cluster, Auth0 and AWS IAM, and to allow external systems to view the created resources. This can be found under /controlpanel/api.

  2. A frontend web application allowing administration of a user's apps, data sources and tools in the Analytical Platform.

  3. A simple worker for running some time-consuming background tasks such as deploying a tool (e.g. RStudio or JupyterLab) on a cluster, restarting the instance of a tool, and resetting the home directory of a user's tooling environment.

More information is available through the following links:

Quickstart

To work with Control Panel yourself, we currently recommend setting up a local instance of the project. To do so, see our getting started guide in doc/running.md.

Formerly, we could also run a local instance of Control Panel via Docker but we have decided to pause the work needed to update this process (which was necessary after migrating to our new EKS cluster) in favour of an improved solution via LocalStack. See tickets ANPL-839 and ANPL-858 for the current status of this work.

For better understanding of the settings and environment variables used while running Control Panel, please check the Control Panel settings and environment variables file.

Other useful documentation

analytics-platform-control-panel's People

Contributors

ahbensiali avatar andyhd avatar andylightfoot avatar calumabarnett avatar damacus avatar davidread avatar davidslv avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar djsd123 avatar jakemulley avatar kerin avatar ladyrassilon avatar louiseabowler avatar michaeljcollinsuk avatar neillturner avatar ntoll avatar r4vi avatar rajindersinghsandhu avatar rossjones avatar s-block avatar tomskelley-gjs avatar xoen avatar ymao2 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

analytics-platform-control-panel's Issues

Create "developer" mode/configuration to ease setup of dev environment.

Setting up this application as a development environment is currently a fraught process. There are PRs in flight (see: #803), but this only gets you to an environment where the unit tests pass and the application starts. There remains a problem with interacting with Auth0, AWS, Slack, Kubernetes. It has been suggested (here) that a "developer" mode/configuration should be available so that the application works without needing to be plugged into these other services.

We should discuss how to do this on this ticket. I would like to know:

  • Is my list of problem third party "services" complete.
  • For each list item, how could they be reasonably be coded around.
  • What further "institutional" information is needed for this to work in terms of settings and configuration.

Thanks in advance..!

Error running reset-user-efs-home

Description

There is an error when attempting to run the "Reset home directory" helm chart via the Control Panel UI. The error may be related to a failure to update the helm repo, as the sentry log shows that the "mojanalytics/reset-user-efs-home" chart is not found.

The full stack trace of the error can be found in sentry:
https://ministryofjustice.sentry.io/issues/3941226983/?query=is%3Aunresolved&referrer=issue-stream&stream_index=17

Note: in sentry there are multiple Helm related errors, that all may be linked

To reproduce

  1. Log in to control panel
  2. Go to the tools page
  3. Click the "reset home directory" link
  4. Reset home directory
  5. To a user it appears it completed successfully. This is because the task is run in the background via django-channels. So check Sentry to see the stack trace of the background task

Expected behaviour

The task to run the helm helm chart should run successfully, and the users home directory is reset. The bug is fixed when:

  1. the steps to "reset home directory" can be completed via Control Panel (as steps above) and there is no error reported in sentry
  2. the commands defined in the helm chart are completed. This can be checked by connecting to the rstudio tools pod and checking that the files have been moved to the backup folder (defined in the helm chart command)

Readiness failing - 'code_style' errors for /auth/login

The logs for cpanel are flooded with these errors:

2018-09-13 10:45:32,267 django.template DEBUG Exception while resolving variable 'code_style' in template 'rest_framework/login.html'.
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/django/template/base.py", line 835, in _resolve_lookup
    current = current[bit]
  File "/usr/lib/python3.6/site-packages/django/template/context.py", line 83, in __getitem__
    raise KeyError(key)
KeyError: 'code_style'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/django/template/base.py", line 841, in _resolve_lookup
    if isinstance(current, BaseContext) and getattr(type(current), bit):
AttributeError: type object 'RequestContext' has no attribute 'code_style'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/django/template/base.py", line 849, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'code_style'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/django/template/base.py", line 856, in _resolve_lookup
    (bit, current))  # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [code_style] in [{'True': True, 'False': False, 'None': None}, {'csrf_token': <SimpleLazyObject: <function csrf.<locals>._get_val at 0x7fd937388488>>, 'user': <SimpleLazyObject: <function AuthenticationMiddleware.process_request.<locals>.<lambda> at 0x7fd9373f9158>>, 'perms': <django.contrib.auth.context_processors.PermWrapper object at 0x7fd93723c668>, 'STATIC_URL': '/static/', 'TIME_ZONE': 'UTC'}, {}, {'form': <AuthenticationForm bound=False, valid=Unknown, fields=(username;password)>, 'view': <django.contrib.auth.views.LoginView object at 0x7fd93722da20>, 'next': '', 'site': <django.contrib.sites.requests.RequestSite object at 0x7fd93723cac8>, 'site_name': '100.122.14.82:8000'}, {'block': <Block Node: head. Contents: [<TextNode: '\n\n      '>, <Block Node: meta. Contents: [<TextNode: '\n        <meta http-equiv'>]>, <TextNode: '\n\n      <title>'>, <Block Node: title. Contents: [<IfNode>, <TextNode: 'Django REST framework'>]>, <TextNode: '</title>\n\n      '>, <Block Node: style. Contents: [<TextNode: '\n        '>, <Block Node: bootstrap_theme. Contents: [<TextNode: '\n          <link rel="sty'>, <django.templatetags.static.StaticNode object at 0x7fd9372bbda0>, <TextNode: '"/>\n          <link rel="'>, <django.templatetags.static.StaticNode object at 0x7fd9372bbe48>, <TextNode: '"/>\n        '>]>, <TextNode: '\n\n        <link rel="styl'>, <django.templatetags.static.StaticNode object at 0x7fd9372bbeb8>, <TextNode: '"/>\n        <link rel="st'>, <django.templatetags.static.StaticNode object at 0x7fd9372bbf60>, <TextNode: '"/>\n        '>, <IfNode>, <TextNode: '\n      '>]>, <TextNode: '\n\n    '>]>}, {'block': <Block Node: style. Contents: [<TextNode: '\n        '>, <Block Node: bootstrap_theme. Contents: [<TextNode: '\n          <link rel="sty'>, <django.templatetags.static.StaticNode object at 0x7fd9372bbda0>, <TextNode: '"/>\n          <link rel="'>, <django.templatetags.static.StaticNode object at 0x7fd9372bbe48>, <TextNode: '"/>\n        '>]>, <TextNode: '\n\n        <link rel="styl'>, <django.templatetags.static.StaticNode object at 0x7fd9372bbeb8>, <TextNode: '"/>\n        <link rel="st'>, <django.templatetags.static.StaticNode object at 0x7fd9372bbf60>, <TextNode: '"/>\n        '>, <IfNode>, <TextNode: '\n      '>]>}]

This occurs every 5 seconds, suggesting the readiness probe, which is configured:

    Readiness:  http-get http://:http/auth/login delay=5s timeout=1s period=5s #success=1 #failure=3

And sure enough, the readiness is failing:

Events:
  Type     Reason     Age                From                                                   Message
  ----     ------     ----               ----                                                   -------
  Warning  Unhealthy  58m (x20 over 1h)  kubelet, ip-192-168-14-128.eu-west-1.compute.internal  Readiness probe failed: Get http://100.101.194.119:8000/auth/login: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

Cannot revoke access for users with no IAM role

When you try to revoke a user's access to a bucket when the user no longer has an IAM role, it results in a 'sorry, there is a problem with the service error'.

Also cannot delete apps when a user with no IAM policy is on the access list.

Dependabot cannot be automatically upgraded to GitHub-native security updates

Dependabot Preview will be shut down on August 3rd, 2021.

This repository has been configured to only receive security updates from Dependabot Preview; however, the GitHub-native version of Dependabot does not provide security updates through a configuration file. If you wish to keep receiving security updates, please enable them via your repository's settings.

Once you have enabled Dependabot security updates, you can remove Dependabot Preview from your organization or personal account and your migration is complete.

Our login rules for passwordless users expect `nickname` field

json={"email": email, "email_verified": email_verified, **kwargs},

When we create a user, most of the time it seems that auth0 creates a nickname on the auth0 user object using the first part of their email address. This doesn't happen in a small minority of cases (<5%). To avoid this breaking for those unfortunate users we should explicitly set nickname when creating a user.
Related to:
ministryofjustice/analytics-platform#98

Path-specific access is not removed from IAM policy

Steps to reproduce

  1. A user is granted access to /folder_1/* within a bucket
  2. The user has their access to /folder_1/* removed but they are granted access to /folder_2/*

The user will still have access to /folder_1/*, that is, user IAM policies are not updated when path-specific access is modified.

Path-specific access is not applied correctly

When a user is given path-specific access to a folder, say /folder_1/* as per the user guidance, their IAM policy will provide access to arn:aws:s3:::bucket/folder_1/*/*.

The user should have access to arn:aws:s3:::bucket/folder_1/*.

Data warehouse UI to do

Data warehouse to do:

Data warehouse bucket details page:

  • Typeahead that searches and shows the user name and the github name in branch i.e. Robin Linacre (RobinL)

  • Filter out nulls and jenkins from the list

Copy

  • Convert 'make user admin of this data source' to 'Grant access to this data to other users'. This only shows if you are an admin. Three options to select from:

    • Read access (default option)
    • Read write access
    • Make admin (if this is selected, a prompt shows 'Making user admin will allow them to confer access rights on additional users')
  • Change 'users with admin access' to 'Data access group'

Main /data_warehouse page

  • On the /warehouse_data, need a button that clicks through to AWS. "View data in AWS"

  • Delete 'delete warehouse data source' button in /warehouse_data - this should be available in the data source page, but not in the main listing

Question mark popuops by the headers of the table in /warehouse_data

  • Name: "The name of the bucket in AWS"
  • "User has admin access and :user has read write". Convert to "Your access level". Question mark next to your access level, with a popup that explains what the access levels mean

Create data source page

Main header: "Create secure data storage folder"

Subheader text: "Create a new folder to store data, with an associated data access group"

"Folder name" rather than "warehoue data source bucket name"

Exception viewing app when it's not deployed

If you create an app in controlpanel and view it in controlpanel before the app has been deployed (by Concourse) then you get an exception:
https://sentry.service.dsd.io/mojds/control-panel-api/issues/36471/

According to the guidance this is the correct order: https://moj-analytical-services.github.io/platform_user_guidance/deploying-an-r-shiny-app.html#basic-deployment but whatever the order we should probably fail better.

I experienced this on https://github.com/moj-analytical-services/sdt-email
https://controlpanel.services.alpha.mojanalytics.xyz/webapps/125/ "Sorry, there is a problem with the service"
until it was deployed.

--
BTW there seems a related but separate error for the same thing in the old cpanel:
https://controlpanel.services.alpha.mojanalytics.xyz/webapps/125/ "Sorry, there is a problem with the service"
https://sentry.service.dsd.io/mojds/control-panel-frontend/issues/34769/

Allow control panel users to view objects in versioned S3 buckets

👻 Brief Description

Current users cannot view items in S3 buckets that have versioning on.

🐕 Steps To Reproduce

Steps to reproduce the behaviour:

  1. Login to the console and navigate to S3 as a alpha_user_*
  2. Any versioned bucket
  3. The error below appears

🚓 Expected behaviour

Users should be able to view and download files

➕ Additional context

Annotation 2020-11-10 103050.png

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.