#68 Create a GraphQL API for Bodhi.
Opened a month ago by cverna. Modified 4 days ago

This is a proposed project for Outreachy. Note that once this ticket is
approved you will have to register as a mentor on the Outreachy page
and enter this information again. Many of these questions are based on
the application on the Outreachy website.

  • One-line name
    -- Create a GraphQL API for Bodhi.
  • Longer description of project
    -- The current implementation of Bodhi REST API is far from being ideal. The REST endpoints are not following CRUD (Create, Read, Update, Delete) and there are doing a lot of magic making it difficult to use by someone not familiar with the Bodhi code base. The Goal of this project is to give Bodhi a /graphql endpoint which would allow users to use grapqhl to query bodhi resources.
  • License of the project
    -- GNU General Public License v2.0
  • Longevity (How long has the team accepted contributions)
    -- Bodhi was started around 2008.
  • Community size
    -- Bodhi is used by the Fedora Community, the project is maintained by the Infrastructure team which has at least 3-4 people contributing regularly to the project.
  • How will this project benefit Fedora
    -- This will make it easier to for community member to interact with Bodhi APIs. This will allow people to be able to experiment and create their own tools using these APIs. This will be also an opportunity to evaluate GraphQL for the Fedora Infrastructure with the possibility to expand the usage to other services.
  • Sample plan of work for the 12 week internship. What are milestones the
    intern should be hitting? This doesn't need to be incredibly detailed and
    can change later but there needs to be a general breakdown of tasks.
    -- Add a simple /graphql endpoint which only returns some "hello world" text.
    -- Allow to query releases using the /graphql endpoint.
    -- Allow to query updates using the /graphql endpoint.
    -- Allow to query builds using the /graphql endpoint.
    -- Allow to query overrides using the /graphql endpoint.
    -- Allow to query packages using the /graphql endpoint.
    -- Allow to query users using the /graphql endpoint.
    -- Allow to query comments using the /graphql endpoint.
    -- Enable Authorization on the /graphql endpoint so that we can restrict
    creation of resources.
    -- Allow to create releases using the /graphql endpoint.
    -- Allow to create updates using the /graphql endpoint.
    -- Allow to create builds using the /graphql endpoint.
    -- Allow to create overrides using the /graphql endpoint.
    -- Allow to create packages using the /graphql endpoint.
    -- Allow to create users using the /graphql endpoint.
    -- Allow to create comments using the /graphql endpoint.

  • Benefits to intern (What will the intern get out of this internship)
    -- Develop and deploy a GraphQL API to a legacy application.
    -- Learn about database modeling and how to create an API from that.
    -- Contribute to a project that is used in production and be exposed to Continuous Integration and Continuous Deployment practices.

  • Project website
    https://bodhi.fedoraproject.org/
  • Project repo
    https://github.com/fedora-infra/bodhi
  • Where can an applicant find application tasks?
    https://github.com/fedora-infra/bodhi/issues
  • IRC
    -- #bodhi on IRC freenode
  • Skills required including what level and if they are optional
    (e.g. Python Intermediate, CSS beginner, we'll teach you Puppet)
    -- Python some experience with web framework (Pyramid, Flask, Django)
    -- Python some experience with SQLAlchemy
    -- GraphQL some experience with Graphene
  • Outreachy applicants are required to make a contribution as part of the
    application. What is the process for making a contribution?
    https://bodhi.fedoraproject.org/docs/developer/index.html#contribution-guidelines

Questions from the top level Outreachy Program for the mentor application:
- How long have you been contributing to the community:
-- 4 years
- What is your current role
-- Senior Software Engineer
- Have you mentored for a three-month internship program before
-- I have co-mentored a Red Hat intern.
- Have you read the mentor page and understand the process of being a mentor
-- Yes
- Are you available for 5 hours a week during the internship period
-- Yes
- Are you available for 5-10 hours a week during the application period
-- Yes
- Are you aware you need to sign a mentor contract
-- Yes

@scoady is also interested to be mentoring this project with me


cc: @riecatnor – looks like she needs admin rights on this repo from @bex.

Conceptually, I think this is an excellent proposal even if my vote doesn't count. :grin: My only advice for now would be to start thinking of several bite-sized contributions for applicants to work on during the contribution period.

For example, in Fedora Happiness Packets, we tried a few things that were really successful and reduced the workload on mentors:

Just some ideas to share. It definitely helps to think about these things well in advance before the contribution window opens.

cc: @riecatnor – looks like she needs admin rights on this repo from @bex.
Conceptually, I think this is an excellent proposal even if my vote doesn't count. 😁 My only advice for now would be to start thinking of several bite-sized contributions for applicants to work on during the contribution period.
For example, in Fedora Happiness Packets, we tried a few things that were really successful and reduced the workload on mentors:

Asked applicants to introduce themselves to community
Created general-purpose issue instructing applicants to set up a development environment (this was really great because applicants started to help each other and this was a factor I considered for selecting candidates)
Created general-purpose issue instructing applicants to set up fedora-messaging and publish a test message locally

Thanks for the pointers, I think these are great getting started tasks :-). I think I ll get some inspiration from them and create something similar for bodhi.

