Skip to content

Commit 9ef8b55

Browse files
committed
Merge branch 'newjitsu' into feat/newjitsu/dev-helm
# Conflicts: # bulker/admin/config.go # bulker/admin/deadletter_reprocessor.go # bulker/operator/config.go # bulker/operator/operator.go # k8s-dev/.gitignore # k8s-dev/README.md # k8s-dev/dev-deploy.sh # k8s-dev/templates/_helpers.tpl # k8s-dev/templates/bulker.yaml # k8s-dev/templates/ingest.yaml # k8s-dev/templates/operator.yaml # k8s-dev/templates/rotor.yaml # k8s-dev/templates/syncctl.yaml # k8s-dev/values-custom.example.yaml # k8s-dev/values.yaml
2 parents 69130ea + ce311d1 commit 9ef8b55

File tree

7 files changed

+76
-9
lines changed

7 files changed

+76
-9
lines changed

bulker/.docs/server-config.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,16 @@ String prefixed to all destination topic names.
194194

195195
e.g. if `BULKER_KAFKA_TOPIC_PREFIX=some.prefix.`, then a full topic name could be `some.prefix.in.id.clyzlw-.m.batch.t.events`
196196

197+
### `BULKER_TOPIC_MANAGER_ALL_TABLE_TOKEN`
198+
199+
*Optional, default value: `_all_`*
200+
201+
It allows overwriting default suffix to topics for all tables in a destination, such as
202+
`dead` and `retries` topics
203+
204+
e.g. if `BULKER_TOPIC_MANAGER_ALL_TABLE_TOKEN=all`, then a retry topic for destination `clyzlw-` would be
205+
`in.id.clyzlw-.m.retry.t.all`
206+
197207
### `BULKER_KAFKA_TOPIC_RETENTION_HOURS`
198208

199209
*Optional, default value: `48` (2 days)*

