diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f634464..145d8492 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -319,7 +319,7 @@ jobs: ECR_REPOSITORY: ${{ secrets.AWS_DISCORD_ECR_REPO_NAME }} IMAGE_TAG: latest run: | - docker tag spellbook-backend:latest $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker tag spellbook-discord-bot:latest $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - name: Rollout pods 🚀 diff --git a/backend/.kubernetes/kubernetes.yaml b/backend/.kubernetes/kubernetes.yaml index 5566e3ba..c94b39f2 100644 --- a/backend/.kubernetes/kubernetes.yaml +++ b/backend/.kubernetes/kubernetes.yaml @@ -264,3 +264,52 @@ roleRef: name: spellbook-ns-full-access apiGroup: rbac.authorization.k8s.io +--- + +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: spellbook + name: spellbook-discord-bot + labels: + app: spellbook-discord-bot +spec: + selector: + matchLabels: + app: spellbook-discord-bot + template: + metadata: + labels: + app: spellbook-discord-bot + spec: + serviceAccountName: app-service-account + containers: + - name: spellbook-discord-bot-app + image: 083767677168.dkr.ecr.us-east-2.amazonaws.com/spellbook-prod-discord-ecr + ports: + - containerPort: 80 + livenessProbe: + exec: + command: + - curl + - -f + - https://backend.commanderspellbook.com + initialDelaySeconds: 40 + periodSeconds: 20 + timeoutSeconds: 5 + env: + - name: KUBE_DISCORD_TOKEN + valueFrom: + secretKeyRef: + name: discord-bot-secrets + key: discord-token + - name: KUBE_ADMIN_USER__0 + valueFrom: + secretKeyRef: + name: discord-bot-secrets + key: deloo-discord-id + - name: KUBE_ADMIN_USER__1 + valueFrom: + secretKeyRef: + name: discord-bot-secrets + key: andy-discord-id \ No newline at end of file diff --git a/bot/discord/spellbook_discord.py b/bot/discord/spellbook_discord.py index e7897008..4b8e4a67 100644 --- a/bot/discord/spellbook_discord.py +++ b/bot/discord/spellbook_discord.py @@ -35,8 +35,8 @@ add_reactions=True, use_external_emojis=True, ) -administration_guilds = [int(guild) for guild in (os.getenv(f'ADMIN_GUILD__{i}') for i in range(10)) if guild is not None] -administration_users = [int(user) for user in (os.getenv(f'ADMIN_USER__{i}') for i in range(10)) if user is not None] +administration_guilds = [int(guild) for guild in (os.getenv(f'KUBE_ADMIN_GUILD__{i}', os.getenv(f'ADMIN_GUILD__{i}')) for i in range(10)) if guild is not None] +administration_users = [int(user) for user in (os.getenv(f'KUBE_ADMIN_USER__{i}', os.getenv(f'ADMIN_USER__{i}')) for i in range(10)) if user is not None] MAX_SEARCH_RESULTS = 7 @@ -346,4 +346,4 @@ async def find_my_combos(interaction: discord.Interaction, decklist: str | None await interaction.response.send_modal(FindMyCombosModal()) -bot.run(os.getenv('DISCORD_TOKEN', '')) +bot.run(os.getenv('KUBE_DISCORD_TOKEN', os.getenv('DISCORD_TOKEN', '')))