npm installCopy .env.example values to your shell (or your preferred .env loader).
Required variables for runtime:
LUNA_SERVER_HOSTLUNA_SERVER_PORTLUNA_SERVER_STATIC_DIR(optional)LUNA_SERVER_STATE_FILE(optional, defaults to./data/server-state.json)LUNA_AGENT_SERVER_URLLUNA_AGENT_DEVICE_IDLUNA_AGENT_DEVICE_NAMELUNA_AGENT_DEVICE_HOSTNAMELUNA_AGENT_RECONNECT_INITIAL_DELAY_MS(optional, default1000)LUNA_AGENT_RECONNECT_MAX_DELAY_MS(optional, default30000)NEXT_PUBLIC_LUNA_SERVER_URL(optional for standalone web dev)
Build the image:
npm run docker:build:serverRun the image:
npm run docker:run:serverPersistence note:
- The default server state file inside the container is
/app/data/server-state.json. - To keep state across container recreation, mount a volume or bind mount that path.
Validation:
- Open
http://127.0.0.1:4000/. - Check
http://127.0.0.1:4000/devices. - Confirm the embedded web loads from the same origin.
Terminal 1:
npm run start:serverTerminal 2:
npm run start:agentTerminal 3:
npm run start:webIf port 3000 is busy, Next.js will automatically use the next available port.
npm run build:artifact:serverThis generates dist-artifacts/server with:
- compiled server runtime under
dist/ - exported web under
web/ - compiled internal workspace packages under
node_modules/@luna
npm run build:artifact:agentThis generates dist-artifacts/agent with:
- compiled agent runtime under
dist/ - internal workspace packages under
node_modules/@luna - external runtime dependencies under
node_modules/ - embedded Node runtime under
runtime/ - local bootstrap files
.env.exampleandrun-agent.cmdorrun-agent.sh
First package run:
- Copy
dist-artifacts/agentto the target machine. - Run
run-agent.cmdon Windows or./run-agent.shon Unix-like systems. - If
.envdoes not exist, the launcher creates it from.env.exampleand continues execution. - Prefer passing runtime overrides via CLI when starting the agent, for example:
- Windows:
run-agent.cmd --server-host 192.168.0.10 --server-port 4000 - Unix:
./run-agent.sh --server-host 192.168.0.10 --server-port 4000
- Windows:
- Open the web UI.
- Send
Abrir Spotify no Notebook 2. - Check UI success feedback and agent log output.
- Restart the server and confirm approved devices plus command history are preserved.
Run without global install:
npm exec --yes --package @vitorqf/luna-agent luna-agent -- \
--server-host 192.168.0.10 --server-port 4000Optional global install:
npm install -g @vitorqf/luna-agent
luna-agent --server-host 192.168.0.10 --server-port 4000