Skip to content

Commit

Permalink
Merge pull request #138 from holaplex/mpw/analytics-chart-update
Browse files Browse the repository at this point in the history
add schemas to helm chart, update hub-analytics env vars secrets
  • Loading branch information
mpwsh authored Aug 19, 2023
2 parents 626f76a + 35497ca commit fe62343
Show file tree
Hide file tree
Showing 15 changed files with 375 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/hub-analytics/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type: application
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)

version: 0.2.0
version: 0.2.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
33 changes: 33 additions & 0 deletions charts/hub-analytics/schemas/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cubes:
- name: collections
sql_table: public.collections
data_source: default

joins:
- name: projects
sql: "{CUBE}.project_id = {projects}.id"
relationship: many_to_one

dimensions:
- name: id
sql: id
type: string
primary_key: true

- name: project_id
sql: project_id
type: string

- name: blockchain
sql: blockchain
type: string

- name: timestamp
sql: timestamp
type: time

measures:
- name: count
type: count

pre_aggregations:
33 changes: 33 additions & 0 deletions charts/hub-analytics/schemas/credits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cubes:
- name: credits
sql_table: public.credits
data_source: default

joins:
- name: organizations
sql: "{CUBE}.organization_id = {organizations}.id"
relationship: many_to_one

dimensions:
- name: id
sql: id
type: string
primary_key: true

- name: organization_id
sql: organization_id
type: string

- name: timestamp
sql: timestamp
type: time

measures:
- name: count
type: count

- name: amount
sql: amount
type: sum

pre_aggregations:
29 changes: 29 additions & 0 deletions charts/hub-analytics/schemas/customers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
cubes:
- name: customers
sql_table: public.customers
data_source: default

joins:
- name: projects
sql: "{CUBE}.project_id = {projects}.id"
relationship: many_to_one

dimensions:
- name: id
sql: id
type: string
primary_key: true

- name: project_id
sql: project_id
type: string

- name: timestamp
sql: timestamp
type: time

measures:
- name: count
type: count

pre_aggregations:
37 changes: 37 additions & 0 deletions charts/hub-analytics/schemas/mints.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cubes:
- name: mints
sql_table: public.mints
data_source: default

joins:
- name: collections
sql: "{CUBE}.collection_id = {collections}.id"
relationship: many_to_one

- name: projects
sql: "{CUBE}.project_id = {projects}.id"
relationship: many_to_one

dimensions:
- name: id
sql: id
type: string
primary_key: true

- name: collection_id
sql: collection_id
type: string

- name: project_id
sql: project_id
type: string

- name: timestamp
sql: timestamp
type: time

measures:
- name: count
type: count

pre_aggregations:
22 changes: 22 additions & 0 deletions charts/hub-analytics/schemas/organizations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cubes:
- name: organizations
sql_table: public.organizations
data_source: default

joins: []

dimensions:
- name: id
sql: id
type: string
primary_key: true

- name: name
sql: name
type: string

measures:
- name: count
type: count

pre_aggregations:
33 changes: 33 additions & 0 deletions charts/hub-analytics/schemas/projects.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cubes:
- name: projects
sql_table: public.projects
data_source: default

joins:
- name: organizations
sql: "{CUBE}.organization_id = {organizations}.id"
relationship: many_to_one

dimensions:
- name: id
sql: id
type: string
primary_key: true

- name: organization_id
sql: organization_id
type: string

- name: name
sql: name
type: string

- name: timestamp
sql: timestamp
type: time

measures:
- name: count
type: count

pre_aggregations:
35 changes: 35 additions & 0 deletions charts/hub-analytics/schemas/transfers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cubes:
- name: transfers
sql_table: public.transfers
data_source: default

joins:
- name: collections
sql: "{CUBE}.collection_id = {collections}.id"
relationship: many_to_one

- name: projects
sql: "{CUBE}.project_id = {projects}.id"
relationship: many_to_one

dimensions:
- name: id
sql: id
type: string
primary_key: true

- name: collection_id
sql: collection_id
type: string

- name: project_id
sql: project_id
type: string

- name: timestamp
sql: timestamp
type: time

measures:
- name: count
type: count
41 changes: 41 additions & 0 deletions charts/hub-analytics/schemas/wallets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
cubes:
- name: wallets
sql_table: public.wallets
data_source: default

joins:
- name: projects
sql: "{CUBE}.project_id = {projects}.id"
relationship: many_to_one

- name: customers
sql: "{CUBE}.customer_id = {customers}.id"
relationship: many_to_one

dimensions:
- name: id
sql: id
type: string
primary_key: true

- name: project_id
sql: project_id
type: string

- name: customer_id
sql: customer_id
type: string

- name: blockchain
sql: blockchain
type: string

- name: timestamp
sql: timestamp
type: time

measures:
- name: count
type: count

pre_aggregations:
37 changes: 37 additions & 0 deletions charts/hub-analytics/schemas/webhooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cubes:
- name: webhooks
sql_table: public.webhooks
data_source: default

joins:
- name: organizations
sql: "{CUBE}.organization_id = {organizations}.id"
relationship: many_to_one

- name: projects
sql: "{CUBE}.project_id = {projects}.id"
relationship: many_to_one

dimensions:
- name: id
sql: id
type: string
primary_key: true

- name: organization_id
sql: organization_id
type: string

- name: project_id
sql: project_id
type: string

- name: timestamp
sql: timestamp
type: time

measures:
- name: count
type: count

pre_aggregations:
31 changes: 31 additions & 0 deletions charts/hub-analytics/templates/cubeConfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{- if .Values.cube.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: cube-config
data:
cube.js: |
const path = require("path");
const fs = require("fs");
module.exports = {
repositoryFactory: () => ({
dataSchemaFiles: async () => {
const files = await fs.promises.readdir(
path.join(process.cwd(), "schema")
);
return await Promise.all(
files
.filter((file) => file.endsWith(".js") || file.endsWith(".yml"))
.map(async (file) => ({
fileName: file,
content: await fs.promises.readFile(
path.join(process.cwd(), "schema", file),
"utf-8"
),
}))
);
},
}),
};
{{- end }}
1 change: 1 addition & 0 deletions charts/hub-analytics/templates/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ data:
KAFKA_BROKERS: {{ required "must set kafka brokers" .kafkaBrokers | quote }}
KAFKA_SSL: {{ default "false" .kafkaSsl | quote }}
KAFKA_USERNAME: {{ required "must set kafka username" .kafkaUsername | quote }}
CUBE_BASE_URL: {{ required "must set cube base url" .cubeBaseUrl | quote }}
{{- end }}
8 changes: 8 additions & 0 deletions charts/hub-analytics/templates/schemas.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- if .Values.cube.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: cube-schemas
data:
{{ (.Files.Glob "schemas/**.yml").AsConfig | indent 2 }}
{{- end }}
1 change: 1 addition & 0 deletions charts/hub-analytics/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ type: Opaque
data:
KAFKA_PASSWORD: {{ required "must set kafka password" .entries.kafkaPassword | b64enc }}
DATABASE_URL: {{ .entries.databaseUrl | b64enc }}
CUBE_AUTH_TOKEN: {{ required "must set cube auth token" .entries.cubeAuthToken | b64enc }}
{{- end }}
{{- end }}
Loading

0 comments on commit fe62343

Please sign in to comment.