Skip to content

Commit

Permalink
Merge pull request #279 from keep-starknet-strange/feat/websockets
Browse files Browse the repository at this point in the history
Websocket deployment
  • Loading branch information
b-j-roberts authored Jan 16, 2025
2 parents 53a0683 + 0051459 commit a0b96b3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ docker-build:
docker build . -f backend/Dockerfile.prod -t "brandonjroberts/art-peace-backend:$(APP_VERSION)-$(COMMIT_SHA)"
@echo "Building consumer..."
docker build . -f backend/Dockerfile.consumer.prod -t "brandonjroberts/art-peace-consumer:$(APP_VERSION)-$(COMMIT_SHA)"
@echo "Building websocket..."
docker build . -f backend/Dockerfile.websocket.prod -t "brandonjroberts/art-peace-websocket:$(APP_VERSION)-$(COMMIT_SHA)"
@echo "Building indexer..."
docker build . -f indexer/Dockerfile.prod -t "brandonjroberts/art-peace-indexer:$(APP_VERSION)-$(COMMIT_SHA)"

Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile.websocket.prod
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ COPY ./backend .
# Build the app & run it
RUN go build -o web-sockets ./cmd/web-sockets/web-sockets.go

EXPOSE 8082
EXPOSE 8083

CMD ["./web-sockets"]
7 changes: 7 additions & 0 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ function App() {
}
} else {
setIsHome(true);
if (!worldsMode) {
setOpenedWorldId(null);
return;
}
try {
const response = await fetchWrapper('get-world?worldId=0');
if (response.data) {
Expand All @@ -81,6 +85,9 @@ function App() {
}
}

if (!worldsMode) {
return;
}
// Always fetch surrounding worlds
const surroundingResponse = await fetchWrapper('get-home-worlds');
if (surroundingResponse.data) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/canvas/CanvasContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ const CanvasContainer = (props) => {
useEffect(() => {
if (hasInit) return;
const containerRect = canvasContainerRef.current.getBoundingClientRect();
console.log(containerRect);
const adjustX = ((canvasScale - 1) * props.width) / 2;
const adjustY = ((canvasScale - 1) * props.height) / 2;
setCanvasX(containerRect.width / 2 - adjustX);
Expand Down Expand Up @@ -854,7 +853,8 @@ const CanvasContainer = (props) => {
width: props.width * canvasScale,
height: props.height * canvasScale
}}
disabled={true}
colors={props.colors}
pixelClicked={pixelClicked}
/>
<h2
className='CanvasContainer__title CanvasContainer__title--worlds'
Expand Down
8 changes: 4 additions & 4 deletions infra/art-peace-infra/templates/backend/backend-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ spec:
pathType: Exact
backend:
service:
name: {{ .Values.labels.consumer.name }}
name: {{ .Values.labels.websocket.name }}
port:
number: {{ .Values.ports.consumer }}
number: {{ .Values.ports.websocket }}
- path: /nft-images
pathType: Prefix
backend:
Expand Down Expand Up @@ -49,9 +49,9 @@ spec:
pathType: Exact
backend:
service:
name: {{ .Values.labels.consumer.name }}
name: {{ .Values.labels.websocket.name }}
port:
number: {{ .Values.ports.consumer }}
number: {{ .Values.ports.websocket }}
- path: /
pathType: Prefix
backend:
Expand Down
6 changes: 6 additions & 0 deletions infra/art-peace-infra/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ labels:
name: admin-backend
consumer:
name: consumer
websocket:
name: websocket
indexer:
name: indexer

Expand All @@ -17,6 +19,7 @@ ports:
postgres: 5432
backend: 8080
adminBackend: 8082
websocket: 8083
consumer: 8081

volumes:
Expand Down Expand Up @@ -63,6 +66,9 @@ deployments:
consumer:
replicas: 1
image: brandonjroberts/art-peace-consumer
websocket:
replicas: 1
image: brandonjroberts/art-peace-websocket
indexer:
replicas: 1
image: brandonjroberts/art-peace-indexer
Expand Down

0 comments on commit a0b96b3

Please sign in to comment.