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

[Umbrella Ticket] PATH User Database #11

Open
10 tasks
Olshansk opened this issue Sep 6, 2024 · 6 comments
Open
10 tasks

[Umbrella Ticket] PATH User Database #11

Olshansk opened this issue Sep 6, 2024 · 6 comments
Assignees
Labels
billing Payments related
Milestone

Comments

@Olshansk
Copy link
Contributor

Olshansk commented Sep 6, 2024

Objective

Build the foundation for tracking users accessing the portal.

Origin Document

Postgres driver
Proposed Database Structure

Goals

  • Associated a relay with a user ID
  • Enable other gateways to build features associated with a specific user
  • Enable downstream efforts related to billing
  • Enable downstream efforts related to rate limiting
  • Enable downstream efforts for user-specific features in the future (whitelisting, user agents, settings, etc...)

Deliverables

  • Implementation that ties a relay to a UserId including
    • Connecting to, fetching and caching user data from a Postgres database.
    • Relating a service request to this user data via a UserApp ID (eg from .../v1/{USER_APP_ID} in the URL).
  • User-specific rate limiting (dependent on [Umbrella Ticket] Rate Limiting - Capacity & Throughput Rate Limiting #10 as a parallel requirement)
  • Updated tooling and documentation to startup a postgres DB alongside the gateway
  • 1-2 pager w/ docs to be turned in 🦖 docs in the future

Non-goals / Non-deliverables

  • Out-of-the box stripe integration or hooks
  • Implementing downstream user settings (whitelisting, user agents, settings, etc...)
  • Integrating with crypto payments

General deliverables

  • Comments: Add/update TODOs and comments alongside the source code so it is easier to follow.
  • Testing: Add new tests (unit and/or E2E) to the test suite.
  • Makefile: Add new targets to the Makefile to make the new functionality easier to use.
  • Documentation: Update architectural or development READMEs; use mermaid diagrams where appropriate.

Creator: @Olshansk
Co-Owners: @commoddity

@Olshansk Olshansk added the billing Payments related label Sep 6, 2024
@Olshansk Olshansk added this to the Path MVP milestone Sep 6, 2024
@commoddity commoddity changed the title [Umbrealla Ticket] PATH User Database [Umbrella Ticket] PATH User Database Sep 6, 2024
@fredteumer
Copy link
Contributor

this feels like it's being conflated from a user db vs billing db situation. The purpose of the database is to codify the business logic of the application for the purposes of user management, plan management, services, etc.

Billing, while important, inherits a small subset of this data and is combined with the metering of the application to integrate with Stripe.

@commoddity
Copy link
Contributor

commoddity commented Sep 6, 2024

this feels like it's being conflated from a user db vs billing db situation. The purpose of the database is to codify the business logic of the application for the purposes of user management, plan management, services, etc.

Billing, while important, inherits a small subset of this data and is combined with the metering of the application to integrate with Stripe.

To be clear, I think the extent to which this issue needs to interact with billing is simply providing a UserApp ID we can relate to a service request to identify who sent the service request and, thus, who gets billed for it.

IMO getting to the point of having two key functionalities should be the focus of this issue:

  1. Connecting to, fetching and caching user data from a Postgres database.
  2. Relating a service request to this user data via a UserApp ID (eg from .../v1/{USER_APP_ID} in the URL).

This keeps the scope limited while still providing the prerequisite functionality to implement #10

@Olshansk I know we just discussed this a few mins ago but I tend to agree that adding Out-of-the box stripe integration or hooks may be getting a bit ahead of ourselves for this iteration.

@fredteumer
Copy link
Contributor

The above makes more sense for the scope of this ticket. We can expand upon it to open a metering/payment rail integration with stripe as a future feature and mark other possible payments integrations as future issues.

@Olshansk
Copy link
Contributor Author

Olshansk commented Sep 6, 2024

@commoddity @fredteumer PTAL at the updated goals, deliverables and non-goals and 👍 if it looks good to you.

I'm also putting together #13 to capture the billing work in a follow-up ticket.

@commoddity commoddity linked a pull request Sep 9, 2024 that will close this issue
@commoddity
Copy link
Contributor

@adshmh @Olshansk Proposal for DB driver ready for initial review: #15

@commoddity commoddity removed a link to a pull request Sep 9, 2024
commoddity added a commit that referenced this issue Sep 19, 2024
Related to #11

PR to add a Postgres database driver using SQLC to generate Go code from
SQL files:
https://sqlc.dev/

This is the first prerequisite to allow associating a service request
with a user for the purposes of metering, billing, rate limiting, user
settings, etc.

This PR adds the following:
- `db/driver` package containing Postgres driver
- `db` package containing local cache of user data
- `user` package containing the `GatewayEndpoint` struct

---------

Signed-off-by: Pascal van Leeuwen <[email protected]>
Signed-off-by: commoddity <[email protected]>
Co-authored-by: Daniel Olshansky <[email protected]>
@commoddity
Copy link
Contributor

Draft PR for implementing Envoy Auth Plugin Proposal here:
#28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
billing Payments related
Projects
Status: 🔖 Ready
Development

No branches or pull requests

3 participants