diff --git a/.gitea/workflows/build-push-client.yml b/.gitea/workflows/build-push-client.yml new file mode 100644 index 0000000..00be3ab --- /dev/null +++ b/.gitea/workflows/build-push-client.yml @@ -0,0 +1,54 @@ +name: Build & Push Web Client + +on: + push: + branches: [main] + paths: + - "Client/origin-client/**" + - ".gitea/workflows/build-push-client.yml" + +env: + REGISTRY: registry.aeternalisgames.com + PROJECT: sor + +jobs: + build-and-push-client: + runs-on: ubuntu-22.04 + env: + DOCKER_HOST: tcp://172.17.0.1:2375 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check Docker + run: | + docker version + + - name: Compute image tag + id: tag + run: echo "SHA=$(echo '${{ github.sha }}' | cut -c1-8)" >> "$GITHUB_OUTPUT" + + - name: Login to Harbor + run: | + echo "${{ secrets.HARBOR_PASSWORD }}" | docker login "${{ env.REGISTRY }}" -u "${{ secrets.HARBOR_USERNAME }}" --password-stdin + + - name: Export Godot Web build + run: | + set -euo pipefail + docker run --rm \ + -v "$PWD/Client/origin-client:/project" \ + -w /project \ + barichello/godot-ci:4.2.2 \ + godot --headless --path /project --export-release "Web" build/web/index.html + + - name: Build and push sor-client image + run: | + set -euo pipefail + SHA='${{ steps.tag.outputs.SHA }}' + docker build -f Client/origin-client/Dockerfile.web \ + -t "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-client:${SHA}" \ + -t "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-client:latest" \ + Client/origin-client + docker push "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-client:${SHA}" + docker push "${{ env.REGISTRY }}/${{ env.PROJECT }}/sor-client:latest" diff --git a/Client/origin-client/Dockerfile.web b/Client/origin-client/Dockerfile.web new file mode 100644 index 0000000..dcf9334 --- /dev/null +++ b/Client/origin-client/Dockerfile.web @@ -0,0 +1,5 @@ +FROM nginx:1.27-alpine + +COPY build/web/ /usr/share/nginx/html/ + +EXPOSE 80 diff --git a/Client/origin-client/export_presets.cfg b/Client/origin-client/export_presets.cfg new file mode 100644 index 0000000..45c7bf5 --- /dev/null +++ b/Client/origin-client/export_presets.cfg @@ -0,0 +1,23 @@ +[preset.0] +name="Web" +platform="Web" +runnable=true +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="build/web/index.html" +script_export_mode=1 +script_encryption_key="" + +[preset.0.options] +vram_texture_compression/for_desktop=true +vram_texture_compression/for_mobile=true +html/export_icon=true +html/custom_html_shell="" +html/head_include="" +html/canvas_resize_policy=2 +html/focus_canvas_on_start=true +html/experimental_virtual_keyboard=false +progressive_web_app/enabled=false diff --git a/deploy/argo/webclient-application.yaml b/deploy/argo/webclient-application.yaml new file mode 100644 index 0000000..d3d92fe --- /dev/null +++ b/deploy/argo/webclient-application.yaml @@ -0,0 +1,24 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: sor-webclient + namespace: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + project: default + source: + repoURL: https://git.aeternalisgames.com/dingo/SOR.git + targetRevision: main + path: deploy/k8s-webclient + destination: + server: https://kubernetes.default.svc + namespace: stone-server + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=false + - ServerSideApply=true + revisionHistoryLimit: 5 diff --git a/deploy/k8s-webclient/deployment-webclient.yaml b/deploy/k8s-webclient/deployment-webclient.yaml new file mode 100644 index 0000000..5e674ff --- /dev/null +++ b/deploy/k8s-webclient/deployment-webclient.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: sor-webclient + namespace: stone-server + labels: + app: sor-webclient +spec: + replicas: 2 + selector: + matchLabels: + app: sor-webclient + template: + metadata: + labels: + app: sor-webclient + spec: + imagePullSecrets: + - name: harbor-credentials + containers: + - name: sor-webclient + image: registry.aeternalisgames.com/sor/sor-client:latest + imagePullPolicy: Always + ports: + - containerPort: 80 + resources: + requests: + cpu: "50m" + memory: "64Mi" + limits: + cpu: "250m" + memory: "256Mi" diff --git a/deploy/k8s-webclient/ingress-webclient.yaml b/deploy/k8s-webclient/ingress-webclient.yaml new file mode 100644 index 0000000..46e09a6 --- /dev/null +++ b/deploy/k8s-webclient/ingress-webclient.yaml @@ -0,0 +1,25 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: sor-webclient-ingress + namespace: stone-server + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-prod" + nginx.ingress.kubernetes.io/ssl-redirect: "true" +spec: + ingressClassName: nginx + tls: + - hosts: + - webclient.aeternalisgames.com + secretName: webclient-tls + rules: + - host: webclient.aeternalisgames.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: sor-webclient + port: + number: 80 diff --git a/deploy/k8s-webclient/service-webclient.yaml b/deploy/k8s-webclient/service-webclient.yaml new file mode 100644 index 0000000..f5951e8 --- /dev/null +++ b/deploy/k8s-webclient/service-webclient.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: sor-webclient + namespace: stone-server +spec: + selector: + app: sor-webclient + ports: + - name: http + protocol: TCP + port: 80 + targetPort: 80 + type: ClusterIP