blob: 6fa385e10961e4fa5a548987578e93c339e419b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
SSH_CONFIG ?= ssh.config
.PHONY: run deploy fetchBotLogs registerBot listBots unregisterBot fetchThinkKey fetchTeamToken
run:
PYTHONPATH=gen uv run uvicorn app.main:app --port $(PORT) --host 0.0.0.0
deploy:
ifndef TEAM
$(error TEAM is not set)
endif
ifndef NAME
$(error NAME is not set)
endif
ifndef PORT
$(error PORT is not set)
endif
ifeq ($(shell test "$(PORT)" -lt 8001 -o "$(PORT)" -gt 8003 2>/dev/null; echo $$?),0)
$(error PORT must be between 8001 and 8003)
endif
./deploy.sh $(TEAM) $(NAME) $(PORT) $(SSH_CONFIG)
fetchBotLogs:
ifndef TEAM
$(error TEAM is not set)
endif
ifndef PORT
$(error PORT is not set)
endif
@ssh -F $(SSH_CONFIG) $(TEAM) "cat ~/hackathon/$(PORT)/server.log" && echo
registerBot:
ifndef NAME
$(error NAME is not set)
endif
ifndef TOKEN
$(error TOKEN is not set)
endif
ifndef PORT
$(error PORT is not set)
endif
ifeq ($(shell test "$(PORT)" -lt 8001 -o "$(PORT)" -gt 8003 2>/dev/null; echo $$?),0)
$(error PORT must be between 8001 and 8003)
endif
@curl -s -X POST https://hackathon.evroc.dev/api/codenames.v1.GameService/RegisterBot \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(TOKEN)" \
-d '{"identityKey": "$(NAME)", "port": "$(PORT)"}'
listBots:
@curl -s -X POST https://hackathon.evroc.dev/api/codenames.v1.GameService/ListBots \
-H "Content-Type: application/json" \
-d '{}'
unregisterBot:
ifndef TOKEN
$(error TOKEN is not set)
endif
ifndef BOT_ID
$(error BOT_ID is not set)
endif
@curl -s -X POST https://hackathon.evroc.dev/api/codenames.v1.GameService/UnregisterBot \
-H "Authorization: Bearer $(TOKEN)" \
-H "Content-Type: application/json" \
-d '{"botId": "$(BOT_ID)"}'
fetchThinkKey:
ifndef TEAM
$(error TEAM is not set)
endif
@ssh -F $(SSH_CONFIG) $(TEAM) "cat /etc/codenames/think_key" && echo
fetchTeamToken:
ifndef TEAM
$(error TEAM is not set)
endif
@ssh -F $(SSH_CONFIG) $(TEAM) "cat /etc/codenames/game_key" && echo
|