Skip to content

Commit

Permalink
fix: update charts
Browse files Browse the repository at this point in the history
  • Loading branch information
muandane committed Jun 26, 2024
1 parent d110412 commit 97a646d
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 96 deletions.
19 changes: 15 additions & 4 deletions apps/mule/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ RUN --mount=type=bind,source=src,target=src \
--mount=type=cache,target=/app/target/ \
--mount=type=cache,target=/usr/local/cargo/git/db \
--mount=type=cache,target=/usr/local/cargo/registry/ \
cargo build --locked --release && \
cargo build --release && \
cp ./target/release/$APP_NAME /bin/server

################################################################################
Expand All @@ -51,7 +51,8 @@ FROM cgr.dev/chainguard/wolfi-base:latest AS final
RUN apk update && apk add --no-cache libgcc
# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
ARG UID=1000

RUN adduser \
--disabled-password \
--gecos "" \
Expand All @@ -60,11 +61,21 @@ RUN adduser \
--no-create-home \
--uid "${UID}" \
mule
USER mule

# Copy the executable from the "build" stage.
ENV CDN_ROOT=/data/content
ENV DB_PATH=/data/db

RUN mkdir -p /data/content /data/db && \
chown -R mule:mule /data && \
chmod -R 755 /data

COPY --from=build /bin/server /bin/

VOLUME ["/data/content", "/data/db"]

USER mule
# Copy the executable from the "build" stage.

# Expose the port that the application listens on.
EXPOSE 3000

Expand Down
13 changes: 9 additions & 4 deletions apps/wopper/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<script>
/*const backgroundUrl = import.meta.env.VITE_EPIC_GIF;
const imageText = import.meta.env.VITE_EPIC_NAME;*/
import 'dotenv/config';
const backgroundUrl = process.env.PUBLIC_EPIC_GIF;
const imageText = process.env.PUBLIC_EPIC_NAME;
const backgroundUrl = import.meta.env.VITE_EPIC_GIF;
const imageText = import.meta.env.VITE_EPIC_NAME;
// import 'dotenv/config';
import LatencyCounter from './HUD.svelte';
// const backgroundUrl = process.env.PUBLIC_EPIC_GIF;
// const imageText = process.env.PUBLIC_EPIC_NAME;
</script>


<div class="container">
<p>{imageText}</p>
</div>
Expand Down Expand Up @@ -38,6 +42,7 @@
</div>
</div>

