Skip to content

Commit 662b607

Browse files
committed
deploy
1 parent 1dc281a commit 662b607

8 files changed

Lines changed: 159 additions & 28 deletions

File tree

.github/workflows/docker.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: xetera/pandemic
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
actions: write
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Log in to GHCR
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Extract metadata
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
37+
tags: |
38+
type=sha,prefix=,format=short
39+
type=raw,value=latest,enable={{is_default_branch}}
40+
41+
- name: Build and push
42+
uses: docker/build-push-action@v6
43+
with:
44+
context: .
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}
48+
cache-from: type=gha
49+
cache-to: type=gha,mode=max

app/components/DiseasePanel.vue

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { ref, computed } from "vue";
2+
import { ref, computed, onMounted, onUnmounted } from "vue";
33
44
interface Trait {
55
name: string;
@@ -108,6 +108,17 @@ function handlePointerDown(e: PointerEvent) {
108108
isTouch.value = true;
109109
}
110110
}
111+
112+
function handleDocumentClick(e: MouseEvent) {
113+
if (!isTouch.value || !tooltip.value) return;
114+
const target = e.target as Element;
115+
if (!target.closest(".trait-btn")) {
116+
tooltip.value = null;
117+
}
118+
}
119+
120+
onMounted(() => document.addEventListener("click", handleDocumentClick, true));
121+
onUnmounted(() => document.removeEventListener("click", handleDocumentClick, true));
111122
</script>
112123

113124
<template>
@@ -218,33 +229,18 @@ function handlePointerDown(e: PointerEvent) {
218229
</div>
219230

220231
<PanelSection label="DISEASE INFORMATION">
221-
<div class="flex flex-wrap justify-between gap-2 mb-3">
222-
<div class="flex items-baseline gap-2">
223-
<span
224-
class="text-[11px] font-bold tracking-widest text-[#bbb] uppercase"
225-
>EVOLUTION POINTS</span
226-
>
227-
<span class="text-lg text-[#888] font-bold">{{
228-
disease.evolutionPoints
229-
}}</span>
230-
</div>
231-
<div class="flex items-baseline gap-2">
232-
<span
233-
class="text-[11px] font-bold tracking-widest text-[#bbb] uppercase"
234-
>AVERAGE INFECTIONS A DAY</span
235-
>
236-
<span class="text-lg text-[#888] font-bold">{{
237-
disease.avgInfectionsPerDay
238-
}}</span>
239-
</div>
240-
<div class="flex items-baseline gap-2">
241-
<span
242-
class="text-[11px] font-bold tracking-widest text-[#bbb] uppercase"
243-
>AVERAGE DEATHS A DAY</span
244-
>
245-
<span class="text-lg text-[#888] font-bold">{{
246-
disease.avgDeathsPerDay
247-
}}</span>
232+
<div class="grid grid-cols-2 md:grid-cols-3 gap-x-2 gap-y-3 mb-3">
233+
<div
234+
v-for="[label, val] in [
235+
['EVOLUTION POINTS', disease.evolutionPoints],
236+
['AVERAGE INFECTIONS A DAY', disease.avgInfectionsPerDay],
237+
['AVERAGE DEATHS A DAY', disease.avgDeathsPerDay],
238+
]"
239+
:key="label"
240+
class="flex items-baseline gap-2 flex-wrap"
241+
>
242+
<span class="font-bold tracking-wide text-[#ddd] uppercase">{{ label }}</span>
243+
<span class="text-[#888] font-bold">{{ val }}</span>
248244
</div>
249245
</div>
250246
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4">

deploy/kustomization.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
resources:
5+
- ./manifests

deploy/manifests/deployment.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: pandemic
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: pandemic
9+
template:
10+
metadata:
11+
labels:
12+
app: pandemic
13+
spec:
14+
imagePullSecrets:
15+
- name: ghcr-credentials
16+
containers:
17+
- name: pandemic
18+
image: ghcr.io/xetera/pandemic:latest
19+
imagePullPolicy: Always
20+
resources:
21+
requests:
22+
memory: "128Mi"
23+
cpu: "100m"
24+
limits:
25+
memory: "256Mi"
26+
cpu: "200m"
27+
ports:
28+
- name: http
29+
containerPort: 3000
30+
livenessProbe:
31+
httpGet:
32+
path: /health
33+
port: 3000
34+
initialDelaySeconds: 30
35+
periodSeconds: 10
36+
timeoutSeconds: 5
37+
readinessProbe:
38+
httpGet:
39+
path: /health
40+
port: 3000
41+
initialDelaySeconds: 5
42+
periodSeconds: 10
43+
timeoutSeconds: 20

deploy/manifests/ingressroute.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: traefik.io/v1alpha1
2+
kind: IngressRoute
3+
metadata:
4+
name: pandemic
5+
spec:
6+
entryPoints:
7+
- websecure
8+
routes:
9+
- match: Host(`hantavirus.xetera.dev`)
10+
priority: 10
11+
services:
12+
- name: pandemic
13+
port: 3000
14+
middlewares:
15+
- name: ingress-cloudflare-only@kubernetescrd
16+
tls:
17+
options:
18+
name: ingress-cloudflare-mtls@kubernetescrd
19+
secretName: cloudflare-origin-xetera.dev
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
namespace: default
5+
resources:
6+
- ./deployment.yaml
7+
- ./service.yaml
8+
- ./ingressroute.yaml

deploy/manifests/service.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: pandemic
5+
spec:
6+
selector:
7+
app: pandemic
8+
ports:
9+
- port: 3000
10+
targetPort: 3000

server/routes/health.get.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default defineEventHandler(() => ({ status: "ok" }))

0 commit comments

Comments
 (0)