дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-25 02:44:37 +02:00
Closing a remote window (SSH, WSL, Dev Containers) used to end openidea-server --stdio and tear down terminals, runs (running their stop commands), indexing and agent turns. openidea-server --attach now connects through a detached per-project daemon (private 0700 run dir, owner check, flock) that keeps them alive across disconnects; reopening reattaches terminals with bounded scrollback and OSC state, runs and agent turns, and restores remote editor tabs, tool windows and plugin views. The close dialog offers Keep Backend Running / Stop Backend; Stop Remote Backend shuts the daemon down on demand. A disconnected backend with no live work exits after an idle timeout (3 hours by default; presets, custom or Never in Settings › Tools › Remote Development, host override wins). The socket is keyed by project, so a new build replaces an idle backend of another build and reports a busy one; a window taken over by another shows that instead of a dropped connection. Clean documents are released on disconnect while dirty buffers keep the backend alive. Also: a plugin-owned PTY keeps its exit hook across reattach (reattach only rebinds the forwarding sink), and a recent project clicked again while it is still opening joins that attempt instead of connecting twice (a double click made the second attach take over and fail the first). Co-authored-by: dengliu <[email protected]>
138 рядки
9.6 KiB
Plaintext
138 рядки
9.6 KiB
Plaintext
---
|
||
title: "openidea-server"
|
||
description: "The IDE backend that runs on the remote host: how the desktop app installs and starts it, where it keeps its files, and how to install it offline."
|
||
---
|
||
|
||
`openidea-server` is the OpenIDEA backend without a UI. In a remote window it runs where the project is (an SSH host,
|
||
a WSL distribution or a dev container) and does the work the desktop app would do locally: file system, indexing,
|
||
language servers, terminals, runs, debugging, build tools and Git. The desktop window only shows the UI and sends
|
||
commands to it.
|
||
|
||
You don't start it yourself. When you open a remote project ([SSH](/en/guide/remote/ssh),
|
||
[Containers](/en/guide/remote/containers)), the desktop app installs the server on the host if needed, runs
|
||
`openidea-server --attach <project>` over the SSH connection (or `wsl.exe` / `docker exec`) to attach to a persistent
|
||
per-project daemon over a private Unix socket, and talks to it over stdin and stdout.
|
||
|
||
## Closing or stopping a remote backend
|
||
|
||
- **Keep Backend Running** (the default when closing a remote window) disconnects the window without interrupting
|
||
terminal sessions, runs, indexing or agent turns. Reopen the same project to reattach. A network drop also leaves
|
||
the backend running.
|
||
- **Stop Backend** on close, or **File › Stop Remote Backend**, shuts down the IDE backend and its workloads.
|
||
Active Run configurations with a stop command, such as `docker compose down`, run that command first. Stopping the
|
||
IDE backend in a dev container does not stop the dev container itself.
|
||
- By default, a backend stops after **3 hours** with no connected window, live terminal, run, debug session, or agent
|
||
work. In a connected window, open **Settings › Tools › Remote Development › Stop backend when idle**. Pick a
|
||
preset, choose **Custom…** to enter minutes, hours, or days, or choose **Never** to keep an idle project running.
|
||
**Apply** saves the choice for your user on that host. It takes effect the next time a backend becomes idle, without a restart.
|
||
**Never** does not prevent **Stop Backend**, and backends that never opened a project still clean themselves up.
|
||
- The close dialog shows what **Keep Backend Running** means for this host. A positive
|
||
`OPENIDEA_SERVER_IDLE_TIMEOUT_SECONDS` set at server startup takes precedence, even over **Never**;
|
||
Settings shows that value read-only. Reconnecting resets the idle timer. Save
|
||
your edits before leaving a project idle: unsaved buffers retained after a network drop are kept only in memory.
|
||
|
||
## Supported hosts
|
||
|
||
Each release publishes a server build for:
|
||
|
||
| OS | Architectures |
|
||
| ----- | ------------------------------------------------------------------------- |
|
||
| Linux | `x86_64`, `aarch64` (static musl builds, independent of the host's glibc) |
|
||
| macOS | `aarch64`, `x86_64` |
|
||
|
||
The desktop app detects the host with `uname -sm`. Other platforms, including Windows hosts, are not supported.
|
||
Dev containers must be Linux.
|
||
|
||
## How it is installed
|
||
|
||
On every connection the desktop app checks whether the host already has the server for its own version. If not:
|
||
|
||
1. It looks for a server binary for the host's platform on your machine (see [Offline installation](#offline-installation)).
|
||
2. Otherwise it downloads the release asset `openidea-server-<os>-<arch>.gz` for its version from
|
||
[GitHub releases](https://github.com/l0ng-ai/openidea/releases), verifies its SHA-256 checksum, and caches it in the
|
||
desktop's local data directory under `server/<version>/<os>-<arch>/`.
|
||
3. It uploads the binary to the host and removes older builds of the same version.
|
||
|
||
After you update OpenIDEA, the next connection replaces the old backend for that project if it has no connected
|
||
window, live work, or unsaved documents. Otherwise OpenIDEA asks you to finish or save your work using the previous
|
||
build and stop that backend before upgrading. Two windows on the same build can use the same project in turn; the
|
||
previous window shows that another window took over and does not reconnect automatically.
|
||
|
||
## Files on the host
|
||
|
||
| Path | Contents |
|
||
| ------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
|
||
| `~/.openidea/server/<version>/<build>/openidea-server` | The installed server binaries, one folder per version and build. |
|
||
| `~/.openidea/config/` | The host's settings, including custom language definitions in `languages/`. |
|
||
| `~/.openidea/data/` | Tools OpenIDEA installs on the host (language servers, debuggers, JDKs), caches and indexes. |
|
||
| `~/.openidea/logs/server-<key>.log` | Backend log for each project (under `OPENIDEA_SERVER_HOME` if set). |
|
||
|
||
To stop all of your backends by hand, open a shell on the remote host, WSL distribution, or dev container and list
|
||
your processes with `ps -u "$(id -un)" -o pid=,args=`. Review the rows for `openidea-server --daemon`, then run
|
||
`kill -TERM <pid>` for each of those daemon PIDs. Save any open work first: this shuts down those backends even if
|
||
a window is still connected. It does not stop unrelated processes.
|
||
|
||
To free space, delete old version folders under `~/.openidea/server/`. After deleting `~/.openidea/data/`, OpenIDEA
|
||
installs its tools again when they are needed.
|
||
|
||
## Environment
|
||
|
||
The server reads your login shell's environment when it starts, because an SSH command otherwise gets a minimal one.
|
||
So `PATH` and other variables from your shell profile apply to terminals, runs and language servers. After changing
|
||
them, use **File › Reload Environment** in the remote window instead of reconnecting.
|
||
|
||
| Variable | Effect |
|
||
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||
| `OPENIDEA_SERVER_HOME` | Use this folder instead of `~/.openidea` for `config/` and `data/`. It must be set in the environment the server process starts with. The installed binaries stay under `~/.openidea/server/`. |
|
||
| `OPENIDEA_LOG` | Log filter for the server's log on stderr, for example `debug` or `ide_lsp=debug`. Default: `info`. |
|
||
|
||
## Offline installation
|
||
|
||
When the desktop machine can't reach GitHub, give it the server binary yourself. The desktop app looks for one in
|
||
this order:
|
||
|
||
1. The file named by the `OPENIDEA_SERVER_BINARY` environment variable, if it is set when OpenIDEA starts.
|
||
2. An `openidea-server` next to the OpenIDEA executable, when the host has the same platform as the desktop.
|
||
3. `server/<version>/<os>-<arch>/openidea-server` in the desktop's
|
||
[local data directory](/en/reference/data-directories), for example `server/0.1.44/linux-x86_64/openidea-server`.
|
||
This is also where the desktop keeps the server it downloads, so a file put there is used instead of downloading.
|
||
|
||
Download `openidea-server-<os>-<arch>.gz` from the release that matches your OpenIDEA version, unpack it with
|
||
`gunzip`, and put it in the version's folder. After an update the desktop looks in the new version's folder, so an
|
||
older server is never used by mistake.
|
||
|
||
If nothing can be downloaded, the desktop uses a build of the current version already installed on the host, and then
|
||
`server/<os>-<arch>/openidea-server` (the place earlier versions used), which may be another version: commands added
|
||
since then report that the server does not match the app.
|
||
|
||
### Build from source
|
||
|
||
```bash
|
||
cargo build --release -p ide-host --bin openidea-server
|
||
```
|
||
|
||
Build on, or cross-compile for, the host's platform, then point `OPENIDEA_SERVER_BINARY` at
|
||
`target/release/openidea-server` (or the target-specific folder when cross-compiling).
|
||
|
||
## Command line
|
||
|
||
The flags are meant for the desktop app, but `--version` is handy for checking an installed build.
|
||
|
||
| Flag | Meaning |
|
||
| ------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
||
| `--version` | Print the server version and protocol version, then exit. |
|
||
| `--attach <project>` | Start or attach to the persistent per-project daemon and bridge stdin / stdout to its Unix socket. |
|
||
| `--stdio` | Serve a single desktop client directly over stdin / stdout and exit on EOF. Logs go to stderr. |
|
||
| `--mcp-stdio [--project <dir>]` | Relay stdio MCP traffic to the running `openidea-server` MCP server on this host. |
|
||
| `--connect <host> <port>` | Relay one TCP connection to `<host>:<port>` over stdin / stdout. Used for port forwarding into dev containers. |
|
||
|
||
```bash
|
||
ls ~/.openidea/server/*/*/openidea-server
|
||
~/.openidea/server/<version>/<build>/openidea-server --version
|
||
```
|
||
|
||
## Plugins
|
||
|
||
The desktop's code plugins and the languages they contribute are sent to the server when the window connects, and
|
||
the plugins run there, next to the project.
|