<LatencyCounter {backgroundUrl} />
<style>
:root {
--min-fs: 0.5;
Expand All @@ -47,7 +52,7 @@
--min-fs-rem: calc(var(--min-fs) * 1rem);
--max-fs-rem: calc(var(--max-fs) * 1rem);
--min-vw-rem: calc(var(--min-vw) * 1vw);
--min-vw-rem: calc(var(--min-vw) * 0.1vw);
--slope: calc((var(--max-fs) - var(--min-fs)) * (100vw - var(--min-vw-rem)) / (var(--max-vw) - var(--min-vw)));
Expand Down
111 changes: 111 additions & 0 deletions apps/wopper/src/routes/HUD.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<script>
import { onMount } from 'svelte';
/** @type {string} */
export let backgroundUrl;
/** @type {number | null} */
let latency = null;
/** @type {number | null} */
let serverLatency = null;
/** @type {string | null} */
let serverLocation = null;
async function measureLatency() {
try {
// Measure latency for backgroundUrl
const startTime = performance.now();
const response = await fetch(backgroundUrl);
const endTime = performance.now();
latency = endTime - startTime;
if (!response.ok) {
throw new Error('Failed to fetch background URL');
}
// Measure latency for the server
const serverStartTime = performance.now();
const serverEndTime = performance.now();
serverLatency = serverEndTime - serverStartTime;
const serverResponse = await fetch('https://worldtimeapi.org/api/ip');
if (!serverResponse.ok) {
throw new Error('Failed to fetch server data');
}
const serverData = await serverResponse.json();
serverLocation = serverData.timezone;
} catch (error) {
console.error('Error measuring latency:', error);
latency = serverLatency = -1; // Use -1 to indicate an error
serverLocation = 'Error';
}
}
onMount(measureLatency);
</script>

<style>
:root {
--min-l-fs: 0.5;
--max-l-fs: 2.5;
--min-s-fs: 0.2;
--max-s-fs: 2.2;
--min-vw: 10;
--max-vw: 40;
--min-fs-l-rem: calc(var(--min-l-fs) * 0.8rem);
--max-fs-l-rem: calc(var(--max-l-fs) * 0.8rem);
--min-fs-s-rem: calc(var(--min-s-fs) * 0.5rem);
--max-fs-s-rem: calc(var(--max-s-fs) * 0.5rem);
--min-vw-rem: calc(var(--min-vw) * 0.1vw);
--l-slope: calc((var(--max-l-fs) - var(--min-l-fs)) * (50vw - var(--min-vw-rem)) / (var(--max-vw) - var(--min-vw)));
--s-slope: calc((var(--max-s-fs) - var(--min-s-fs)) * (30vw - var(--min-vw-rem)) / (var(--max-vw) - var(--min-vw)));
--font-size-large: clamp(var(--min-fs-l-rem), var(--min-fs-l-rem) + var(--l-slope), var(--max-fs-l-rem));
--font-size-small: clamp(var(--min-fs-s-rem), var(--min-fs-s-rem) + var(--s-slope), var(--max-fs-s-rem));
}
.latency-counter {
font-family: 'Courier New', Courier, monospace;
color: #00ff00;
background-color: rgba(5, 47, 46, 0.434);
padding: 10px;
border-radius: 5px;
position: fixed;
top: 20px;
left: 20px;
z-index: 1000;
width: clamp(140px, 25vw, 350px); /* Adjusted for better responsiveness */
height: auto; /* Auto height to fit content */
max-height: 150px;
overflow-wrap: break-word;
word-break: break-all;
display: flex;
flex-direction: column;
}
.latency-counter div {
margin: 5px 0;
white-space: nowrap;
overflow-wrap: break-word;
word-break: break-all;
}
.latency-counter .large {
font-size: var(--font-size-large);
}
.latency-counter .small {
font-size: var(--font-size-small);
}
</style>

<div class="latency-counter">
<div class="large">Latency Counter</div>
<div class="small">Client: {latency !== null ? latency.toFixed(2) + ' ms' : 'Calculating...'}</div>
<div class="small">Server Location: {serverLocation || 'Fetching...'}</div>
<div class="small">Server: {serverLatency !== null && serverLatency !== -1 ? serverLatency.toFixed(2) + ' ms' : 'Calculating...'}</div>
</div>
22 changes: 0 additions & 22 deletions k8s/mule/templates/add-gif.yaml

This file was deleted.

61 changes: 0 additions & 61 deletions k8s/mule/templates/ingress.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions k8s/mule/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ spec:
targetPort: http
protocol: TCP
name: http
- port: 9001
targetPort: http
protocol: TCP
name: managment
selector:
{{- include "mule.selectorLabels" . | nindent 4 }}
7 changes: 3 additions & 4 deletions k8s/mule/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ fullnameOverride: ""
podAnnotations: {}
podLabels: {}

podSecurityContext: {}
# fsGroup: 2000

podSecurityContext:
runAsUser: 0
securityContext: {}
# capabilities:
# drop:
Expand All @@ -33,7 +32,7 @@ service:
port: 3000

ingress:
enabled: false
enabled: true
className: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
Expand Down
2 changes: 1 addition & 1 deletion k8s/wopper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ image:
repository: muandane/wopper
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "2024.6.2-main"
tag: "24.6.3-main"

imagePullSecrets: []
nameOverride: ""
Expand Down

0 comments on commit 97a646d

Please sign in to comment.