From 0a8c795f563ebbd140b3216f87528046f51c69cf Mon Sep 17 00:00:00 2001 From: paulobressan Date: Mon, 1 Jul 2024 16:54:26 -0300 Subject: [PATCH 01/14] feat(adrs): decisions meeting 001 --- adrs/001-payment-gateway-legacy-org.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 adrs/001-payment-gateway-legacy-org.md diff --git a/adrs/001-payment-gateway-legacy-org.md b/adrs/001-payment-gateway-legacy-org.md new file mode 100644 index 0000000..0290092 --- /dev/null +++ b/adrs/001-payment-gateway-legacy-org.md @@ -0,0 +1,11 @@ +# Payment Gateway and Legacy Organization + +## Context + +When the user creates a new account, an organization and project are created by default. An integration is made with Strip to create a customer where it will be related to the organization. But the organization is not necessary anymore and each project can have a Strip. + +## Decision + +The organization will be degraded but the fabric will have support for it in legacy driven just for compatibility. + +Strip integration will happen just when the user wants to upgrade the plan(tier), so the user will be redirected to a screen to set the payment and the strip will be linked to the project. In fabric, the Strip integration will be into the payment driven where in the future new payment methods can be offered. From d589686420600cc9b15f8d50dafe71609db1cf1f Mon Sep 17 00:00:00 2001 From: paulobressan Date: Mon, 1 Jul 2024 17:00:45 -0300 Subject: [PATCH 02/14] chore: added bullet points --- adrs/001-payment-gateway-legacy-org.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/adrs/001-payment-gateway-legacy-org.md b/adrs/001-payment-gateway-legacy-org.md index 0290092..7af558f 100644 --- a/adrs/001-payment-gateway-legacy-org.md +++ b/adrs/001-payment-gateway-legacy-org.md @@ -6,6 +6,8 @@ When the user creates a new account, an organization and project are created by ## Decision -The organization will be degraded but the fabric will have support for it in legacy driven just for compatibility. +- Organization + The organization will be degraded but the fabric will have support for it in legacy driven just for compatibility. -Strip integration will happen just when the user wants to upgrade the plan(tier), so the user will be redirected to a screen to set the payment and the strip will be linked to the project. In fabric, the Strip integration will be into the payment driven where in the future new payment methods can be offered. +- Strip Payments + Strip integration will happen just when the user wants to upgrade the plan(tier), so the user will be redirected to a screen to set the payment and the strip will be linked to the project. In fabric, the Strip integration will be into the payment driven where in the future new payment methods can be offered. From 5d22ac79945afe708f5a6c5a976299827985021f Mon Sep 17 00:00:00 2001 From: paulobressan Date: Wed, 3 Jul 2024 10:54:43 -0300 Subject: [PATCH 03/14] chore(001): updated context text --- adrs/001-payment-gateway-legacy-org.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adrs/001-payment-gateway-legacy-org.md b/adrs/001-payment-gateway-legacy-org.md index 7af558f..e286d59 100644 --- a/adrs/001-payment-gateway-legacy-org.md +++ b/adrs/001-payment-gateway-legacy-org.md @@ -2,12 +2,14 @@ ## Context -When the user creates a new account, an organization and project are created by default. An integration is made with Strip to create a customer where it will be related to the organization. But the organization is not necessary anymore and each project can have a Strip. +Currently, when a user creates a new account, an organization and a project are created by default. The organization will be used to link all projects and payment settings. ## Decision - Organization + The organization will be degraded but the fabric will have support for it in legacy driven just for compatibility. - Strip Payments + Strip integration will happen just when the user wants to upgrade the plan(tier), so the user will be redirected to a screen to set the payment and the strip will be linked to the project. In fabric, the Strip integration will be into the payment driven where in the future new payment methods can be offered. From cba04cde380227f49d0ca8add2a01dce2389f14d Mon Sep 17 00:00:00 2001 From: paulobressan Date: Wed, 3 Jul 2024 11:03:55 -0300 Subject: [PATCH 04/14] chore(001): updated name text --- ...ent-gateway-legacy-org.md => 001-organization-payments.md} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename adrs/{001-payment-gateway-legacy-org.md => 001-organization-payments.md} (91%) diff --git a/adrs/001-payment-gateway-legacy-org.md b/adrs/001-organization-payments.md similarity index 91% rename from adrs/001-payment-gateway-legacy-org.md rename to adrs/001-organization-payments.md index e286d59..595c891 100644 --- a/adrs/001-payment-gateway-legacy-org.md +++ b/adrs/001-organization-payments.md @@ -1,4 +1,4 @@ -# Payment Gateway and Legacy Organization +# Organization and Payments ## Context @@ -10,6 +10,6 @@ Currently, when a user creates a new account, an organization and a project are The organization will be degraded but the fabric will have support for it in legacy driven just for compatibility. -- Strip Payments +- Payments Strip integration will happen just when the user wants to upgrade the plan(tier), so the user will be redirected to a screen to set the payment and the strip will be linked to the project. In fabric, the Strip integration will be into the payment driven where in the future new payment methods can be offered. From 6f41edd995b021f3f925c0a4622c8ad022f4d05a Mon Sep 17 00:00:00 2001 From: paulobressan Date: Wed, 3 Jul 2024 11:09:38 -0300 Subject: [PATCH 05/14] feat(002): added adr for meeting 002 --- adrs/001-organization-payments.md | 4 +-- adrs/002-stripe.md | 49 +++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 adrs/002-stripe.md diff --git a/adrs/001-organization-payments.md b/adrs/001-organization-payments.md index 595c891..1cf0758 100644 --- a/adrs/001-organization-payments.md +++ b/adrs/001-organization-payments.md @@ -8,8 +8,8 @@ Currently, when a user creates a new account, an organization and a project are - Organization - The organization will be degraded but the fabric will have support for it in legacy driven just for compatibility. +The organization will be degraded but the fabric will have support for it in legacy driven just for compatibility. - Payments - Strip integration will happen just when the user wants to upgrade the plan(tier), so the user will be redirected to a screen to set the payment and the strip will be linked to the project. In fabric, the Strip integration will be into the payment driven where in the future new payment methods can be offered. +Strip integration will happen just when the user wants to upgrade the plan(tier), so the user will be redirected to a screen to set the payment and the strip will be linked to the project. In fabric, the Strip integration will be into the payment driven where in the future new payment methods can be offered. diff --git a/adrs/002-stripe.md b/adrs/002-stripe.md new file mode 100644 index 0000000..8b70624 --- /dev/null +++ b/adrs/002-stripe.md @@ -0,0 +1,49 @@ +# Stripe + +## Context + +The way that the user can configure the payment method. + +## Decision + +- Payment Setup + +Payment is associated to a project. One payment method per project. Stripe Intent will be defined in the user interface + +- Flows + +Sequence diagrams need to be created for each flow. + +``` + ACCOUNT +- A new project will be created by default +* account creation + +PROJECT +- A default Stripe customer is created when the user create a project by default +* project creation +* project deletion +* project API key creation +* project API key deletion + +PORT +* port creation +* port deletion +* port usage and details + +TIERS +* tiers upgrade +* tiers downgrade + +PAYMENTS +- Payment is associated to a project +- One payment method per project +- Stripe Intent will be defined in the user interface +* payment method updating +* payment method deletion +* payment transactions Webhook (stripe/ada) + +USERS +* users invitation to a project +* users deletion from a project +``` From a66cc3594cc3490de52a698851b11a9013f94974 Mon Sep 17 00:00:00 2001 From: paulobressan Date: Mon, 8 Jul 2024 10:29:13 -0300 Subject: [PATCH 06/14] feat: adr meeting 003 usage and billing --- adrs/003-usage-billing.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 adrs/003-usage-billing.md diff --git a/adrs/003-usage-billing.md b/adrs/003-usage-billing.md new file mode 100644 index 0000000..ce7bc26 --- /dev/null +++ b/adrs/003-usage-billing.md @@ -0,0 +1,31 @@ +# Usage and billing + +## Context + +Each cluster needs to send the metrics of usage of each user. Then, the main cluster will aggregate the data and make the invoice, integrating it with the payment gateway. + +## Decision + +Each cluster will be running a usage driver to collect the usage data and send them as an event to the main cluster through the queue. In the main cluster, an event driver will be running and it will capture the event and persist in the cache db. The invoice will be triggered by another driver(billing) and it will be executed once a month, the payment gateway needs to be called to generate the invoice. + +- Usage + +That needs to be executed in each cluster and triggered once an hour, integrating with Prometheus to collect metrics of data usage and send an event to the queue. + +- Billing + +The billing will be executed once a month in the main cluster, getting user usage in the cache of all clusters, and integrating with a payment gateway to make the invoice. + +## Rules + +- Usage driver(daemon) + - each cluster will run this driver and send report usage on Kafka periodically + - the cache driver will receive the event and persist the usage by cluster + +- Billing driver(management/cron) + - it will execute one time per month to send an invoice + - it will use the usage in the cache to calculate the amount to billing + - Fetch all projects + - Fetch all ports of a project + - Fetch usage by port + - Integrate with payment gateway(send invoice) From 3c3751367ebf6100b81667492fa2493bd6b50c61 Mon Sep 17 00:00:00 2001 From: paulobressan Date: Mon, 8 Jul 2024 10:31:59 -0300 Subject: [PATCH 07/14] feat: adr meeting 003 usage and billing --- adrs/003-usage-billing.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/adrs/003-usage-billing.md b/adrs/003-usage-billing.md index ce7bc26..2b1451b 100644 --- a/adrs/003-usage-billing.md +++ b/adrs/003-usage-billing.md @@ -9,12 +9,10 @@ Each cluster needs to send the metrics of usage of each user. Then, the main clu Each cluster will be running a usage driver to collect the usage data and send them as an event to the main cluster through the queue. In the main cluster, an event driver will be running and it will capture the event and persist in the cache db. The invoice will be triggered by another driver(billing) and it will be executed once a month, the payment gateway needs to be called to generate the invoice. - Usage - -That needs to be executed in each cluster and triggered once an hour, integrating with Prometheus to collect metrics of data usage and send an event to the queue. + That needs to be executed in each cluster and triggered once an hour, integrating with Prometheus to collect metrics of data usage and send an event to the queue. - Billing - -The billing will be executed once a month in the main cluster, getting user usage in the cache of all clusters, and integrating with a payment gateway to make the invoice. + The billing will be executed once a month in the main cluster, getting user usage in the cache of all clusters, and integrating with a payment gateway to make the invoice. ## Rules From 596a87cbc752a460640f9e31747302c3a1095ba7 Mon Sep 17 00:00:00 2001 From: paulobressan Date: Mon, 8 Jul 2024 10:33:15 -0300 Subject: [PATCH 08/14] feat: adr meeting 003 usage and billing --- adrs/003-usage-billing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adrs/003-usage-billing.md b/adrs/003-usage-billing.md index 2b1451b..d3336af 100644 --- a/adrs/003-usage-billing.md +++ b/adrs/003-usage-billing.md @@ -8,10 +8,10 @@ Each cluster needs to send the metrics of usage of each user. Then, the main clu Each cluster will be running a usage driver to collect the usage data and send them as an event to the main cluster through the queue. In the main cluster, an event driver will be running and it will capture the event and persist in the cache db. The invoice will be triggered by another driver(billing) and it will be executed once a month, the payment gateway needs to be called to generate the invoice. -- Usage +- Usage That needs to be executed in each cluster and triggered once an hour, integrating with Prometheus to collect metrics of data usage and send an event to the queue. -- Billing +- Billing The billing will be executed once a month in the main cluster, getting user usage in the cache of all clusters, and integrating with a payment gateway to make the invoice. ## Rules From 58ba964e19eb1960362d3003a48e6685b3d4071b Mon Sep 17 00:00:00 2001 From: paulobressan Date: Mon, 8 Jul 2024 10:55:28 -0300 Subject: [PATCH 09/14] feat: adr meeting 004 users --- adrs/004-users.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 adrs/004-users.md diff --git a/adrs/004-users.md b/adrs/004-users.md new file mode 100644 index 0000000..9b461b6 --- /dev/null +++ b/adrs/004-users.md @@ -0,0 +1,30 @@ +# Users + +## Context + +A new user needs to access demeter platform. + +## Decision + +The oauth platform will handle the authentication. + +- Creation + The user needs to log in using the oauth. The oauth token will be sent to the user creation RPC and the user domain will validate the user data, integrating with oauth to get the user profile data and send an event to the queue creating the account. + +- Invite + When a user invites another user to a `project`, a temporary token is created and sent to the new user's email. The new user will click on the link and if there's not an account, the user domain will create the account following the user creation flow. Then, an event is sent to link the new user to that project. + +## Rules + +- Users creation +- Users invitation to a project + - Invitation needs to be accepted + - Generation random token + - Integrate with AWS to send the email(Email driven) + - Send an invitation event + - Event driver will save the cache invitation event +- Users accept invite + - Validate the token getting from the cache + - Validate if the user exists + - Send an event to link the user to the project +- Users deletion from a project From 27fed4c56ca6563336839a9e4b1c82eb13cef06b Mon Sep 17 00:00:00 2001 From: paulobressan Date: Tue, 9 Jul 2024 16:18:22 -0300 Subject: [PATCH 10/14] chore: updated context meeting 001 --- adrs/001-organization-payments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adrs/001-organization-payments.md b/adrs/001-organization-payments.md index 1cf0758..1b24aef 100644 --- a/adrs/001-organization-payments.md +++ b/adrs/001-organization-payments.md @@ -2,7 +2,7 @@ ## Context -Currently, when a user creates a new account, an organization and a project are created by default. The organization will be used to link all projects and payment settings. +In the current Demeter platform, it is necessary to create an organization to link projects and users. ## Decision From e62da1fc7ebd535962bee62c32f5a8f6a49cc810 Mon Sep 17 00:00:00 2001 From: Paulo Bressan Date: Wed, 10 Jul 2024 14:14:51 -0300 Subject: [PATCH 11/14] Update adrs/001-organization-payments.md Co-authored-by: Felipe Gonzalez --- adrs/001-organization-payments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adrs/001-organization-payments.md b/adrs/001-organization-payments.md index 1b24aef..1d9a648 100644 --- a/adrs/001-organization-payments.md +++ b/adrs/001-organization-payments.md @@ -8,7 +8,7 @@ In the current Demeter platform, it is necessary to create an organization to li - Organization -The organization will be degraded but the fabric will have support for it in legacy driven just for compatibility. +The organization will be deprecated but the fabric will have support for it in legacy driven just for compatibility. - Payments From 4d494c37ef676289fc9854d8977853e6396e528f Mon Sep 17 00:00:00 2001 From: Paulo Bressan Date: Wed, 10 Jul 2024 14:15:15 -0300 Subject: [PATCH 12/14] Update adrs/001-organization-payments.md Co-authored-by: Felipe Gonzalez --- adrs/001-organization-payments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adrs/001-organization-payments.md b/adrs/001-organization-payments.md index 1d9a648..df3a50a 100644 --- a/adrs/001-organization-payments.md +++ b/adrs/001-organization-payments.md @@ -12,4 +12,4 @@ The organization will be deprecated but the fabric will have support for it in l - Payments -Strip integration will happen just when the user wants to upgrade the plan(tier), so the user will be redirected to a screen to set the payment and the strip will be linked to the project. In fabric, the Strip integration will be into the payment driven where in the future new payment methods can be offered. +Stripe integration will happen just when the user wants to upgrade the plan(tier), so the user will be redirected to a screen to set the payment and the stripe will be linked to the project. In fabric, the Stripe integration will be into the payment driven where in the future new payment methods can be offered. From 52e8d1a24651d75b53dc8061f09bd809fd0cbece Mon Sep 17 00:00:00 2001 From: Paulo Bressan Date: Wed, 10 Jul 2024 14:15:34 -0300 Subject: [PATCH 13/14] Update adrs/003-usage-billing.md Co-authored-by: Felipe Gonzalez --- adrs/003-usage-billing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adrs/003-usage-billing.md b/adrs/003-usage-billing.md index d3336af..4e279da 100644 --- a/adrs/003-usage-billing.md +++ b/adrs/003-usage-billing.md @@ -2,7 +2,7 @@ ## Context -Each cluster needs to send the metrics of usage of each user. Then, the main cluster will aggregate the data and make the invoice, integrating it with the payment gateway. +Each cluster needs to send the usage metrics of each user. Then, the main cluster will aggregate the data and make the invoice, integrating it with the payment gateway. ## Decision From 1ac3a3a8bb368e0fe68fda3611295ac6eb715a56 Mon Sep 17 00:00:00 2001 From: Paulo Bressan Date: Wed, 10 Jul 2024 14:15:49 -0300 Subject: [PATCH 14/14] Update adrs/003-usage-billing.md Co-authored-by: Felipe Gonzalez --- adrs/003-usage-billing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adrs/003-usage-billing.md b/adrs/003-usage-billing.md index 4e279da..10fc33b 100644 --- a/adrs/003-usage-billing.md +++ b/adrs/003-usage-billing.md @@ -9,7 +9,7 @@ Each cluster needs to send the usage metrics of each user. Then, the main cluste Each cluster will be running a usage driver to collect the usage data and send them as an event to the main cluster through the queue. In the main cluster, an event driver will be running and it will capture the event and persist in the cache db. The invoice will be triggered by another driver(billing) and it will be executed once a month, the payment gateway needs to be called to generate the invoice. - Usage - That needs to be executed in each cluster and triggered once an hour, integrating with Prometheus to collect metrics of data usage and send an event to the queue. + This needs to be executed in each cluster and triggered once an hour, integrating with Prometheus to collect metrics of data usage and send an event to the queue. - Billing The billing will be executed once a month in the main cluster, getting user usage in the cache of all clusters, and integrating with a payment gateway to make the invoice.