From a421eb2e4f5c46ba1ec27725bd2f69eb5362a637 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Tue, 9 Jun 2026 19:54:24 +0800 Subject: [PATCH] xworkspace-portal.service: serve dashboard on port 17000 (#7) * xworkspace-portal.service: use dashboard on port 17000 - Change portal service from python http.server:7000 to npm dev server:17000 - Update chrome app launcher to use port 17000 - Add dashboard source sync and npm install tasks - Update portal URL and port variables * production: build dashboard on target with npm run build, serve with npm run preview - Add xworkspace_console_dashboard_local_src variable for local dashboard path - Sync dashboard source from controller to target via rsync - Build dashboard with npm install && npm run build on target - Serve production build with npm run preview instead of dev - Copy dist/ and package.json to portal directory for preview server --------- Co-authored-by: Haitao Pan --- setup-xworkspace-console.yaml | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/setup-xworkspace-console.yaml b/setup-xworkspace-console.yaml index 2a30e76..7af9fa4 100644 --- a/setup-xworkspace-console.yaml +++ b/setup-xworkspace-console.yaml @@ -9,13 +9,14 @@ xworkspace_console_root: /home/ubuntu/xworkspace xworkspace_console_portal_dir: /home/ubuntu/xworkspace/portal xworkspace_console_scripts_dir: /home/ubuntu/xworkspace/scripts - xworkspace_console_portal_url: http://localhost:7000 - xworkspace_console_portal_port: 7000 + xworkspace_console_portal_url: http://localhost:17000 + xworkspace_console_portal_port: 17000 xworkspace_console_ttyd_port: 7681 xworkspace_console_enable_ttyd: true xworkspace_console_install_chrome: true xworkspace_console_autostart_enabled: true xworkspace_console_ttyd_binary_path: /usr/local/bin/ttyd + xworkspace_console_dashboard_local_src: /Users/shenlan/workspaces/ai-workspace-lab/xworkspace-console/dashboard tasks: - name: Install Google Chrome apt repository prerequisites ansible.builtin.apt: @@ -365,7 +366,7 @@ set -euo pipefail mkdir -p "$HOME/.config/xworkspace-chrome" exec /usr/bin/google-chrome \ - --app=http://localhost:7000 \ + --app=http://localhost:17000 \ --user-data-dir="$HOME/.config/xworkspace-chrome" \ --profile-directory=Default \ --no-first-run \ @@ -373,6 +374,32 @@ --disable-sync \ --new-window + - name: Sync dashboard source from controller to target + ansible.posix.synchronize: + src: "{{ xworkspace_console_dashboard_local_src }}/" + dest: "{{ xworkspace_console_local_dashboard_dir }}/" + delete: true + recursive: true + rsync_opts: + --exclude=node_modules + --exclude=.git + --exclude=dist + become: false + delegate_to: localhost + + - name: Build dashboard assets on target + ansible.builtin.shell: | + cd "{{ xworkspace_console_local_dashboard_dir }}" && npm install && npm run build + become: false + + - name: Sync dashboard dist to portal directory + ansible.builtin.shell: | + mkdir -p "{{ xworkspace_console_portal_dir }}/dist" + cp -r "{{ xworkspace_console_local_dashboard_dir }}/dist/"* "{{ xworkspace_console_portal_dir }}/dist/" + cp "{{ xworkspace_console_local_dashboard_dir }}/package.json" "{{ xworkspace_console_portal_dir }}/" + cp "{{ xworkspace_console_local_dashboard_dir }}/vite.config.ts" "{{ xworkspace_console_portal_dir }}/" 2>/dev/null || true + become: false + - name: Deploy AI Agentic Workspace portal service ansible.builtin.copy: dest: "{{ xworkspace_console_home }}/.config/systemd/user/xworkspace-portal.service" @@ -388,7 +415,7 @@ [Service] Type=simple WorkingDirectory={{ xworkspace_console_portal_dir }} - ExecStart=/usr/bin/python3 -m http.server {{ xworkspace_console_portal_port }} + ExecStart=/usr/bin/npm run preview -- --host 127.0.0.1 --port {{ xworkspace_console_portal_port }} Restart=always RestartSec=2