From b58a74892c9734df8ea06fb7039947709e3612af Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Tue, 9 Jun 2026 19:28:00 +0800 Subject: [PATCH 1/2] 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 --- setup-xworkspace-console.yaml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/setup-xworkspace-console.yaml b/setup-xworkspace-console.yaml index 2a30e76..8f16ff6 100644 --- a/setup-xworkspace-console.yaml +++ b/setup-xworkspace-console.yaml @@ -9,8 +9,8 @@ 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 @@ -365,7 +365,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 +373,27 @@ --disable-sync \ --new-window + - name: Sync AI Agentic Workspace dashboard source + ansible.posix.synchronize: + src: "{{ xworkspace_console_local_dashboard_dir | default(xworkspace_console_root + '/dashboard') }}/" + dest: "{{ xworkspace_console_portal_dir }}/" + delete: true + recursive: true + rsync_opts: + --exclude=node_modules + --exclude=.git + --exclude=dist + become: false + delegate_to: localhost + + - name: Install dashboard npm dependencies + community.general.npm: + path: "{{ xworkspace_console_portal_dir }}" + production: false + state: present + become: false + delegate_to: "{{ xworkspace_console_hosts | default('all') }}" + - name: Deploy AI Agentic Workspace portal service ansible.builtin.copy: dest: "{{ xworkspace_console_home }}/.config/systemd/user/xworkspace-portal.service" @@ -388,7 +409,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 dev -- --host 127.0.0.1 --port {{ xworkspace_console_portal_port }} Restart=always RestartSec=2 From 1414fe588f6b55109f4c1801fc51be8d2d5bdaa9 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Tue, 9 Jun 2026 19:46:11 +0800 Subject: [PATCH 2/2] 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 --- setup-xworkspace-console.yaml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/setup-xworkspace-console.yaml b/setup-xworkspace-console.yaml index 8f16ff6..7af9fa4 100644 --- a/setup-xworkspace-console.yaml +++ b/setup-xworkspace-console.yaml @@ -16,6 +16,7 @@ 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: @@ -373,10 +374,10 @@ --disable-sync \ --new-window - - name: Sync AI Agentic Workspace dashboard source + - name: Sync dashboard source from controller to target ansible.posix.synchronize: - src: "{{ xworkspace_console_local_dashboard_dir | default(xworkspace_console_root + '/dashboard') }}/" - dest: "{{ xworkspace_console_portal_dir }}/" + src: "{{ xworkspace_console_dashboard_local_src }}/" + dest: "{{ xworkspace_console_local_dashboard_dir }}/" delete: true recursive: true rsync_opts: @@ -386,13 +387,18 @@ become: false delegate_to: localhost - - name: Install dashboard npm dependencies - community.general.npm: - path: "{{ xworkspace_console_portal_dir }}" - production: false - state: present + - 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 - delegate_to: "{{ xworkspace_console_hosts | default('all') }}" - name: Deploy AI Agentic Workspace portal service ansible.builtin.copy: @@ -409,7 +415,7 @@ [Service] Type=simple WorkingDirectory={{ xworkspace_console_portal_dir }} - ExecStart=/usr/bin/npm run dev -- --host 127.0.0.1 --port {{ xworkspace_console_portal_port }} + ExecStart=/usr/bin/npm run preview -- --host 127.0.0.1 --port {{ xworkspace_console_portal_port }} Restart=always RestartSec=2