Skip to content

Commit 043c2cc

Browse files
committed
feat: simplify OSS local installation
1 parent 27d0663 commit 043c2cc

5 files changed

Lines changed: 519 additions & 187 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,20 @@ jobs:
107107
--exit-code; EXIT_CODE=$?
108108
docker rm -f shadow-db
109109
exit $EXIT_CODE
110+
111+
installer:
112+
name: OSS installer smoke test
113+
runs-on: ubuntu-latest
114+
steps:
115+
- name: Checkout
116+
uses: actions/checkout@v6
117+
118+
- name: Check shell syntax
119+
run: |
120+
sh -n scripts/install.sh
121+
sh -n scripts/onecomputer/setup.sh
122+
123+
- name: Check non-mutating plans
124+
run: |
125+
./scripts/install.sh --dry-run --no-start --dir /tmp/onecomputer-ci
126+
./scripts/onecomputer/setup.sh --dry-run --no-start --source-dir .

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,36 @@ vendored into this application.
4444

4545
## Local development
4646

47+
For a fresh macOS, Linux, or WSL checkout, the recommended OSS path is:
48+
49+
```bash
50+
curl -fsSL https://raw.githubusercontent.com/ONE-Computer/onecomputer/main/scripts/install.sh | sh
51+
```
52+
53+
The installer clones the public repository into `~/.onecomputer/src`, creates a
54+
mode-600 `.env` with local-only secrets, installs locked JavaScript
55+
dependencies, starts PostgreSQL with Docker Compose, applies migrations, and
56+
starts the web/gateway development processes. It is safe to rerun and never
57+
deletes database volumes or overwrites an existing `.env` secret.
58+
59+
To prepare without starting the dev server:
60+
61+
```bash
62+
curl -fsSL https://raw.githubusercontent.com/ONE-Computer/onecomputer/main/scripts/install.sh | sh -s -- --no-start
63+
```
64+
65+
For a checkout you already cloned:
66+
67+
```bash
68+
./scripts/install.sh --source-dir .
69+
```
70+
71+
See [`docs/onecomputer/installation.md`](docs/onecomputer/installation.md)
72+
for supported options, prerequisites, security behavior, and the distinction
73+
between the OSS source path and the Azure deployment path.
74+
75+
### Manual local development
76+
4777
Requirements: Node.js 18+, pnpm 9+, Docker, and Rust for the gateway.
4878

4979
```bash

docs/onecomputer/installation.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# ONEComputer OSS installation
2+
3+
The supported public installation path is a small source bootstrapper followed
4+
by a deterministic local setup script. This keeps the first-run experience
5+
short while keeping the source, package lockfile, database migrations, and
6+
gateway code visible and reproducible.
7+
8+
## One-line setup
9+
10+
```bash
11+
curl -fsSL https://raw.githubusercontent.com/ONE-Computer/onecomputer/main/scripts/install.sh | sh
12+
```
13+
14+
The default flow:
15+
16+
1. Clones `ONE-Computer/onecomputer` into `~/.onecomputer/src`.
17+
2. Reuses an existing checkout if that path already contains Git metadata.
18+
3. Checks Node.js, pnpm, Docker, and Docker Compose before changing the repo.
19+
4. Creates `.env` from `.env.example` with mode `600` if it does not exist.
20+
5. Generates missing local encryption and gateway secrets without printing them.
21+
6. Chooses PostgreSQL port `5432`, falling back to `5433` when the default is busy.
22+
7. Installs from `pnpm-lock.yaml`, generates Prisma, starts PostgreSQL, and migrates.
23+
8. Starts `pnpm dev`, which runs the web app and Rust gateway from source.
24+
25+
The script does not install Docker, Node.js, or Rust with `sudo`. Missing
26+
prerequisites produce a direct installation instruction instead. This avoids a
27+
privileged package-manager action hidden inside a `curl | sh` command.
28+
29+
## Useful options
30+
31+
```bash
32+
# Prepare dependencies and PostgreSQL, then return to the shell.
33+
curl -fsSL https://raw.githubusercontent.com/ONE-Computer/onecomputer/main/scripts/install.sh \
34+
| sh -s -- --no-start
35+
36+
# Preview the plan without cloning or changing anything.
37+
curl -fsSL https://raw.githubusercontent.com/ONE-Computer/onecomputer/main/scripts/install.sh \
38+
| sh -s -- --dry-run --no-start
39+
40+
# Use an existing local checkout.
41+
./scripts/install.sh --source-dir . --no-start
42+
43+
# Use a non-default PostgreSQL port.
44+
./scripts/onecomputer/setup.sh --postgres-port 5433 --no-start
45+
```
46+
47+
The setup script also accepts `--app-port` and `--gateway-port`. Rerunning it
48+
does not remove containers or volumes. Existing `.env` values are preserved;
49+
only empty or known placeholder values are generated.
50+
51+
## Prerequisites
52+
53+
- Git
54+
- Node.js 18 or newer
55+
- pnpm 9, enabled with Corepack when available
56+
- Docker Engine or Docker Desktop with Docker Compose v2
57+
- Rust/Cargo for the gateway development process
58+
59+
The installer checks Node, pnpm, and Docker before making changes. Rust is
60+
needed when `pnpm dev` starts the gateway; install it through
61+
[rustup](https://rustup.rs/) if it is missing.
62+
63+
## Security behavior
64+
65+
- The installer has no telemetry or analytics.
66+
- It never prints `.env` values, wallet material, API keys, or generated keys.
67+
- It does not modify Git remotes, force-reset branches, or delete data volumes.
68+
- `.env` is created with mode `600` and is not committed by the repository.
69+
- The public source path is intentionally used for OSS development while the
70+
Azure path remains governed by the deployment runbook and external OpenVTC
71+
wallet boundary.
72+
73+
Inspect the script before running it in a sensitive environment. For a reviewable
74+
flow, clone the repository first and run `./scripts/install.sh --source-dir .`.
75+
76+
## Updating
77+
78+
Rerunning the installer reuses the existing checkout. It does not silently
79+
discard local changes. Update deliberately:
80+
81+
```bash
82+
cd ~/.onecomputer/src
83+
git pull --ff-only
84+
./scripts/onecomputer/setup.sh --no-start
85+
```
86+
87+
## Scope boundary
88+
89+
This installer is for local OSS development and the local E2E path. It does not
90+
provision Azure, Entra ID, OpenVTC/VTI services, TLS, DNS, or production
91+
credentials. Use the Azure E2E runbook for those environments.

0 commit comments

Comments
 (0)