summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2025-01-15 16:21:40 +0100
committerSanto Cariotti <santo@dcariotti.me>2025-01-15 16:21:40 +0100
commita51ba5d4857b6ceabf87482948a89667d9b58362 (patch)
treef76f0c7d78773b9a29819bd042237239ab73543c
parentf9f13898263aff70af604314904c4bddd57fd05f (diff)
Add frontend
-rw-r--r--README.md3
-rwxr-xr-xrun.sh3
-rw-r--r--yaml/configs/frontend.yaml6
-rw-r--r--yaml/deployments/frontend.yaml28
-rw-r--r--yaml/services/frontend.yaml11
5 files changed, 50 insertions, 1 deletions
diff --git a/README.md b/README.md
index aa91064..5ba01a3 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,8 @@ Now, you can proceed to set up some environment variables:
- `JWT_SECRET`: the base64 version of the secret used for JWT tokens.
- `EXPO_ACCESS_TOKEN`: the base64 version of the [Expo](https://expo.dev) access token.
- `UNREALSPEECH_TOKEN`: the base64 version of the [Unrealspeech](https://unrealspeech.com/) access token.
-- `RUST_LOG`: level of Rust logging
+- `RUST_LOG`: level of Rust logging.
+- `VITE_API_URL`: url for the backend API.
Meanwhile the followings are setted up by default.
diff --git a/run.sh b/run.sh
index ecfcccd..d9a203f 100755
--- a/run.sh
+++ b/run.sh
@@ -20,13 +20,16 @@ K8S_FOLDER="./yaml"
YAML_FILES=(
"configs/cas.yaml"
+ "configs/frontend.yaml"
"deployments/cas.yaml"
+ "deployments/frontend.yaml"
"secrets/cas.yaml"
"services/cas.yaml"
"policies/network.yaml"
"pvcs/pgdata.yaml"
"deployments/postgres.yaml"
"services/postgres.yaml"
+ "deployments/frontend.yaml"
"networking/balance.yaml"
)
diff --git a/yaml/configs/frontend.yaml b/yaml/configs/frontend.yaml
new file mode 100644
index 0000000..f80a790
--- /dev/null
+++ b/yaml/configs/frontend.yaml
@@ -0,0 +1,6 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: frontend-config
+data:
+ VITE_API_URL: ${VITE_API_URL}
diff --git a/yaml/deployments/frontend.yaml b/yaml/deployments/frontend.yaml
new file mode 100644
index 0000000..781bf87
--- /dev/null
+++ b/yaml/deployments/frontend.yaml
@@ -0,0 +1,28 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: frontend-deployment
+ labels:
+ app: frontend-app
+spec:
+ selector:
+ matchLabels:
+ app: frontend-app
+ template:
+ metadata:
+ labels:
+ app: frontend-app
+ spec:
+ containers:
+ - name: frontend
+ image: ghcr.io/cas-4/frontend:latest
+ imagePullPolicy: Always
+ ports:
+ - containerPort: 80
+ env:
+ - name: VITE_API_URL
+ valueFrom:
+ configMapKeyRef:
+ name: frontend-config
+ key: VITE_API_URL
+ restartPolicy: Always
diff --git a/yaml/services/frontend.yaml b/yaml/services/frontend.yaml
new file mode 100644
index 0000000..f5580ae
--- /dev/null
+++ b/yaml/services/frontend.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: frontend-service
+spec:
+ ports:
+ - port: 80
+ targetPort: 80
+ selector:
+ app: frontend-app
+ type: ClusterIP