Skip to content

Commit 9e81510

Browse files
author
Max Azatian
committed
- ui improvements (better logo, styles, meta tags)
- fixed work on linux
1 parent d6fe5ea commit 9e81510

File tree

19 files changed

+322
-46
lines changed

19 files changed

+322
-46
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<img src="./files_for_readme/logo.png" alt="Integr8sCode Logo" width="200" height="200">
2+
<img src="./files_for_readme/logo.png" alt="Integr8sCode Logo" width="250" height="250">
33
<h1 align="center"><b>Integr8sCode</b></h1>
44
</p>
55
<p align="center">

backend/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ WORKDIR /app
55
RUN apt-get update && apt-get upgrade -y liblzma-dev liblzma5 xz-utils && \
66
rm -rf /var/lib/apt/lists/*
77

8-
# Install kubectl
9-
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
10-
&& chmod +x kubectl && mv kubectl /usr/local/bin/
8+
# Install kubectl (lightweight)
9+
RUN wget -q "https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl" -O /usr/local/bin/kubectl && \
10+
chmod +x /usr/local/bin/kubectl
1111

1212
# Install Python dependencies
1313
COPY requirements.txt .

cert-generator/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM alpine:3.17
22

33
# Install required packages and tools for all architectures
4-
RUN apk add --no-cache wget ca-certificates openssl curl dos2unix && \
4+
RUN apk add --no-cache wget ca-certificates openssl curl dos2unix netcat-openbsd && \
55
update-ca-certificates && \
66
# Detect architecture and install appropriate binaries
77
ARCH=$(uname -m); \

cert-generator/setup-k8s.sh

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,53 @@ else
1616
fi
1717
echo "--- End Debug Info ---"
1818

19+
# Function to detect the correct host IP for k3s access from Docker
20+
detect_docker_host_ip() {
21+
# First check if K3S_HOST_IP environment variable is explicitly set
22+
if [ -n "$K3S_HOST_IP" ]; then
23+
echo "$K3S_HOST_IP"
24+
return
25+
fi
26+
27+
# Try host.docker.internal first (works on Docker Desktop for Mac/Windows)
28+
if getent hosts host.docker.internal > /dev/null 2>&1; then
29+
echo "host.docker.internal"
30+
return
31+
fi
32+
33+
# If host.docker.internal doesn't work, try to ping it to see if it resolves
34+
if ping -c 1 host.docker.internal > /dev/null 2>&1; then
35+
echo "host.docker.internal"
36+
return
37+
fi
38+
39+
# Check if we're using host networking (no .dockerenv means host network)
40+
if [ ! -f /.dockerenv ]; then
41+
echo "127.0.0.1"
42+
return
43+
fi
44+
45+
# Fall back to Docker bridge gateway (typically Linux)
46+
echo "172.17.0.1"
47+
}
48+
1949
if [ "$CI" = "true" ] && [ -f /root/.kube/config ]; then
2050
echo "CI environment detected. Creating a patched kubeconfig..."
2151
# Read from the read-only original and write the patched version to our new file
2252
sed 's|server: https://127.0.0.1:6443|server: https://host.docker.internal:6443|g' /root/.kube/config > "${WRITABLE_KUBECONFIG_DIR}/config"
23-
24-
# Point the KUBECONFIG variable to our new, writable, and patched file
25-
export KUBECONFIG="${WRITABLE_KUBECONFIG_DIR}/config"
53+
elif [ -f /root/.kube/config ] && grep -q "server:" /root/.kube/config; then
54+
echo "Detected kubeconfig with k3s/k8s. Patching for Docker access..."
55+
# For non-CI environments, we need to ensure k3s is accessible from within Docker
56+
# Try to detect if we're in Docker and k3s is on the host
57+
if [ -f /.dockerenv ]; then
58+
# We're in a Docker container - need to patch the config
59+
DOCKER_HOST_IP=$(detect_docker_host_ip)
60+
echo "Detected Docker host IP: ${DOCKER_HOST_IP}"
61+
62+
sed "s|server: https://[^:]*:6443|server: https://${DOCKER_HOST_IP}:6443|g" /root/.kube/config > "${WRITABLE_KUBECONFIG_DIR}/config"
63+
echo "Patched kubeconfig to use ${DOCKER_HOST_IP} for k3s access from Docker"
64+
export KUBECONFIG="${WRITABLE_KUBECONFIG_DIR}/config"
65+
fi
2666

2767
echo "Kubeconfig patched and new config is at ${KUBECONFIG}."
2868
echo "--- Patched Kubeconfig Contents ---"
@@ -60,6 +100,12 @@ openssl req -x509 -newkey rsa:2048 -nodes \
60100
cp "$BACKEND_CERT_DIR/server.crt" "$FRONTEND_CERT_DIR/server.crt"
61101
cp "$BACKEND_CERT_DIR/server.key" "$FRONTEND_CERT_DIR/server.key"
62102

103+
# Copy the certificate to shared CA directory so frontend proxy can trust it
104+
if [ -n "$SHARED_CA_DIR" ]; then
105+
cp "$BACKEND_CERT_DIR/server.crt" "$SHARED_CA_DIR/mkcert-ca.pem"
106+
echo "Certificate copied to shared CA directory"
107+
fi
108+
63109
echo "Self-signed certificate created and copied."
64110

65111

@@ -109,6 +155,15 @@ roleRef:
109155
EOF
110156
TOKEN=$(kubectl create token integr8scode-sa -n default --duration=24h)
111157
K8S_SERVER=$(kubectl config view --raw -o jsonpath='{.clusters[0].cluster.server}')
158+
# When running in Docker, need to use appropriate host IP
159+
if [ -f /.dockerenv ]; then
160+
DOCKER_HOST_IP=$(detect_docker_host_ip)
161+
K8S_SERVER=$(echo "$K8S_SERVER" | sed "s|https://[^:]*:|https://${DOCKER_HOST_IP}:|")
162+
echo "Running in Docker, using ${DOCKER_HOST_IP} for k3s server"
163+
else
164+
# Otherwise use localhost
165+
K8S_SERVER=$(echo "$K8S_SERVER" | sed 's|https://[^:]*:|https://127.0.0.1:|')
166+
fi
112167
cat > /backend/kubeconfig.yaml <<EOF
113168
apiVersion: v1
114169
kind: Config

files_for_readme/logo.png

-968 KB
Loading

frontend/nginx.conf

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
server {
2+
listen 5001;
3+
server_name _;
4+
5+
root /usr/share/nginx/html;
6+
index index.html;
7+
8+
# Enable gzip compression
9+
gzip on;
10+
gzip_vary on;
11+
gzip_min_length 1024;
12+
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json application/x-font-ttf font/opentype image/svg+xml image/x-icon;
13+
gzip_disable "msie6";
14+
15+
location /api/ {
16+
proxy_pass https://backend:443;
17+
proxy_ssl_verify off;
18+
proxy_set_header Host $host;
19+
proxy_set_header X-Real-IP $remote_addr;
20+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
21+
proxy_set_header X-Forwarded-Proto $scheme;
22+
}
23+
24+
# Cache static assets
25+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
26+
expires 1y;
27+
add_header Cache-Control "public, immutable";
28+
add_header X-Content-Type-Options "nosniff";
29+
}
30+
31+
# Cache build directory assets with long expiry
32+
location /build/ {
33+
expires 1y;
34+
add_header Cache-Control "public, max-age=31536000, immutable";
35+
add_header X-Content-Type-Options "nosniff";
36+
}
37+
38+
# HTML files should not be cached
39+
location ~* \.html$ {
40+
expires -1;
41+
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
42+
}
43+
44+
location / {
45+
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';";
46+
add_header X-Frame-Options "SAMEORIGIN";
47+
add_header X-Content-Type-Options "nosniff";
48+
add_header Referrer-Policy "strict-origin-when-cross-origin";
49+
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()";
50+
try_files $uri $uri/ /index.html;
51+
}
52+
}

frontend/public/favicon.png

108 KB
Loading

frontend/public/global.css

Whitespace-only changes.

frontend/public/index.html

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,44 @@
55
<meta name='viewport' content='width=device-width,initial-scale=1'>
66

77
<title>Integr8sCode</title>
8+
<meta name="description" content="Integr8sCode - Write, compile, and manage code directly in your browser with our powerful online development environment">
89

910
<link rel='icon' type='image/png' href='/favicon.png'>
10-
<link rel='stylesheet' href='/global.css'>
11-
<link rel='stylesheet' href='/build/bundle.css'>
1211

12+
<style>
13+
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; }
14+
.app-container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }
15+
header { position: fixed; top: 0; left: 0; right: 0; z-index: 50; }
16+
main { padding-top: 6rem; }
17+
/* Prevent layout shift */
18+
img { max-width: 100%; height: auto; }
19+
@media (prefers-color-scheme: dark) {
20+
body { background-color: #0f172a; color: #e2e8f0; }
21+
}
22+
</style>
23+
24+
<link rel="preload" href="/build/bundle.css" as="style">
25+
<link rel="stylesheet" href="/build/bundle.css" media="print" onload="this.media='all'; this.onload=null;">
26+
<noscript><link rel="stylesheet" href="/build/bundle.css"></noscript>
1327
<script type="module" src='/build/main.js'></script>
1428
</head>
1529

1630
<body>
31+
<div id="app-loading" style="min-height: 100vh; display: flex; align-items: center; justify-content: center;">
32+
<div style="text-align: center;">
33+
<div style="width: 40px; height: 40px; border: 3px solid #f3f4f6; border-top-color: #3b82f6; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto;"></div>
34+
<style>
35+
@keyframes spin { to { transform: rotate(360deg); } }
36+
</style>
37+
</div>
38+
</div>
39+
<script>
40+
window.addEventListener('DOMContentLoaded', () => {
41+
setTimeout(() => {
42+
const loader = document.getElementById('app-loading');
43+
if (loader) loader.style.display = 'none';
44+
}, 100);
45+
});
46+
</script>
1747
</body>
1848
</html>

frontend/public/robots.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
User-agent: *
2+
Allow: /$
3+
Allow: /editor$
4+
Allow: /login$
5+
Allow: /register$
6+
Disallow: /api/
7+
Disallow: /build/
8+
Disallow: /*.js$
9+
Disallow: /*.css$
10+
Disallow: /*.map$
11+
Disallow: /certs/
12+
Disallow: /node_modules/
13+
Disallow: /src/
14+
Disallow: /scripts/
15+
16+
Sitemap: https://app.integr8scode.cc/sitemap.xml

0 commit comments

Comments
 (0)