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

dev: Helm deployment #231

Merged
merged 3 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ helm-uninstall:
helm-install:
$(eval COMMIT_SHA := $(shell git rev-parse --short HEAD))
@echo "Installing helm chart..."
helm install --set postgres.password=$(POSTGRES_PASSWORD) --set apibara.authToken=$(AUTH_TOKEN) art-peace-infra infra/art-peace-infra
helm install --set postgres.password=$(POSTGRES_PASSWORD) --set deployments.sha=$(COMMIT_SHA) --set apibara.authToken=$(AUTH_TOKEN) art-peace-infra infra/art-peace-infra

helm-template:
$(eval COMMIT_SHA := $(shell git rev-parse --short HEAD))
Expand All @@ -64,9 +64,7 @@ helm-upgrade:

init-infra-prod:
$(eval COLORS := $(shell cat configs/canvas.config.json | jq -r '.colors | map("\"\(.)\"") | join(",")'))
$(eval VOTABLE_COLORS := $(shell cat configs/canvas.config.json | jq -r '.votableColors | map("\"\(.)\"") | join(",")'))
@echo "Initializing infra..."
curl https://api.art-peace.net/init-canvas -X POST
curl https://api.art-peace.net/init-colors -X POST -d "[$(COLORS)]"
curl https://api.art-peace.net/init-votable-colors -X POST -d "[$(VOTABLE_COLORS)]"
curl https://api.art-peace.net/init-quests -X POST -d "@configs/quests.config.json"
curl https://api.art-peace.net/init-quests -X POST -d "@configs/production-quests.config.json"
1 change: 1 addition & 0 deletions backend/cmd/consumer/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func main() {
routes.InitBaseRoutes()
indexer.InitIndexerRoutes()
routes.InitWebsocketRoutes()
routes.InitNFTStaticRoutes()
indexer.StartMessageProcessor()

core.ArtPeaceBackend.Start(core.ArtPeaceBackend.BackendConfig.ConsumerPort)
Expand Down
3 changes: 3 additions & 0 deletions backend/routes/nft.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ func InitNFTRoutes() {
}
// Create a static file server for the nft images
// TODO: Versioning here?
}

func InitNFTStaticRoutes() {
http.Handle("/nft-images/", http.StripPrefix("/nft-images/", http.FileServer(http.Dir("./nfts/images"))))
http.Handle("/nft-meta/", http.StripPrefix("/nft-meta/", http.FileServer(http.Dir("./nfts/meta"))))
}
Expand Down
4 changes: 2 additions & 2 deletions configs/sepolia-contracts.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"usernameStore": "0x073128a9f7b38d2bcdb6c1f9ef4fea357de4dfe2fab5832c1e7b51e9aae97c51",
"artPeace": "0x075ceac501d747749d289cd588f07601b3caad223f4fcfcc803a77311118b1cf",
"canvasNFT": "0x0408344d68130bf550d5fe1b70637b270bca09ec1461fecfb953d3d49fd3f2ac",
"artPeace": "0x0465839f32ba6b9969d4e08e508e432fd136d019fcc078a06691807a7b22eb47",
"canvasNFT": "0x01db23066e7d6d65cf5b8dfe0f0e1591b5c34a4585108464dbe12e7c7850437b",
"pixelQuest": "0x0715004f8805f938b1d42b0bce12a9b1dc49ec55bb2c401ea9c4695461960576"
}
2 changes: 1 addition & 1 deletion frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function App() {
fetchGetLastPlacedPixel();
}, [queryAddress]);

