K8s changes for NATS

This commit is contained in:
dingo
2026-02-28 16:31:01 -05:00
parent d1a555cce7
commit e18cdc6b80
21 changed files with 1359 additions and 12 deletions
@@ -0,0 +1,134 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scenes/bazaar/bazaar_screen.gd" id="1_bs"]
[node name="BazaarScreen" type="VBoxContainer"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_bs")
[node name="TopBarMargin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 12
theme_override_constants/margin_right = 12
theme_override_constants/margin_top = 8
theme_override_constants/margin_bottom = 8
[node name="TopBar" type="HBoxContainer" parent="TopBarMargin"]
layout_mode = 2
custom_minimum_size = Vector2(0, 40)
theme_override_constants/separation = 8
[node name="BackBtn" type="Button" parent="TopBarMargin/TopBar"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(40, 40)
text = "←"
tooltip_text = "Back"
theme_override_font_sizes/font_size = 18
[node name="TitleLabel" type="Label" parent="TopBarMargin/TopBar"]
layout_mode = 2
size_flags_horizontal = 3
text = "Bazaar"
vertical_alignment = 1
theme_override_font_sizes/font_size = 18
[node name="BalanceLabel" type="Label" parent="TopBarMargin/TopBar"]
unique_name_in_owner = true
layout_mode = 2
text = "◆ — OP"
vertical_alignment = 1
modulate = Color(0.95, 0.85, 0.30, 1.0)
theme_override_font_sizes/font_size = 14
[node name="HSeparator" type="HSeparator" parent="."]
layout_mode = 2
[node name="TabBarMargin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 16
theme_override_constants/margin_right = 16
theme_override_constants/margin_top = 6
theme_override_constants/margin_bottom = 6
[node name="TabBar" type="HBoxContainer" parent="TabBarMargin"]
layout_mode = 2
custom_minimum_size = Vector2(0, 36)
theme_override_constants/separation = 8
[node name="PacksTabBtn" type="Button" parent="TabBarMargin/TabBar"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
custom_minimum_size = Vector2(0, 36)
text = "Packs"
theme_override_font_sizes/font_size = 14
[node name="DecksTabBtn" type="Button" parent="TabBarMargin/TabBar"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
custom_minimum_size = Vector2(0, 36)
text = "Decks"
theme_override_font_sizes/font_size = 14
[node name="CosmeticsTabBtn" type="Button" parent="TabBarMargin/TabBar"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
custom_minimum_size = Vector2(0, 36)
text = "Cosmetics"
theme_override_font_sizes/font_size = 14
[node name="Scroll" type="ScrollContainer" parent="."]
layout_mode = 2
size_flags_vertical = 3
horizontal_scroll_mode = 0
[node name="ItemListMargin" type="MarginContainer" parent="Scroll"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/margin_left = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_bottom = 8
[node name="ItemList" type="VBoxContainer" parent="Scroll/ItemListMargin"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 6
[node name="StatusRow" type="HBoxContainer" parent="."]
layout_mode = 2
custom_minimum_size = Vector2(0, 44)
alignment = 1
[node name="LoadingLabel" type="Label" parent="StatusRow"]
unique_name_in_owner = true
layout_mode = 2
text = "Loading…"
modulate = Color(0.75, 0.75, 0.8, 1.0)
theme_override_font_sizes/font_size = 14
[node name="EmptyLabel" type="Label" parent="StatusRow"]
unique_name_in_owner = true
layout_mode = 2
text = "Nothing available right now."
visible = false
modulate = Color(0.6, 0.6, 0.65, 1.0)
theme_override_font_sizes/font_size = 14
[node name="ConfirmDialog" type="ConfirmationDialog" parent="."]
unique_name_in_owner = true
title = "Confirm Purchase"
ok_button_text = "Buy"
[node name="ResultDialog" type="AcceptDialog" parent="."]
unique_name_in_owner = true
title = "Result"
@@ -0,0 +1,228 @@
extends VBoxContainer
## Bazaar — browse and purchase store packs, decks, and cosmetics.
##
## Loads the store catalogue and the player's OriginPoints balance in
## parallel on entry. Three tab buttons filter the item list. Each
## row's Buy button opens a confirmation dialog; on confirmation the
## appropriate purchase request is sent to the server. Pack purchases
## display the opened-card list; deck/cosmetic purchases show a notice.
const STORE_ITEM_ROW := preload("res://scenes/bazaar/components/StoreItemRow.tscn")
# ── Node references ────────────────────────────────────────────────────────────
@onready var back_btn : Button = %BackBtn
@onready var balance_label : Label = %BalanceLabel
@onready var packs_tab_btn : Button = %PacksTabBtn
@onready var decks_tab_btn : Button = %DecksTabBtn
@onready var cosmetics_tab_btn : Button = %CosmeticsTabBtn
@onready var item_list : VBoxContainer = %ItemList
@onready var loading_label : Label = %LoadingLabel
@onready var empty_label : Label = %EmptyLabel
@onready var confirm_dialog : ConfirmationDialog = %ConfirmDialog
@onready var result_dialog : AcceptDialog = %ResultDialog
# ── State ─────────────────────────────────────────────────────────────────────
var _tab: int = 0
var _packs: Array = []
var _decks: Array = []
var _cosmetics: Array = []
var _store_loaded: bool = false
var _bal_loaded: bool = false
var _pending_item: Dictionary = {}
var _buying: bool = false
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
back_btn.pressed.connect(_on_back)
packs_tab_btn.pressed.connect(func(): _switch_tab(0))
decks_tab_btn.pressed.connect(func(): _switch_tab(1))
cosmetics_tab_btn.pressed.connect(func(): _switch_tab(2))
confirm_dialog.confirmed.connect(_on_purchase_confirmed)
_apply_tab_style(packs_tab_btn, true)
_apply_tab_style(decks_tab_btn, false)
_apply_tab_style(cosmetics_tab_btn, false)
loading_label.visible = true
empty_label.visible = false
_fetch_data()
# ── Data fetching ─────────────────────────────────────────────────────────────
func _fetch_data() -> void:
_store_loaded = false
_bal_loaded = false
Network.request("bazaar.get_store", {}, _on_store_ok, _on_store_err)
Network.request("bazaar.get_my_balance", {}, _on_balance_ok, _on_balance_err)
func _on_store_ok(_type: String, p: Dictionary) -> void:
_packs = p.get("packs", [])
_decks = p.get("decks", [])
_cosmetics = p.get("cosmetics", [])
_store_loaded = true
_check_done()
func _on_store_err(code: String, _msg: String) -> void:
push_warning("Bazaar: get_store failed — %s" % code)
_store_loaded = true
_check_done()
func _on_balance_ok(_type: String, p: Dictionary) -> void:
balance_label.text = "◆ %d OP" % int(p.get("originPoints", 0))
_bal_loaded = true
_check_done()
func _on_balance_err(code: String, _msg: String) -> void:
push_warning("Bazaar: get_my_balance failed — %s" % code)
balance_label.text = "◆ — OP"
_bal_loaded = true
_check_done()
func _check_done() -> void:
if not (_store_loaded and _bal_loaded):
return
loading_label.visible = false
_render_tab()
# ── Tabs ──────────────────────────────────────────────────────────────────────
func _switch_tab(index: int) -> void:
_tab = index
_apply_tab_style(packs_tab_btn, index == 0)
_apply_tab_style(decks_tab_btn, index == 1)
_apply_tab_style(cosmetics_tab_btn, index == 2)
if _store_loaded and _bal_loaded:
_render_tab()
func _apply_tab_style(btn: Button, active: bool) -> void:
var style := StyleBoxFlat.new()
style.corner_radius_top_left = 6
style.corner_radius_top_right = 6
style.corner_radius_bottom_left = 6
style.corner_radius_bottom_right = 6
style.bg_color = Color(0.27, 0.47, 0.80, 1.0) if active else Color(0.18, 0.18, 0.26, 1.0)
btn.add_theme_stylebox_override("normal", style)
btn.add_theme_stylebox_override("hover", style)
btn.add_theme_stylebox_override("pressed", style)
func _render_tab() -> void:
for child in item_list.get_children():
child.queue_free()
var items: Array
match _tab:
0: items = _packs
1: items = _decks
2: items = _cosmetics
_: items = []
empty_label.visible = items.is_empty()
for item in items:
var row = STORE_ITEM_ROW.instantiate()
item_list.add_child(row)
row.setup(item)
row.buy_pressed.connect(_on_buy_pressed)
# ── Purchase flow ─────────────────────────────────────────────────────────────
func _on_buy_pressed(item: Dictionary) -> void:
_pending_item = item
var name_str : String = item.get("name", "?")
var price : int = int(item.get("originPointPrice", 0))
confirm_dialog.dialog_text = "Buy \"%s\" for ◆ %d OP?" % [name_str, price]
confirm_dialog.popup_centered()
func _on_purchase_confirmed() -> void:
if _pending_item.is_empty() or _buying:
return
_buying = true
var item := _pending_item
var item_id : String = str(item.get("id", ""))
var req_type: String
var req_payload: Dictionary
match _tab:
0:
req_type = "bazaar.buy_booster_pack"
req_payload = { "packId": item_id }
1:
req_type = "bazaar.buy_prebuilt_deck"
req_payload = { "deckId": item_id }
_:
req_type = "bazaar.buy_cosmetic"
req_payload = { "cosmeticId": item_id }
var tab_at_purchase := _tab
Network.request(req_type, req_payload,
func(_t, p): _on_purchase_ok(tab_at_purchase, p),
func(code, msg): _on_purchase_err(code, msg))
func _on_purchase_ok(tab: int, p: Dictionary) -> void:
_buying = false
var new_bal: int = int(p.get("newOriginPointBalance", 0))
balance_label.text = "◆ %d OP" % new_bal
match tab:
0: # Booster pack — list the opened cards
var cards: Array = p.get("cardsOpened", [])
_show_pack_result(cards)
1: # Prebuilt deck
var deck_name: String = p.get("deckName", _pending_item.get("name", "deck"))
result_dialog.title = "Purchase Complete"
result_dialog.dialog_text = "Deck \"%s\" has been added to your collection!" % deck_name
result_dialog.popup_centered()
_: # Cosmetic
var cname: String = _pending_item.get("name", "cosmetic")
result_dialog.title = "Purchase Complete"
result_dialog.dialog_text = "\"%s\" has been added to your account!" % cname
result_dialog.popup_centered()
_pending_item = {}
func _on_purchase_err(code: String, msg: String) -> void:
_buying = false
_pending_item = {}
result_dialog.title = "Purchase Failed"
result_dialog.dialog_text = "Could not complete purchase.\nError: %s\n%s" % [code, msg]
result_dialog.popup_centered()
func _show_pack_result(cards: Array) -> void:
var lines := PackedStringArray()
for card in cards:
var foil_str : String = " ✦" if bool(card.get("isFoil", false)) else ""
var serial_var = card.get("serialNumber", null)
var serial_str : String = " #%d" % int(serial_var) if serial_var != null else ""
lines.append("%s · %s · %s%s%s" % [
card.get("name", "?"),
card.get("rarity", ""),
card.get("affinity", ""),
foil_str,
serial_str,
])
result_dialog.title = "Pack Opened! (%d cards)" % cards.size()
result_dialog.dialog_text = "\n".join(lines)
result_dialog.popup_centered()
# ── Navigation ────────────────────────────────────────────────────────────────
func _on_back() -> void:
get_tree().change_scene_to_file("res://scenes/main/MainScreen.tscn")
@@ -0,0 +1 @@
uid://cq4fff6k71rpe
@@ -0,0 +1,62 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scenes/bazaar/components/store_item_row.gd" id="1_sir"]
[node name="StoreItemRow" type="PanelContainer"]
script = ExtResource("1_sir")
[node name="Margin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_bottom = 10
[node name="HBox" type="HBoxContainer" parent="Margin"]
layout_mode = 2
theme_override_constants/separation = 12
[node name="Info" type="VBoxContainer" parent="Margin/HBox"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 3
[node name="NameLabel" type="Label" parent="Margin/HBox/Info"]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 14
[node name="DescLabel" type="Label" parent="Margin/HBox/Info"]
unique_name_in_owner = true
layout_mode = 2
text = ""
visible = false
autowrap_mode = 2
modulate = Color(0.70, 0.70, 0.75, 1.0)
theme_override_font_sizes/font_size = 12
[node name="SubLabel" type="Label" parent="Margin/HBox/Info"]
unique_name_in_owner = true
layout_mode = 2
text = ""
visible = false
modulate = Color(0.55, 0.55, 0.60, 1.0)
theme_override_font_sizes/font_size = 11
[node name="PriceBox" type="VBoxContainer" parent="Margin/HBox"]
layout_mode = 2
theme_override_constants/separation = 4
[node name="PriceLabel" type="Label" parent="Margin/HBox/PriceBox"]
unique_name_in_owner = true
layout_mode = 2
horizontal_alignment = 1
modulate = Color(0.95, 0.85, 0.30, 1.0)
theme_override_font_sizes/font_size = 13
[node name="BuyBtn" type="Button" parent="Margin/HBox/PriceBox"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(76, 32)
text = "Buy"
theme_override_font_sizes/font_size = 13
@@ -0,0 +1,50 @@
extends PanelContainer
## A single row in the Bazaar store listing.
##
## Call setup(item) with a Dictionary from get_store (StorePackDto,
## StoreDeckDto, or CosmeticDto). Emits buy_pressed(item) when the
## Buy button is pressed.
signal buy_pressed(item: Dictionary)
@onready var name_label : Label = %NameLabel
@onready var desc_label : Label = %DescLabel
@onready var sub_label : Label = %SubLabel
@onready var price_label : Label = %PriceLabel
@onready var buy_btn : Button = %BuyBtn
var _item: Dictionary = {}
func setup(item: Dictionary) -> void:
_item = item
name_label.text = item.get("name", "—")
var desc: String = item.get("description", "")
if desc.is_empty():
desc_label.visible = false
else:
desc_label.text = desc
desc_label.visible = true
# Sub-line varies by product type.
var sub := ""
if item.has("totalSlots"):
sub = "%d cards per pack" % int(item.get("totalSlots", 0))
elif item.has("totalCards"):
sub = "%d cards" % int(item.get("totalCards", 0))
var arch: String = item.get("archSpiritName", "")
if not arch.is_empty():
sub += " · Arch: %s" % arch
elif item.has("cosmeticType"):
sub = item.get("cosmeticType", "")
if sub.is_empty():
sub_label.visible = false
else:
sub_label.text = sub
sub_label.visible = true
price_label.text = "◆ %d OP" % int(item.get("originPointPrice", 0))
buy_btn.pressed.connect(func(): buy_pressed.emit(_item))
@@ -0,0 +1 @@
uid://bl4vmmiurfap2
@@ -110,6 +110,7 @@ text = "My Collection"
theme_override_font_sizes/font_size = 15
[node name="BazaarBtn" type="Button" parent="Layout/Scroll/Content/ContentMargin/ContentInner/NavButtons"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(0, 52)
text = "Bazaar"
@@ -11,6 +11,7 @@ extends Control
@onready var status_label : Label = %StatusLabel
@onready var logout_btn : Button = %LogoutBtn
@onready var collection_btn : Button = %CollectionBtn
@onready var bazaar_btn : Button = %BazaarBtn
# ── Lifecycle ─────────────────────────────────────────────────────────────────
@@ -0,0 +1 @@
uid://bpfo3u8lys7e2
BIN
View File
Binary file not shown.
+88
View File
@@ -0,0 +1,88 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sor-bazaar
namespace: stone-server
labels:
app: sor-bazaar
spec:
replicas: 1
selector:
matchLabels:
app: sor-bazaar
template:
metadata:
labels:
app: sor-bazaar
spec:
imagePullSecrets:
- name: harbor-credentials
containers:
- name: sor-bazaar
image: registry.aeternalisgames.com/sor/sor-server:latest
ports:
- containerPort: 8080
envFrom:
- configMapRef:
name: sor-config
env:
- name: ENABLED_SERVICES
value: "bazaar"
- name: ConnectionStrings__Default
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: ConnectionStrings__Default
- name: ConnectionStrings__Redis
valueFrom:
secretKeyRef:
name: redis-credentials
key: connection-string
- name: Cdn__PublicBaseUrl
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__PublicBaseUrl
- name: Cdn__EndpointUrl
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__EndpointUrl
- name: Cdn__AccessKey
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__AccessKey
- name: Cdn__SecretKey
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__SecretKey
- name: Cdn__BucketName
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__BucketName
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 15
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
resources:
requests:
cpu: "200m"
memory: "256Mi"
limits:
cpu: "750m"
memory: "768Mi"
+63
View File
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sor-collection
namespace: stone-server
labels:
app: sor-collection
spec:
replicas: 1
selector:
matchLabels:
app: sor-collection
template:
metadata:
labels:
app: sor-collection
spec:
imagePullSecrets:
- name: harbor-credentials
containers:
- name: sor-collection
image: registry.aeternalisgames.com/sor/sor-server:latest
ports:
- containerPort: 8080
envFrom:
- configMapRef:
name: sor-config
env:
- name: ENABLED_SERVICES
value: "collection"
- name: ConnectionStrings__Default
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: ConnectionStrings__Default
- name: ConnectionStrings__Redis
valueFrom:
secretKeyRef:
name: redis-credentials
key: connection-string
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 15
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
resources:
requests:
cpu: "150m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "512Mi"
+88
View File
@@ -0,0 +1,88 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sor-content
namespace: stone-server
labels:
app: sor-content
spec:
replicas: 1
selector:
matchLabels:
app: sor-content
template:
metadata:
labels:
app: sor-content
spec:
imagePullSecrets:
- name: harbor-credentials
containers:
- name: sor-content
image: registry.aeternalisgames.com/sor/sor-server:latest
ports:
- containerPort: 8080
envFrom:
- configMapRef:
name: sor-config
env:
- name: ENABLED_SERVICES
value: "content"
- name: ConnectionStrings__Default
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: ConnectionStrings__Default
- name: ConnectionStrings__Redis
valueFrom:
secretKeyRef:
name: redis-credentials
key: connection-string
- name: Cdn__PublicBaseUrl
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__PublicBaseUrl
- name: Cdn__EndpointUrl
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__EndpointUrl
- name: Cdn__AccessKey
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__AccessKey
- name: Cdn__SecretKey
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__SecretKey
- name: Cdn__BucketName
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: Cdn__BucketName
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 15
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
resources:
requests:
cpu: "150m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "512Mi"
+63
View File
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sor-game
namespace: stone-server
labels:
app: sor-game
spec:
replicas: 2
selector:
matchLabels:
app: sor-game
template:
metadata:
labels:
app: sor-game
spec:
imagePullSecrets:
- name: harbor-credentials
containers:
- name: sor-game
image: registry.aeternalisgames.com/sor/sor-server:latest
ports:
- containerPort: 8080
envFrom:
- configMapRef:
name: sor-config
env:
- name: ENABLED_SERVICES
value: "game"
- name: ConnectionStrings__Default
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: ConnectionStrings__Default
- name: ConnectionStrings__Redis
valueFrom:
secretKeyRef:
name: redis-credentials
key: connection-string
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 15
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
resources:
requests:
cpu: "300m"
memory: "384Mi"
limits:
cpu: "1000m"
memory: "1Gi"
+63
View File
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sor-matchmaking
namespace: stone-server
labels:
app: sor-matchmaking
spec:
replicas: 1
selector:
matchLabels:
app: sor-matchmaking
template:
metadata:
labels:
app: sor-matchmaking
spec:
imagePullSecrets:
- name: harbor-credentials
containers:
- name: sor-matchmaking
image: registry.aeternalisgames.com/sor/sor-server:latest
ports:
- containerPort: 8080
envFrom:
- configMapRef:
name: sor-config
env:
- name: ENABLED_SERVICES
value: "matchmaking"
- name: ConnectionStrings__Default
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: ConnectionStrings__Default
- name: ConnectionStrings__Redis
valueFrom:
secretKeyRef:
name: redis-credentials
key: connection-string
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 15
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
resources:
requests:
cpu: "150m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "512Mi"
+50
View File
@@ -0,0 +1,50 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nats
namespace: stone-server
labels:
app: nats
spec:
replicas: 1
selector:
matchLabels:
app: nats
template:
metadata:
labels:
app: nats
spec:
containers:
- name: nats
image: nats:2.10-alpine
args:
- "-js"
- "-m"
- "8222"
ports:
- name: client
containerPort: 4222
- name: monitor
containerPort: 8222
livenessProbe:
tcpSocket:
port: 4222
initialDelaySeconds: 10
periodSeconds: 20
timeoutSeconds: 3
failureThreshold: 3
readinessProbe:
tcpSocket:
port: 4222
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
resources:
requests:
cpu: "50m"
memory: "64Mi"
limits:
cpu: "250m"
memory: "256Mi"
+63
View File
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sor-versioning
namespace: stone-server
labels:
app: sor-versioning
spec:
replicas: 1
selector:
matchLabels:
app: sor-versioning
template:
metadata:
labels:
app: sor-versioning
spec:
imagePullSecrets:
- name: harbor-credentials
containers:
- name: sor-versioning
image: registry.aeternalisgames.com/sor/sor-server:latest
ports:
- containerPort: 8080
envFrom:
- configMapRef:
name: sor-config
env:
- name: ENABLED_SERVICES
value: "versioning"
- name: ConnectionStrings__Default
valueFrom:
secretKeyRef:
name: sor-app-secrets
key: ConnectionStrings__Default
- name: ConnectionStrings__Redis
valueFrom:
secretKeyRef:
name: redis-credentials
key: connection-string
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 15
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
resources:
requests:
cpu: "100m"
memory: "192Mi"
limits:
cpu: "300m"
memory: "384Mi"
+7 -7
View File
@@ -1,25 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sor-workers
name: sor-chat
namespace: stone-server
labels:
app: sor-workers
app: sor-chat
spec:
replicas: 3
replicas: 1
selector:
matchLabels:
app: sor-workers
app: sor-chat
template:
metadata:
labels:
app: sor-workers
app: sor-chat
spec:
imagePullSecrets:
- name: harbor-credentials
containers:
- name: sor-workers
- name: sor-chat
image: registry.aeternalisgames.com/sor/sor-server:latest
ports:
- containerPort: 8080
@@ -34,7 +34,7 @@ spec:
# Business-logic services only — no WebSocket, no auth gRPC.
# These pods subscribe to NATS and handle all game/store/social messages.
- name: ENABLED_SERVICES
value: "chat,collection,bazaar,content,versioning,matchmaking,game"
value: "chat"
# Postgres — all schemas (chat, collection, bazaar, catalog, game, identity).
- name: ConnectionStrings__Default
+9 -5
View File
@@ -1,14 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: sor-workers
name: nats
namespace: stone-server
spec:
selector:
app: sor-workers
app: nats
ports:
- name: http
- name: client
protocol: TCP
port: 80
targetPort: 8080
port: 4222
targetPort: 4222
- name: monitor
protocol: TCP
port: 8222
targetPort: 8222
type: ClusterIP
+358
View File
@@ -0,0 +1,358 @@
-- Import legacy card rows into catalog.card_definitions.
--
-- Usage:
-- 1. Load your old rows into temp_legacy_cards (COPY, INSERT, psql \copy, etc.).
-- 2. Run the INSERT ... SELECT below.
--
-- Notes:
-- - This script targets the current Postgres schema used by SOR.Database.
-- - It intentionally does NOT preserve the old CardId as the new primary key.
-- - ArchSpirit tier chains are preserved by mapping legacy ParentCardId -> new UUID.
-- - Repentance payloads cannot be losslessly converted yet because the old
-- Repentances[] ids do not map directly to the new Action/Effect DSL in this repo.
-- For those rows, a placeholder JSON payload is written to "effects" so the legacy
-- ids are preserved for manual follow-up.
-- - Card assets (CardArt / CardModelName) are not imported here; this only populates
-- catalog.card_definitions.
--
-- Legacy enum assumptions used here:
-- Type:
-- 1 = Spirit
-- 3 = Repentance
-- 5 = Terramorpha
-- 6 = ArchSpirit
-- Affinity:
-- 1 = Void
-- 2 = Lake
-- 3 = Hill
-- 4 = Field
-- 5 = Forest
-- 6 = Aether
-- 7 = Ocean
-- 8 = Island
-- 9 = Marsh
-- 10 = Swamp
-- 11 = Mountain
-- 12 = Steppe
-- 13 = Fort
-- 14 = Plains
-- 15 = Grove
-- 16 = Jungle
--
-- If your old DB used a different numeric enum layout, update the two CASE maps below
-- before running this script.
CREATE EXTENSION IF NOT EXISTS pgcrypto;
DROP TABLE IF EXISTS temp_legacy_cards;
CREATE TEMP TABLE temp_legacy_cards
(
legacy_card_id integer PRIMARY KEY,
name text NOT NULL,
description text NOT NULL,
legacy_type integer NOT NULL,
sp_cost integer NOT NULL,
st_cost integer NOT NULL,
legacy_affinity integer NOT NULL,
card_data jsonb NOT NULL
);
-- Paste the raw legacy SQL tuple blob below (the exact format you pasted in chat),
-- replacing the placeholder line. Example row format:
-- '146', 'Barrier of Unseen', 'A Barrier of nothing', '1', '4', '1', '1', '{\"CardGenus\": [\"Barrier\"]}'
WITH raw_blob AS
(
SELECT $blob$
PASTE_LEGACY_ROWS_HERE
$blob$ AS blob
),
parsed_rows AS
(
SELECT
(m)[1]::integer AS legacy_card_id,
regexp_replace((m)[2], E'\\\\''', '''', 'g') AS name,
regexp_replace((m)[3], E'\\\\''', '''', 'g') AS description,
(m)[4]::integer AS legacy_type,
(m)[5]::integer AS sp_cost,
(m)[6]::integer AS st_cost,
(m)[7]::integer AS legacy_affinity,
replace(
regexp_replace((m)[8], E'\\\\''', '''', 'g'),
E'\\\"',
'"'
)::jsonb AS card_data
FROM raw_blob rb
CROSS JOIN LATERAL regexp_matches(
rb.blob,
'''((?:[^''\\]|\\.)*)''\s*,\s*''((?:[^''\\]|\\.)*)''\s*,\s*''((?:[^''\\]|\\.)*)''\s*,\s*''((?:[^''\\]|\\.)*)''\s*,\s*''((?:[^''\\]|\\.)*)''\s*,\s*''((?:[^''\\]|\\.)*)''\s*,\s*''((?:[^''\\]|\\.)*)''\s*,\s*''((?:[^''\\]|\\.)*)''',
'g'
) AS m
)
INSERT INTO temp_legacy_cards
(legacy_card_id, name, description, legacy_type, sp_cost, st_cost, legacy_affinity, card_data)
SELECT
legacy_card_id,
name,
description,
legacy_type,
sp_cost,
st_cost,
legacy_affinity,
card_data
FROM parsed_rows;
WITH source_rows AS
(
SELECT
l.*,
gen_random_uuid() AS new_id,
CASE l.legacy_type
WHEN 1 THEN 'Spirit'
WHEN 3 THEN 'Repentance'
WHEN 5 THEN 'Terramorpha'
WHEN 6 THEN 'ArchSpirit'
ELSE NULL
END AS mapped_card_type,
CASE l.legacy_affinity
WHEN 1 THEN 'Void'
WHEN 2 THEN 'Lake'
WHEN 3 THEN 'Hill'
WHEN 4 THEN 'Field'
WHEN 5 THEN 'Forest'
WHEN 6 THEN 'Aether'
WHEN 7 THEN 'Ocean'
WHEN 8 THEN 'Island'
WHEN 9 THEN 'Marsh'
WHEN 10 THEN 'Swamp'
WHEN 11 THEN 'Mountain'
WHEN 12 THEN 'Steppe'
WHEN 13 THEN 'Fort'
WHEN 14 THEN 'Plains'
WHEN 15 THEN 'Grove'
WHEN 16 THEN 'Jungle'
ELSE NULL
END AS mapped_affinity,
CASE (l.card_data ->> 'AttackType')
WHEN '0' THEN 'Melee'
WHEN '1' THEN 'Ranged'
ELSE NULL
END AS mapped_attack_type,
CASE (l.card_data ->> 'TerraType')
WHEN '1' THEN 'Mono'
WHEN '2' THEN 'Di'
WHEN '3' THEN 'Tri'
ELSE NULL
END AS mapped_terramorpha_mode,
NULLIF(l.card_data ->> 'ParentCardId', '')::integer AS legacy_parent_card_id
FROM temp_legacy_cards l
),
validated AS
(
SELECT *
FROM source_rows
WHERE mapped_card_type IS NOT NULL
AND mapped_affinity IS NOT NULL
),
inserted AS
(
INSERT INTO catalog.card_definitions
(
"Id",
"Name",
"Description",
"CardType",
"Affinity",
"SpCost",
"StCost",
"OtherCosts",
"MinChannelRange",
"MaxChannelRange",
"AttackType",
"RequiresLos",
"MinAttackRange",
"MaxAttackRange",
"CanAttack",
"Damage",
"CanDefend",
"MaxHealth",
"MaxDefense",
"CanBeAttacked",
"CanBeBlocked",
"CanMove",
"MovementType",
"MovementPoints",
"CanBeObstructed",
"CanUseAbility",
"Genus",
"CanBeSacrificed",
"Tier",
"PreviousTierId",
"TerramorphaMode",
"Abilities",
"Effects",
"Rarity",
"SetId",
"CollectorNumber",
"IsPublished",
"IsRetired",
"RetiredAt",
"CreatedAt",
"UpdatedAt"
)
SELECT
s.new_id,
s.name,
COALESCE(s.description, ''),
s.mapped_card_type,
s.mapped_affinity,
s.sp_cost,
s.st_cost,
NULL,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN NULLIF(s.card_data ->> 'CardChannelMinRange', '')::integer
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN NULLIF(s.card_data ->> 'CardChannelMaxRange', '')::integer
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
AND s.card_data ? 'AttackType'
THEN s.mapped_attack_type
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
AND s.card_data ? 'AttackType'
THEN false
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN NULLIF(s.card_data ->> 'CardAttackMinRange', '')::integer
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN NULLIF(s.card_data ->> 'CardAttackMaxRange', '')::integer
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN COALESCE((s.card_data ->> 'CanAttack')::boolean, false)
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN NULLIF(s.card_data ->> 'CardAttack', '')::integer
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
AND s.card_data ? 'CardDefense'
THEN true
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN NULLIF(s.card_data ->> 'CardHealthPoints', '')::integer
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN NULLIF(s.card_data ->> 'CardDefense', '')::integer
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN true
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN true
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN COALESCE((s.card_data ->> 'CanMove')::boolean, false)
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
AND COALESCE((s.card_data ->> 'CanMove')::boolean, false)
THEN 'Walk'
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN NULLIF(s.card_data ->> 'CardMovementPoints', '')::integer
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN true
ELSE NULL
END,
CASE
WHEN s.mapped_card_type IN ('Spirit', 'ArchSpirit')
THEN COALESCE(
NULLIF(s.card_data ->> 'CardCanUseAbilities', '')::boolean,
jsonb_typeof(s.card_data -> 'Abilities') = 'array'
AND jsonb_array_length(s.card_data -> 'Abilities') > 0,
false)
ELSE NULL
END,
CASE
WHEN s.card_data ? 'CardGenus'
THEN ARRAY(SELECT jsonb_array_elements_text(s.card_data -> 'CardGenus'))
ELSE NULL
END,
CASE
WHEN s.mapped_card_type = 'Spirit' THEN true
ELSE NULL
END,
CASE
WHEN s.mapped_card_type = 'ArchSpirit'
THEN COALESCE(NULLIF(s.card_data ->> 'CardTier', '')::integer, 1)
ELSE NULL
END,
parent.new_id,
CASE
WHEN s.mapped_card_type = 'Terramorpha'
THEN s.mapped_terramorpha_mode
ELSE NULL
END,
CASE
WHEN s.card_data ? 'Abilities'
AND jsonb_typeof(s.card_data -> 'Abilities') = 'array'
THEN s.card_data -> 'Abilities'
ELSE NULL
END,
CASE
WHEN s.mapped_card_type = 'Repentance'
AND s.card_data ? 'Repentances'
THEN jsonb_build_array(
jsonb_build_object(
'LegacyRepentanceIds', s.card_data -> 'Repentances',
'MigrationNote', 'Manual conversion to new Action/Effect DSL required'))
ELSE NULL
END,
'Common',
NULL,
NULL,
true,
false,
NULL,
now(),
now()
FROM validated s
LEFT JOIN validated parent
ON parent.legacy_card_id = s.legacy_parent_card_id
RETURNING "Id", "Name"
)
SELECT count(*) AS inserted_count
FROM inserted;
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="GetEFProjectMetadata">
<MSBuild Condition=" '$(TargetFramework)' == '' "
Projects="$(MSBuildProjectFile)"
Targets="GetEFProjectMetadata"
Properties="TargetFramework=$(TargetFrameworks.Split(';')[0]);EFProjectMetadataFile=$(EFProjectMetadataFile)" />
<ItemGroup Condition=" '$(TargetFramework)' != '' ">
<EFProjectMetadata Include="AssemblyName: $(AssemblyName)" />
<EFProjectMetadata Include="Language: $(Language)" />
<EFProjectMetadata Include="OutputPath: $(OutputPath)" />
<EFProjectMetadata Include="Platform: $(Platform)" />
<EFProjectMetadata Include="PlatformTarget: $(PlatformTarget)" />
<EFProjectMetadata Include="ProjectAssetsFile: $(ProjectAssetsFile)" />
<EFProjectMetadata Include="ProjectDir: $(ProjectDir)" />
<EFProjectMetadata Include="RootNamespace: $(RootNamespace)" />
<EFProjectMetadata Include="RuntimeFrameworkVersion: $(RuntimeFrameworkVersion)" />
<EFProjectMetadata Include="TargetFileName: $(TargetFileName)" />
<EFProjectMetadata Include="TargetFrameworkMoniker: $(TargetFrameworkMoniker)" />
<EFProjectMetadata Include="Nullable: $(Nullable)" />
<EFProjectMetadata Include="TargetFramework: $(TargetFramework)" />
<EFProjectMetadata Include="TargetPlatformIdentifier: $(TargetPlatformIdentifier)" />
</ItemGroup>
<WriteLinesToFile Condition=" '$(TargetFramework)' != '' "
File="$(EFProjectMetadataFile)"
Lines="@(EFProjectMetadata)" />
</Target>
</Project>