diff --git a/admin/config/inertia.ts b/admin/config/inertia.ts index 9b1b9b3..c302df1 100644 --- a/admin/config/inertia.ts +++ b/admin/config/inertia.ts @@ -2,6 +2,7 @@ import KVStore from '#models/kv_store' import { SystemService } from '#services/system_service' import { defineConfig } from '@adonisjs/inertia' import type { InferSharedProps } from '@adonisjs/inertia/types' +import env from '#start/env' const inertiaConfig = defineConfig({ /** @@ -19,6 +20,7 @@ const inertiaConfig = defineConfig({ const customName = await KVStore.getValue('ai.assistantCustomName') return (customName && customName.trim()) ? customName : 'AI Assistant' }, + dozzlePort: () => env.get('DOZZLE_PORT', 9999), }, /** diff --git a/admin/inertia/layouts/SettingsLayout.tsx b/admin/inertia/layouts/SettingsLayout.tsx index cf0b086..063c8ca 100644 --- a/admin/inertia/layouts/SettingsLayout.tsx +++ b/admin/inertia/layouts/SettingsLayout.tsx @@ -17,7 +17,7 @@ import useServiceInstalledStatus from '~/hooks/useServiceInstalledStatus' import { SERVICE_NAMES } from '../../constants/service_names' export default function SettingsLayout({ children }: { children: React.ReactNode }) { - const { aiAssistantName } = usePage<{ aiAssistantName: string }>().props + const { aiAssistantName, dozzlePort } = usePage<{ aiAssistantName: string; dozzlePort: number }>().props const aiAssistantInstallStatus = useServiceInstalledStatus(SERVICE_NAMES.OLLAMA) const navigation = [ @@ -29,7 +29,7 @@ export default function SettingsLayout({ children }: { children: React.ReactNode { name: 'Maps Manager', href: '/settings/maps', icon: IconMapRoute, current: false }, { name: 'Service Logs & Metrics', - href: getServiceLink('9999'), + href: getServiceLink(String(dozzlePort ?? 9999)), icon: IconDashboard, current: false, target: '_blank', diff --git a/admin/start/env.ts b/admin/start/env.ts index ddf9b5f..cac930d 100644 --- a/admin/start/env.ts +++ b/admin/start/env.ts @@ -60,4 +60,11 @@ export default await Env.create(new URL('../', import.meta.url), { |---------------------------------------------------------- */ NOMAD_API_URL: Env.schema.string.optional(), + + /* + |---------------------------------------------------------- + | Variables for configuring companion service ports + |---------------------------------------------------------- + */ + DOZZLE_PORT: Env.schema.number.optional(), }) diff --git a/install/install_nomad.sh b/install/install_nomad.sh index ff288c8..90d6641 100644 --- a/install/install_nomad.sh +++ b/install/install_nomad.sh @@ -594,6 +594,7 @@ download_management_compose_file() { if [[ "$NOMAD_PORT_DOZZLE" != "9999" ]]; then sed -i 's|"9999:8080"|"'"${NOMAD_PORT_DOZZLE}"':8080"|g' "$compose_file_path" + sed -i "s|DOZZLE_PORT=9999|DOZZLE_PORT=${NOMAD_PORT_DOZZLE}|g" "$compose_file_path" fi if [[ "$NOMAD_PORT_MYSQL" != "3306" ]]; then diff --git a/install/management_compose.yaml b/install/management_compose.yaml index f3dc199..96f849a 100644 --- a/install/management_compose.yaml +++ b/install/management_compose.yaml @@ -32,6 +32,7 @@ services: - DB_SSL=false - REDIS_HOST=redis - REDIS_PORT=6379 + - DOZZLE_PORT=9999 depends_on: mysql: condition: service_healthy diff --git a/install/update_nomad.sh b/install/update_nomad.sh index d7be2d5..924f1b4 100644 --- a/install/update_nomad.sh +++ b/install/update_nomad.sh @@ -124,10 +124,17 @@ get_local_ip() { } success_message() { - echo -e "${GREEN}#${RESET} Project N.O.M.A.D installation completed successfully!\\n" + # Read the admin port from the existing compose file (handles remapped ports) + local admin_port + admin_port=$(grep -A1 'container_name: nomad_admin' /opt/project-nomad/compose.yml | head -1) + # Fallback: parse the ports binding for the admin service + admin_port=$(awk '/container_name: nomad_admin/{found=1} found && /ports:/{getline; print; exit}' /opt/project-nomad/compose.yml 2>/dev/null | sed -n 's/.*"\([0-9]*\):.*/\1/p') + admin_port="${admin_port:-8080}" + + echo -e "${GREEN}#${RESET} Project N.O.M.A.D update completed successfully!\\n" echo -e "${GREEN}#${RESET} Installation files are located at /opt/project-nomad\\n\n" - echo -e "${GREEN}#${RESET} Project N.O.M.A.D's Command Center should automatically start whenever your device reboots. However, if you need to start it manually, you can always do so by running: ${WHITE_R}${nomad_dir}/start_nomad.sh${RESET}\\n" - echo -e "${GREEN}#${RESET} You can now access the management interface at http://localhost:8080 or http://${local_ip_address}:8080\\n" + echo -e "${GREEN}#${RESET} Project N.O.M.A.D's Command Center should automatically start whenever your device reboots. However, if you need to start it manually, you can always do so by running: ${WHITE_R}/opt/project-nomad/start_nomad.sh${RESET}\\n" + echo -e "${GREEN}#${RESET} You can now access the management interface at http://localhost:${admin_port} or http://${local_ip_address}:${admin_port}\\n" echo -e "${GREEN}#${RESET} Thank you for supporting Project N.O.M.A.D!\\n" }