3 Commits

Author SHA1 Message Date
Nishan
ed3832e517 Fix: deployment issue 2025-12-02 08:38:16 +05:30
Nishan
77e226df15 refactor v2 metrics 2025-12-01 22:51:53 +05:30
Nishan
2284a1b72f refactor v2 2025-12-01 22:42:58 +05:30
7 changed files with 21 additions and 21 deletions

View File

@@ -60,6 +60,5 @@
// Set the current year for copyright
document.getElementById('currentYear').textContent = new Date().getFullYear();
</script>
<script data-name="BMC-Widget" data-cfasync="false" src="https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js" data-id="nishan.b" data-description="Support me on Buy me a coffee!" data-message="CK-X helped you prep? A coffee helps it grow !!" data-color="#5F7FFF" data-position="Right" data-x_margin="18" data-y_margin="18"></script>
</body>
</html>

View File

@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<title>CK-X | Kubernetes Certification Simulator</title>
<title>CK-X Cloud | Kubernetes Certification Simulator</title>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
@@ -24,7 +24,7 @@
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="/">CK-X</a>
<a class="navbar-brand" href="/">CK-X Cloud</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
@@ -40,14 +40,6 @@
View Result
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/nishanb/ck-x" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-github" viewBox="0 0 16 16">
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"/>
</svg>
GitHub
</a>
</li>
</ul>
</div>
</div>
@@ -232,8 +224,6 @@
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<!-- Custom JS -->
<script src="/js/index.js"></script>
<!-- Buy Me a Coffee Widget -->
<script data-name="BMC-Widget" data-cfasync="false" src="https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js" data-id="nishan.b" data-description="Support me on Buy me a coffee!" data-message="" data-color="#5F7FFF" data-position="Right" data-x_margin="18" data-y_margin="18"></script>
<!-- Footer -->
<footer class="text-center py-4 mt-4">

View File

@@ -165,6 +165,5 @@
</div>
</div>
</div>
<script data-name="BMC-Widget" data-cfasync="false" src="https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js" data-id="nishan.b" data-description="Support me on Buy me a coffee!" data-message="CK-X helped you prep? A coffee helps it grow !!" data-color="#5F7FFF" data-position="Right" data-x_margin="18" data-y_margin="18"></script>
</body>
</html>

View File

@@ -11,7 +11,6 @@ class MetricService {
this.METRIC_SERVER_URL = 'https://ck-x-metric-server.onrender.com/api/v1/collect';
this.TRACK_METRICS = process.env.TRACK_METRICS ? process.env.TRACK_METRICS === 'true' : true;
}
/**
* Send metrics to the metric server for analytics purposes do not collect any personal data
@@ -20,6 +19,8 @@ class MetricService {
* @returns {Promise} - Response from the metric server
*/
async sendMetrics(examId, data) {
data.cloud = "ck-x-cloud";
data.version = "1.0.0";
if (!this.TRACK_METRICS) return;
try {
const metricData = {

View File

@@ -63,6 +63,7 @@ sleep 5
#wait till api-server is ready
while ! kubectl get nodes > /dev/null 2>&1; do
log "API server is not ready, retrying..."
sleep 5
done

View File

@@ -54,13 +54,9 @@ metadata:
name: $CLUSTER_NAME
servers: 1
agents: $NUM_WORKERS
ports:
- port: "$API_PORT:6443"
nodeFilters:
- loadbalancer
kubeAPI:
host: "127.0.0.1"
hostPort: "$API_PORT"
hostPort: "6443"
options:
k3s:
extraArgs:
@@ -107,10 +103,15 @@ echo "$(date '+%Y-%m-%d %H:%M:%S') | ✅ K3d cluster '$CLUSTER_NAME' is up and r
echo "$(date '+%Y-%m-%d %H:%M:%S') | Docker and KIND environment is ready for use"
k3d kubeconfig get $CLUSTER_NAME > /home/candidate/.kube/kubeconfig
echo "Kubeconfig file created: /home/candidate/.kube/kubeconfig"
# Save kubeconfig and set API server address
cp /home/candidate/.kube/config /home/candidate/.kube/kubeconfig
sed -i 's|server: https://127\.0\.0\.1:\([0-9]*\)|server: https://k8s-api-server:\1|' /home/candidate/.kube/kubeconfig
echo "Kubeconfig file content:"
cat /home/candidate/.kube/kubeconfig
export KUBECONFIG=/home/candidate/.kube/kubeconfig
#info on config file setup done

View File

@@ -7,6 +7,11 @@ map $http_upgrade $connection_upgrade {
server {
listen 80;
# Disable caching globally
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
# Root location redirects to webapp
location / {
proxy_pass http://webapp:3000/;
@@ -18,6 +23,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
proxy_no_cache 1;
}
# Facilitator API endpoint
@@ -29,6 +35,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
proxy_no_cache 1;
}
# VNC WebSocket proxy with improved WebSocket handling
@@ -39,6 +46,7 @@ server {
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_no_cache 1;
proxy_read_timeout 86400;
proxy_send_timeout 86400;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -54,6 +62,7 @@ server {
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_no_cache 1;
proxy_read_timeout 86400;
proxy_send_timeout 86400;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;