const updateInterval = 1000; // 1 second
const updateInterval = 120000; // 1 second
// TODO: make this a config
const timeBetweenPlacements = 1000; // 2 minutes
const [basePixelTimer, setBasePixelTimer] = useState('XX:XX');
Expand Down
119 changes: 99 additions & 20 deletions frontend/src/contracts/art_peace.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,22 @@
],
"state_mutability": "view"
},
{
"type": "function",
"name": "get_user_factions_count",
"inputs": [
{
"name": "user",
"type": "core::starknet::contract_address::ContractAddress"
}
],
"outputs": [
{
"type": "core::integer::u32"
}
],
"state_mutability": "view"
},
{
"type": "function",
"name": "get_faction",
Expand Down Expand Up @@ -626,6 +642,26 @@
],
"state_mutability": "view"
},
{
"type": "function",
"name": "get_user_vote",
"inputs": [
{
"name": "user",
"type": "core::starknet::contract_address::ContractAddress"
},
{
"name": "day",
"type": "core::integer::u32"
}
],
"outputs": [
{
"type": "core::integer::u8"
}
],
"state_mutability": "view"
},
{
"type": "function",
"name": "get_votable_colors",
Expand Down Expand Up @@ -801,26 +837,6 @@
"outputs": [],
"state_mutability": "external"
},
{
"type": "function",
"name": "claim_daily_quest",
"inputs": [
{
"name": "day_index",
"type": "core::integer::u32"
},
{
"name": "quest_id",
"type": "core::integer::u32"
},
{
"name": "calldata",
"type": "core::array::Span::<core::felt252>"
}
],
"outputs": [],
"state_mutability": "external"
},
{
"type": "function",
"name": "claim_today_quest",
Expand Down Expand Up @@ -1023,6 +1039,38 @@
],
"outputs": [],
"state_mutability": "external"
},
{
"type": "function",
"name": "complete_template_with_rewards",
"inputs": [
{
"name": "template_id",
"type": "core::integer::u32"
},
{
"name": "template_image",
"type": "core::array::Span::<core::integer::u8>"
}
],
"outputs": [],
"state_mutability": "external"
},
{
"type": "function",
"name": "compute_template_hash",
"inputs": [
{
"name": "template",
"type": "core::array::Span::<core::integer::u8>"
}
],
"outputs": [
{
"type": "core::felt252"
}
],
"state_mutability": "view"
}
]
},
Expand Down Expand Up @@ -1213,6 +1261,10 @@
{
"name": "daily_quests_count",
"type": "core::integer::u32"
},
{
"name": "devmode",
"type": "core::bool"
}
]
},
Expand Down Expand Up @@ -1466,6 +1518,28 @@
}
]
},
{
"type": "event",
"name": "art_peace::art_peace::ArtPeace::VotableColorAdded",
"kind": "struct",
"members": [
{
"name": "day",
"type": "core::integer::u32",
"kind": "key"
},
{
"name": "color_key",
"type": "core::integer::u8",
"kind": "key"
},
{
"name": "color",
"type": "core::integer::u32",
"kind": "data"
}
]
},
{
"type": "event",
"name": "art_peace::templates::component::TemplateStoreComponent::TemplateAdded",
Expand Down Expand Up @@ -1567,6 +1641,11 @@
"type": "art_peace::art_peace::ArtPeace::MemberReplaced",
"kind": "nested"
},
{
"name": "VotableColorAdded",
"type": "art_peace::art_peace::ArtPeace::VotableColorAdded",
"kind": "nested"
},
{
"name": "TemplateEvent",
"type": "art_peace::templates::component::TemplateStoreComponent::Event",
Expand Down
2 changes: 1 addition & 1 deletion infra/art-peace-infra/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ description: Helm charts for the art/peace infrastructure

type: application
version: 0.1.0
appVersion: "v0.2.1"
appVersion: "v0.3.0"
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,3 @@ spec:
envFrom:
- configMapRef:
name: {{ .Values.labels.backend.name }}-secret
volumeMounts:
- mountPath: /app/nfts
name: {{ .Values.volumes.nfts.name }}
volumes:
- name: {{ .Values.volumes.nfts.name }}
persistentVolumeClaim:
claimName: {{ .Values.volumes.nfts.claim }}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,3 @@ spec:
envFrom:
- configMapRef:
name: {{ .Values.labels.backend.name }}-secret
volumeMounts:
- mountPath: /app/nfts
name: {{ .Values.volumes.nfts.name }}
volumes:
- name: {{ .Values.volumes.nfts.name }}
persistentVolumeClaim:
claimName: {{ .Values.volumes.nfts.claim }}
14 changes: 14 additions & 0 deletions infra/art-peace-infra/templates/backend/backend-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ spec:
name: {{ .Values.labels.consumer.name }}
port:
number: {{ .Values.ports.consumer }}
- path: /nft-images
pathType: Prefix
backend:
service:
name: {{ .Values.labels.consumer.name }}
port:
number: {{ .Values.ports.consumer }}
- path: /nft-meta
pathType: Prefix
backend:
service:
name: {{ .Values.labels.consumer.name }}
port:
number: {{ .Values.ports.consumer }}
- http:
paths:
- path: /
Expand Down
4 changes: 2 additions & 2 deletions infra/art-peace-infra/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ apibara:
authToken: dna_aabbcc

contracts:
artPeace: 0x075ceac501d747749d289cd588f07601b3caad223f4fcfcc803a77311118b1cf
artPeace: 0x0465839f32ba6b9969d4e08e508e432fd136d019fcc078a06691807a7b22eb47
usernameStore: 0x073128a9f7b38d2bcdb6c1f9ef4fea357de4dfe2fab5832c1e7b51e9aae97c51
nft: 0x072f12a6056df3e4c683d3a7fba1e1a1a702c51e1b1928fb058e91294c738984
nft: 0x01db23066e7d6d65cf5b8dfe0f0e1591b5c34a4585108464dbe12e7c7850437b
4 changes: 2 additions & 2 deletions tests/integration/sepolia/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ echo "Contract class hash: $ART_PEACE_CONTRACT_CLASSHASH"

# Deploying the contract
CANVAS_CONFIG=$PROJECT_ROOT/configs/canvas.config.json
QUESTS_CONFIG=$PROJECT_ROOT/configs/quests.config.json
QUESTS_CONFIG=$PROJECT_ROOT/configs/production-quests.config.json

ACCOUNT_ADDRESS=$(cat $STARKNET_ACCOUNT | jq -r '.deployment.address')
WIDTH=$(jq -r '.canvas.width' $CANVAS_CONFIG)
Expand All @@ -104,7 +104,7 @@ COLORS=$(jq -r '.colors[]' $CANVAS_CONFIG | sed 's/^/0x/')
VOTABLE_COLOR_COUNT=$(jq -r '.votableColors[]' $CANVAS_CONFIG | wc -l | tr -d ' ')
VOTABLE_COLORS=$(jq -r '.votableColors[]' $CANVAS_CONFIG | sed 's/^/0x/')
DAILY_NEW_COLORS_COUNT=3
END_TIME=1717165800
END_TIME=1719296301
DEVNET_MODE=0

DAILY_QUESTS_COUNT=$(jq -r '.daily.dailyQuestsCount' $QUESTS_CONFIG)
Expand Down