[FastAPI] Home stretch

This issue will keep track of our "final" steps to implementing the basis of aurweb with FastAPI.

Tasks

  • docker: Host-configurable mariadb service - @fluix !200 (merged)
    • We need to provide the Docker host a way to provide an instance of mariadb from the host to the container.
  • docker: Host-configurable git service - @fluix !201 (merged)
    • We need to configure production Docker to bind-mount an external aur.git repository into the container.
  • docker: Host-configurable cgit services - @fluix
    • In production, nginx is externally used as a front-end to the php-fpm and fastapi Docker-contained services. Our cgit services are not accessible by the host, and they're pretty much hard coded to provide two cgit instances with different clone-prefix configurations for PHP and FastAPI (separately). We need to make this configurable by the host so they can plugin to our cgit services via their external nginx.
  • docker: Create bridge service for aurweb-git-auth - @kevr
    • In production, the Docker host wishes to manage SSH authentication for different reasons: server access (1) and AUR ssh/git access (2). For this reason, a local RPC API is needed to allow the host to configure a particular user (example: 'aur') to access aurweb-git-auth run inside of a Docker container, while allowing other users to authenticate as they normally would.
  • fastapi: Rework RPC [1] - @kevr !203 (merged)
    • aurweb/rpc.py
    • aurweb/routers/rpc.py
  • fastapi: Complete RPC [2] - @kevr
    • Note: The v query parameter is now required.
    • Note: We must only support v5.
    • Note: The get-comment-form type has been removed.
    • Use aurweb.packages.search.PackageSearch for type=search.
  • fastapi: Implement /metrics - @kevr
  • fastapi: Rework all auth requirements to depend on credentials
    • Create a new credential_required decorator which can be used in place of auth_required.
    • Add error mappings for credential_required failures (this will additionally require that we supply a way to give credential_required the proper template and context it'll need to render the page which the error should be displayed on.
  • fastapi: Review the aurweb.session.Session model
    • We should modify this to support multiple sessions. A user may login from multiple machines and each machine should have their own session.
  • fastapi: Produce benchmarks of every route using hyperfine or oha.
  • fastapi: Separate packages and pkgbase logic
    • Move pkgbase routes into their own router: aurweb/routers/pkgbase.py
    • Move all non-router callbacks to other aurweb modules. We should keep router files only defining routes, nothing more. This will keep code clean and more organized.
  • fastapi: User.ResetKey should have an expiration (optional)
  • fastapi: Unify all CASCADE related backrefs.
    • For CASCADE to properly work when a child class creates a backref on a parent class, the cascade="all, delete" argument must be supplied. This is done where required at the moment, but should be done in all cases.

After these tasks, we'll need to focus more on testing and fixing any unintended inconsistencies in the project.

Edited by Leonidas Spyropoulos