File tree Expand file tree Collapse file tree
helm-charts/alphatrion/templates Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,13 @@ COPY --from=build /app/static/assets /usr/share/caddy/static/assets
1919
2020COPY Caddyfile /etc/caddy/Caddyfile
2121
22+ # Copy and setup entrypoint script
23+ COPY docker-entrypoint.sh /usr/local/bin/
24+ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
25+
2226# Switch to non-root user
2327USER caddy
2428
25- EXPOSE 8080
29+ EXPOSE 8080
30+
31+ ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e
3+
4+ # Write config.json with userId and teamId from environment variables
5+ cat > /usr/share/caddy/config.json << EOF
6+ {
7+ "userId": "${ALPHATRION_DASHBOARD_USER_ID:- } ",
8+ "teamId": "${ALPHATRION_DASHBOARD_TEAM_ID:- } "
9+ }
10+ EOF
11+
12+ echo " Created config.json with userId=${ALPHATRION_DASHBOARD_USER_ID:- } teamId=${ALPHATRION_DASHBOARD_TEAM_ID:- } "
13+
14+ # Start Caddy
15+ exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
Original file line number Diff line number Diff line change 11/**
2- * Configuration fetching from dashboard backend
2+ * Configuration fetching
33 *
4- * The dashboard is started with --userid flag, which stores the user ID
5- * in the backend. The frontend fetches this configuration on startup.
4+ * In CLI mode: The dashboard is started with --userid flag, which stores the user ID
5+ * in the backend. The frontend fetches this via /api/config endpoint.
6+ *
7+ * In Kubernetes mode: The dashboard pod writes userId from environment variables
8+ * to /config.json file at startup. The frontend fetches this static file.
69 */
710
811interface Config {
912 userId : string ;
13+ teamId ?: string ;
1014}
1115
1216/**
13- * Fetch configuration from the dashboard backend
17+ * Fetch configuration
1418 * Always fetches fresh config to avoid stale user ID when dashboard is restarted with different user
1519 */
1620export async function getConfig ( ) : Promise < Config > {
17- const response = await fetch ( '/api/config' , {
21+ // Try /config.json first (Kubernetes mode)
22+ let response = await fetch ( '/config.json' , {
1823 cache : 'no-store' ,
1924 headers : {
2025 'Cache-Control' : 'no-cache' ,
2126 } ,
2227 } ) ;
28+
29+ // Fallback to /api/config (CLI mode)
30+ if ( ! response . ok ) {
31+ response = await fetch ( '/api/config' , {
32+ cache : 'no-store' ,
33+ headers : {
34+ 'Cache-Control' : 'no-cache' ,
35+ } ,
36+ } ) ;
37+ }
38+
2339 if ( ! response . ok ) {
2440 throw new Error ( 'Failed to load configuration' ) ;
2541 }
Original file line number Diff line number Diff line change 4646 {{- end }}
4747 image : " {{ .Values.dashboard.image.repository }}:{{ .Values.dashboard.image.tag }}"
4848 imagePullPolicy : {{ .Values.dashboard.image.pullPolicy }}
49+
50+ # TODO: Remove after quantinuum-nvidia collaboration is done.
51+ env :
52+ - name : ALPHATRION_DASHBOARD_USER_ID
53+ value : {{ .Values.dashboard.userId | quote }}
54+ {{- if .Values.dashboard.teamId }}
55+ - name : ALPHATRION_DASHBOARD_TEAM_ID
56+ value : {{ .Values.dashboard.teamId | quote }}
57+ {{- end }}
58+
4959 ports :
5060 - name : http
5161 containerPort : 8080
You can’t perform that action at this time.
0 commit comments