bulker/bulkerapp/app/app_config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ type Config struct {
5151

5252
// TopicManagerRefreshPeriodSec how often topic manager will check for new topics
5353
TopicManagerRefreshPeriodSec int `mapstructure:"TOPIC_MANAGER_REFRESH_PERIOD_SEC" default:"5"`
54+
// TopicManagerAllTableToken allows overwriting default suffix to topics for all tables in a destination, such as
55+
// `dead` and `retries`
56+
TopicManagerAllTableToken string `mapstructure:"TOPIC_MANAGER_ALL_TABLE_TOKEN" default:"_all_"`
5457

5558
// # BATCHING
5659

bulker/bulkerapp/app/topic_manager.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ const (
2424
deadTopicMode = "dead"
2525
profilesTopicMode = "profiles"
2626

27-
allTablesToken = "_all_"
28-
2927
topicLengthLimit = 249
3028
)
3129

32-
var topicPattern = regexp.MustCompile(`^in[.]id[.](.*)[.]m[.](.*)[.](t|b64)[.](.*)$`)
30+
var (
31+
topicPattern = regexp.MustCompile(`^in[.]id[.](.*)[.]m[.](.*)[.](t|b64)[.](.*)$`)
32+
33+
allTablesToken = "_all_"
34+
)
3335

3436
type TopicManager struct {
3537
appbase.Service
@@ -77,6 +79,9 @@ func NewTopicManager(appContext *Context) (*TopicManager, error) {
7779
if err != nil {
7880
return nil, base.NewError("Error creating kafka admin client: %v", err)
7981
}
82+
83+
allTablesToken = appContext.config.TopicManagerAllTableToken
84+
8085
return &TopicManager{
8186
Service: base,
8287
config: appContext.config,

bulker/kafkabase/kafka_config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ type KafkaConfig struct {
4848
ProducerBatchSize int `mapstructure:"PRODUCER_BATCH_SIZE" default:"65535"`
4949
ProducerLingerMs int `mapstructure:"PRODUCER_LINGER_MS" default:"1000"`
5050
ProducerWaitForDeliveryMs int `mapstructure:"PRODUCER_WAIT_FOR_DELIVERY_MS" default:"1000"`
51-
51+
5252
// Failover logger configuration
5353
FailoverLoggerEnvConfig `mapstructure:",squash"`
5454
}
5555

5656
// GetKafkaConfig returns kafka config
5757
func (ac *KafkaConfig) GetKafkaConfig() *kafka.ConfigMap {
5858
if ac.KafkaBootstrapServers == "" {
59-
panic("❗️Kafka bootstrap servers are not set. Please set BULKER_KAFKA_BOOTSTRAP_SERVERS env variable")
59+
panic("❗️Kafka bootstrap servers are not set. Please set KAFKA_BOOTSTRAP_SERVERS env variable")
6060
}
6161
kafkaConfig := &kafka.ConfigMap{
6262
"client.id": "bulkerapp",

k8s-dev/templates/secrets.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: jitsu-secrets
5+
labels:
6+
{{- include "jitsu-dev.labels" . | nindent 4 }}
7+
type: Opaque
8+
stringData:
9+
# Auth tokens (same value used for multiple env vars)
10+
RAW_AUTH_TOKENS: {{ required "secrets.authToken is required" .Values.secrets.authToken | quote }}
11+
BULKER_AUTH_KEY: {{ .Values.secrets.authToken | quote }}
12+
ROTOR_AUTH_KEY: {{ .Values.secrets.authToken | quote }}
13+
REPOSITORY_AUTH_TOKEN: {{ required "secrets.consoleAuthToken is required" .Values.secrets.consoleAuthToken | quote }}
14+
CONSOLE_TOKEN: {{ .Values.secrets.consoleAuthToken | quote }}
15+
CONFIG_SOURCE_HTTP_AUTH_TOKEN: {{ .Values.secrets.consoleAuthToken | quote }}
16+
# PostgreSQL
17+
DATABASE_URL: {{ required "secrets.databaseUrl is required" .Values.secrets.databaseUrl | quote }}
18+
# ClickHouse
19+
CLICKHOUSE_PASSWORD: {{ required "secrets.clickhousePassword is required" .Values.secrets.clickhousePassword | quote }}
20+
# MongoDB
21+
MONGODB_URL: {{ required "secrets.mongodbUrl is required" .Values.secrets.mongodbUrl | quote }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Jitsu Secrets Configuration
2+
# Copy this file to values-secrets.yaml and fill in your credentials
3+
# DO NOT commit values-secrets.yaml to git!
4+
#
5+
# Usage:
6+
# cp values-secrets.example.yaml values-secrets.yaml
7+
# # Edit values-secrets.yaml
8+
# helm install jitsu . -f values-secrets.yaml
9+
10+
secrets:
11+
# Auth token for inter-service communication
12+
# Generate with: openssl rand -hex 16
13+
authToken: "your-auth-token-here"
14+
15+
# Console API auth token (format: username:token)
16+
consoleAuthToken: "service-admin-account:your-token-here"
17+
18+
# PostgreSQL connection URL (full connection string)
19+
databaseUrl: "postgresql://user:pass@host:5432/db"
20+
21+
# ClickHouse password
22+
clickhousePassword: "your-clickhouse-password"
23+
24+
# MongoDB connection URL (includes credentials)
25+
mongodbUrl: "mongodb+srv://user:password@cluster.mongodb.net/database"

webapps/ee-api/lib/stripe.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ export async function exportSubscriptions(): Promise<Record<string, { customer:
220220
}
221221

222222
export async function getActivePlan(customerId: string): Promise<null | SubscriptionStatus> {
223-
const subscriptions = await stripe.subscriptions.list({ customer: customerId, status: "all", limit: 10 });
223+
const [subscriptions, invoices] = await Promise.all([
224+
stripe.subscriptions.list({ customer: customerId, status: "all", limit: 10 }),
225+
stripe.invoices.list({ customer: customerId, limit: 10 }),
226+
]);
227+
const hasPastDueInvoices = invoices.data.some(inv => !["paid", "void", "draft"].includes(inv.status ?? ""));
224228
const sub2product = new Map<string, Stripe.Product>();
225229
for (const sub of subscriptions.data) {
226230
const productId = sub.items.data[0].price.product;
@@ -264,7 +268,7 @@ export async function getActivePlan(customerId: string): Promise<null | Subscrip
264268
.toISOString(),
265269
},
266270
renewAfterExpiration: !subscription.cancel_at_period_end,
267-
pastDue: pastDueSubscription && !activeSubscription,
271+
pastDue: hasPastDueInvoices,
268272
planKind: planData.planKind,
269273

270274
//omit token field that might be considered as sensitive
@@ -402,7 +406,6 @@ export async function listAllInvoices() {
402406
do {
403407
const result = await stripe.invoices.list({
404408
limit: 100,
405-
status: "paid",
406409
starting_after: starting_after,
407410
created: {
408411
//invoices for past 90 days
@@ -411,7 +414,7 @@ export async function listAllInvoices() {
411414
});
412415
starting_after = result?.data[result.data.length - 1]?.id;
413416
if (result?.data) {
414-
allInvoices.push(...result?.data);
417+
allInvoices.push(...result?.data?.filter(i => i.status === "paid" || i.status === "open"));
415418
}
416419
} while (starting_after);
417420
getLog()

0 commit comments

Comments
 (0)