Just some ideas to share. It definitely helps to think about these things well in advance before the contribution window opens.

+1 thanks for the sharing these ideas

Can you write an outline of what you hope to see the intern accomplish each week and also highlight what would be applicant tasks?

Can you write an outline of what you hope to see the intern accomplish each week and also highlight what would be applicant tasks?

So I have 2 applicant tasks, inspired by @jflory7
https://github.com/fedora-infra/bodhi/issues/3922
https://github.com/fedora-infra/bodhi/issues/3923

I have also tag a few other possible tasks for applicant that would easily go through the first 2 tasks
https://github.com/fedora-infra/bodhi/issues?q=is%3Aissue+is%3Aopen+label%3Aoutreachy

For the outline

Week 1:
Update the development environment with the python graphene library
Add a new graphql service which routes to /graphql and returns a simple string "Hello World"
Write tests for that service.

Week 2:
Integrate graphene to the graphql service. The /graphql endpoints should now accept a graphql query and return the same simple string "Hello World".
Update the tests

Week 3 and 4:
Update environment and dependencies to introduce graphene-sqlalchemy.
Use the graphene sqlalchemy library to generate the graphql schema for the Release class.
Add a graphql query handler for the Releases.

Week 5:
Work and Desing the graphql schema. Analyse the dependencies between the different object and how this will be reflected in the graphql tree.
I don't expect much coding during this week, this should be used as a foundation for the following work.

Week 6 - 12:
Implement the graphql schema. Focusing first on the queries since this does not require any authentication.
Users should be able to query for releases, updates, builds, overrides, packages, users, comments.
If times allow then we can look at the implementation of the mutation (creating, updating resources). The first step to this is to have authentication and authorization in place.

@scoady what do you think about the applicant tasks ? Should we have something related to graphql there ? Also what do you think about the weeks outline ?

General feedbacks are more than welcome :smile:

@cverna thanks very much for putting that together.

I think its great and covers everything. I was going to suggest some time to try out GraphQL independently of Bodhi in the applicant tasks. I notice though that in the pre-requisites you mention they should have some GraphQL/graphene experience so maybe this isn't necessary. If you do want to include it, something like https://www.howtographql.com/ or https://trygql.com/ might be good. If you think this is a good idea, I can create the task. If those are a little too broad maybe something like a basic standalone graphql server first before trying to create a graphql service in bodhi.

@cverna thanks very much for putting that together.
I think its great and covers everything. I was going to suggest some time to try out GraphQL independently of Bodhi in the applicant tasks. I notice though that in the pre-requisites you mention they should have some GraphQL/graphene experience so maybe this isn't necessary. If you do want to include it, something like https://www.howtographql.com/ or https://trygql.com/ might be good. If you think this is a good idea, I can create the task. If those are a little too broad maybe something like a basic standalone graphql server first before trying to create a graphql service in bodhi.

@scoady I think a generic graphql onboarding task is a good idea, I believe that it would help candidates that just have a small exposure to graphql. Feel free to create the task in bodhi then :)

Hi @cverna, I am now coordinating Outreachy interns with @labbott. We had a chance to review this and it looks good to go. As the mentor please complete Outreachy's Projects form so we can start advertising :)

Laura asked me to remind our mentors as they submit that they need to be available for the entire application process, and the internship (with communication around standard amounts of travel for work, or time off).

Outreachy asks mentors to read and understand the content on the following page:
https://www.outreachy.org/mentor/mentor-faq/#define-a-project

@cverna not sure if you have mentored before for Outreachy and this is all old news or not :) either way, thank you for mentoring for this round!

Login to comment on this ticket.

Metadata