Skip to content

Commit 612b86e

Browse files
authored
Move installation instructions to new docs (TraceMachina#1127)
1 parent fa7b099 commit 612b86e

File tree

11 files changed

+347
-204
lines changed

11 files changed

+347
-204
lines changed

.vale.ini

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ mdx = md
1414
[*.{md,mdx}]
1515
BasedOnStyles = alex, Vale, Microsoft, write-good
1616

17+
# Ignore code blocks in Starlight's TabItems.
18+
BlockIgnores = (?s)(<TabItem.*?>.*?```.*?```.*?</TabItem>)
19+
1720
# Too harsh. The `write-good.Passive` check already covers many cases.
1821
write-good.E-Prime = NO
1922

README.md

+48-185
Original file line numberDiff line numberDiff line change
@@ -19,215 +19,78 @@
1919
NativeLink is an extremely (blazingly?) fast and efficient build cache and
2020
remote executor for systems that communicate using the [Remote execution
2121
protocol](https://github.com/bazelbuild/remote-apis/blob/main/build/bazel/remote/execution/v2/remote_execution.proto) such as [Bazel](https://bazel.build), [Buck2](https://buck2.build), [Goma](https://chromium.googlesource.com/infra/goma/client/) and
22-
[Reclient](https://github.com/bazelbuild/reclient). NativeLink powers over one billion requests per month for customers using the system for their production workloads.
22+
[Reclient](https://github.com/bazelbuild/reclient). NativeLink powers over one
23+
billion requests per month in production workloads.
2324

2425
Supports Unix-based operating systems and Windows.
2526

26-
## Getting Started with NativeLink
27+
## 🚀 Quickstart
2728

28-
Below, you will find a few different options for getting started with NativeLink.
29+
The setups below are **production-grade** installations. See the
30+
[contribution docs](https://docs.nativelink.com/contribute/nix/) for
31+
instructions on how to build from source with [Bazel](https://docs.nativelink.com/contribute/bazel/),
32+
[Cargo](https://docs.nativelink.com/contribute/cargo/), and [Nix](https://docs.nativelink.com/contribute/nix/).
2933

30-
## 🚀 Example Deployments
34+
### 📦 Prebuilt images
3135

32-
You can find a few example deployments in the [deployment-examples directory](./deployment-examples).
36+
Fast to spin up, but currently limited to `x86_64` systems. See the [container
37+
registry](https://github.com/TraceMachina/nativelink/pkgs/container/nativelink)
38+
for all image tags and the [contribution docs](https://docs.nativelink.com/contribute/nix)
39+
for how to build the images yourself.
3340

34-
### 📝 Clone the NativeLink repository
35-
1. Go to the [NativeLink](https://github.com/TraceMachina/nativelink) repository on GitHub. Clone the repository via SSH or HTTPS. In this example the repository is cloned via SSH:
36-
```bash
37-
git clone [email protected]:TraceMachina/nativelink.git
38-
```
39-
40-
### 📦 Installing with Cargo
41-
42-
1. First install Rust, but skip to step 2 if you have it already.
43-
```bash
44-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
45-
```
46-
2. Install NativeLink with Cargo.
47-
```bash
48-
cargo install --git https://github.com/TraceMachina/nativelink --tag v0.4.0
49-
```
50-
51-
### ⚙️ Configure and 🦾 Start NativeLink
52-
53-
The `nativelink` executable reads a JSON file as it's only parameter,
54-
`--config`. See [`nativelink-config`](./nativelink-config/examples/basic_cas.json)
55-
for more details and examples.
41+
**Linux x86_64**
5642

57-
To grab the example in your current working directory, run:
58-
59-
```bash
60-
curl -O https://raw.githubusercontent.com/TraceMachina/nativelink/main/nativelink-config/examples/basic_cas.json
61-
62-
### you can modify the example above to replace the filesystem store with the memory store if you favor speed over data durability.
63-
nativelink basic_cas.json
64-
```
65-
66-
## 🧪 Evaluating NativeLink
67-
68-
1. Once you've built NativeLink and have an instance running with the `basic_cas.json` configuration, launch a separate terminal session.
69-
2. Navigate to where you cloned the NativeLink repository:
7043
```bash
71-
cd $HOME/nativelink
72-
```
73-
3. In the new terminal, run the following command to connect the running server launched above to Bazel or another RBE client:
74-
75-
```sh
76-
bazel test //... \
77-
--remote_instance_name=main \
78-
--remote_cache=grpc://127.0.0.1:50051 \
79-
--remote_executor=grpc://127.0.0.1:50051 \
80-
--remote_default_exec_properties=cpu_count=1
44+
curl -O \
45+
https://raw.githubusercontent.com/TraceMachina/nativelink/main/nativelink-config/examples/basic_cas.json
46+
47+
# See https://github.com/TraceMachina/nativelink/pkgs/container/nativelink
48+
# to find the latest tag
49+
docker run \
50+
-v $(pwd)/basic_cas.json:/config \
51+
-p 50051 \
52+
ghcr.io/tracemachina/nativelink:v0.4.0
8153
```
8254

83-
For Windows PowerShell;
55+
**Windows x86_64**
8456

8557
```powershell
86-
bazel test //... `
87-
--remote_instance_name=main `
88-
--remote_cache=grpc://127.0.0.1:50051 `
89-
--remote_executor=grpc://127.0.0.1:50051 `
90-
--remote_default_exec_properties=cpu_count=1
91-
```
92-
This causes Bazel to run the commands through an all-in-one `CAS`, `scheduler`
93-
and `worker`.
94-
95-
> [!WARNING]
96-
> If you're using MacOS, encountering errors is anticipated at this stage. Our team is actively working on enhancing support for executing remoteable Bazel builds with MacOS. For now, you can run with [Docker](https://github.com/blakehatch/nativelink/tree/main/deployment-examples/docker-compose) or a Linux virtual machine. If you have any questions, reach out on the [NativeLink](https://join.slack.com/t/nativelink/shared_invite/zt-2forhp5n9-L7dTD21nCSY9_IRteQvZmw) slack.
97-
98-
## How it Works
99-
100-
This diagram is a high-level overview of the data flow in the NativeLink system. It refers to NativeLink concepts like Scheduler pool, Worker pool, and CAS rather than the cloud concepts like functions, compute nodes, and object storage to which they correspond.
101-
102-
```mermaid
103-
sequenceDiagram
104-
participant build server (client)
105-
participant scheduler pool
106-
participant worker pool
107-
participant cas
108-
build server (client)->>scheduler pool: queue jobs
109-
scheduler pool->>worker pool: route jobs
110-
worker pool->>cas: upload artifacts
111-
worker pool->>scheduler pool: result download instructions
112-
scheduler pool->>build server (client): result download instructions
113-
cas->>build server (client): service queries
114-
build server (client)->>cas: service queries
58+
# Download the configuration file
59+
Invoke-WebRequest `
60+
-Uri "https://raw.githubusercontent.com/TraceMachina/nativelink/main/nativelink-config/examples/basic_cas.json" `
61+
-OutFile "basic_cas.json"
62+
63+
# Run the Docker container
64+
# Note: Adjust the path if the script is not run from the directory containing basic_cas.json
65+
docker run `
66+
-v ${PWD}/basic_cas.json:/config `
67+
-p 50051 `
68+
ghcr.io/tracemachina/nativelink:v0.4.0
11569
```
116-
## ❄️ Installing with Nix
11770

118-
**Installation requirements:**
71+
### ❄️ Raw executable with Nix
11972

120-
* Nix with [flakes](https://nixos.wiki/wiki/Flakes) enabled
73+
Slower, since it's built from source, but more flexible and supports MacOS.
74+
Doesn't support native Windows, but works in WSL2.
12175

122-
This build doesn't require cloning the repository, but you need to provide a
123-
configuration file, for instance the one at [`nativelink-config/examples/basic_cas.json`](./nativelink-config/examples/basic_cas.json).
76+
Make sure your Nix version is recent and supports flakes. For instance, install
77+
it via the [next-gen nix installer](https://github.com/NixOS/experimental-nix-installer).
12478

125-
The following command builds and runs NativeLink in release (optimized) mode:
79+
> [!CAUTION]
80+
> Executables built for MacOS are dynamically linked against libraries from Nix
81+
> and won't work on systems that don't have these libraries present.
12682
127-
```sh
128-
nix run github:TraceMachina/nativelink ./basic_cas.json
129-
```
83+
**Linux, MacOS, WSL2**
13084

131-
For use in production pin the executable to a specific revision:
132-
133-
```sh
134-
nix run github:TraceMachina/nativelink/<revision> ./basic_cas.json
13585
```
86+
curl -O \
87+
https://raw.githubusercontent.com/TraceMachina/nativelink/main/nativelink-config/examples/basic_cas.json
13688
137-
## 🌱 Building with Bazel
138-
139-
**Build requirements:**
140-
141-
* Bazel `7.0.2`
142-
* A recent C++ toolchain with LLD as linker
143-
144-
> [!TIP]
145-
> This build supports Nix/direnv which provides Bazel but no C++ toolchain
146-
> (yet).
147-
148-
The following commands places an executable in `./bazel-bin/nativelink` and
149-
starts the service:
150-
151-
```sh
152-
# Unoptimized development build on Unix
153-
bazel run nativelink -- $(pwd)/nativelink-config/examples/basic_cas.json
154-
155-
# Optimized release build on Unix
156-
bazel run -c opt nativelink -- $(pwd)/nativelink-config/examples/basic_cas.json
157-
158-
# Unoptimized development build on Windows
159-
bazel run --config=windows nativelink -- $(pwd)/nativelink-config/examples/basic_cas.json
160-
161-
# Optimized release build on Windows
162-
bazel run --config=windows -c opt nativelink -- $(pwd)/nativelink-config/examples/basic_cas.json
163-
```
164-
165-
> [!WARNING]
166-
> The Rust compiler `rustc` generates numerous artifacts during compilation,
167-
> including dependencies, macros, and intermediate files.
168-
> When compiling programs from source, be mindful of the associated files'
169-
> impact on your disk usage in the `bazel-bin/` directory.
170-
> This directory can grow substantially in size.
171-
>
172-
> If the facing issues due to this, run the following command
173-
> to clear cache files:
174-
> ```sh
175-
> bazel clean --expunge
176-
> ```
177-
178-
## 📦 Building with Cargo
179-
180-
**Build requirements:**
181-
182-
* Cargo 1.74.0+
183-
* A recent C++ toolchain with LLD as linker
184-
185-
> [!TIP]
186-
> This build supports Nix/direnv which provides Cargo but no C++
187-
> toolchain/stdenv (yet).
188-
189-
```bash
190-
# Unoptimized development build
191-
cargo run --bin nativelink -- ./nativelink-config/examples/basic_cas.json
192-
193-
# Optimized release build
194-
cargo run --release --bin nativelink -- ./nativelink-config/examples/basic_cas.json
89+
nix run github:TraceMachina/nativelink ./basic_cas.json
19590
```
19691

197-
> [!WARNING]
198-
> The Rust compiler `rustc` generates numerous artifacts during compilation,
199-
> including dependencies, macros, and intermediate files.
200-
> When compiling programs from source, be mindful of the associated files'
201-
> impact on your disk usage in the target/ directory.
202-
> This directory can grow substantially in size.
203-
>
204-
> If the facing issues due to this, run the following command
205-
> to clear cache files:
206-
> ```sh
207-
> cargo clean
208-
> ```
209-
210-
## Project Health
211-
212-
* Powering more than 1 billion devices at the edge.
213-
214-
## 🏺 History
215-
216-
This project was first created due to frustration with similar projects not
217-
working or being extremely inefficient. Rust was chosen as the language to write
218-
it in because at the time Rust was going through a revolution in the new-ish
219-
feature `async-await`. This made making multi-threading simpler when
220-
paired with a runtime like [Tokio](https://github.com/tokio-rs/tokio) while
221-
still giving all the lifetime and other protections that Rust gives. This pretty
222-
much guarantees that we will never have crashes due to race conditions. This
223-
kind of project seemed perfect, since there is so much asynchronous activity
224-
happening and running them on different threads is most preferable. Other
225-
languages like `Go` are good candidates, but other similar projects rely heavily
226-
on channels and mutex locks which are cumbersome and have to be carefully
227-
designed by the developer. Rust doesn't have these issues, since the compiler
228-
will always tell you when the code you are writing might introduce undefined
229-
behavior. The last major reason is because Rust is extremely fast and has no
230-
garbage collection (like C++, but unlike `Java`, `Go`, or `Typescript`).
92+
See the [contribution docs](https://docs.nativelink.com/contribute/nix) for
93+
further information.
23194

23295
## 📜 License
23396

docs/.gitignore

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ pnpm-debug.log*
2727
stats.html
2828

2929
# Generated files
30-
src/content/docs/guides/contributing.mdx
30+
src/content/docs/contribute/docs.mdx
31+
src/content/docs/contribute/guidelines.mdx
3132
src/content/docs/explanations/lre.mdx
32-
src/content/docs/reference/changelog.mdx
33-
src/content/docs/reference/nativelink-config.mdx
34-
src/content/docs/tutorials/setup.mdx
3533
src/content/docs/guides/chromium.mdx
3634
src/content/docs/guides/configuration.mdx
3735
src/content/docs/guides/kubernetes.mdx
3836
src/content/docs/guides/setup.md
37+
src/content/docs/reference/changelog.mdx
38+
src/content/docs/reference/nativelink-config.mdx
39+
src/content/docs/tutorials/setup.mdx

docs/README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# The NativeLink documentation
22

3-
This is the NativeLink documentation hosted at <https://docs.nativelink.com>.
3+
The NativeLink documentation gets deployed to <https://docs.nativelink.com>.
44

5-
> [!WARNING]
6-
> Setup for working on these docs differs substantially between Linux and Mac.
5+
> [!CAUTION]
6+
> Setup for working on these docs differs between Linux and Mac.
77
>
88
> For Linux: Use the Nix flake and run `pnpm i`.
99
>
1010
> For Mac: If you're in the Nix flake, exit it, for instance with `direnv
1111
> revoke`. Then manually install `pnpm`, run `pnpm i` and run `pnpm exec
1212
> playwright install`.
1313
>
14-
> Long term we'll add the automated setup to Mac.
14+
> It's a long term goal to add the automated setup to Mac.
1515
1616
## 📚 Stack
1717

@@ -32,7 +32,8 @@ challenging. Feel free to copy-paste it into your own projects.
3232

3333
## 🚀 Common workflows
3434

35-
See `package.json` for build scripts.
35+
See [`docs/package.json`](https://github.com/TraceMachina/nativelink/blob/main/docs/package.json)
36+
for build scripts.
3637

3738
This project requires `pnpm`. The nix flake ships a compatible version.
3839

@@ -65,12 +66,12 @@ pnpm preview
6566

6667
When deploying to Cloudflare, make sure to set the `PNPM_VERSION` to `8.15.5` to
6768
stay in sync with the flake. Also, use `pnpm exec playwright install && pnpm
68-
build` on the Cloudflare worker. This sets up headless Chromium which is used to
69+
build` on the Cloudflare worker. This sets up headless Chromium which to
6970
generate mermaid diagrams during the build. You don't need to set playwright up
7071
locally as it's already configured in the flake.
7172

7273
## 🐛 Known issues
7374

74-
- We use Bun as internal TypeScript processor, but can't use it as bundler yet.
75-
- `"@playform/compress": "=0.0.12"` because `0.0.13` doesn't properly compress
76-
CSS.
75+
- The build process uses Bun as internal TypeScript processor, but can't use it
76+
as bundler yet.
77+
- `"@playform/compress": "=0.0.12"` because `0.0.13` doesn't compress CSS.

docs/astro.config.mjs

+29-4
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ export default defineConfig({
117117
label: "Kubernetes example",
118118
link: "/guides/kubernetes",
119119
},
120-
{
121-
label: "Contributing",
122-
link: "/guides/contributing",
123-
},
124120
],
125121
},
126122
{
@@ -129,6 +125,10 @@ export default defineConfig({
129125
// explain design decisions, constraints, etc.
130126
label: "Understanding NativeLink",
131127
items: [
128+
{
129+
label: "Architecture",
130+
link: "/explanations/architecture/",
131+
},
132132
{
133133
label: "Local Remote Execution",
134134
link: "/explanations/lre/",
@@ -139,6 +139,31 @@ export default defineConfig({
139139
},
140140
],
141141
},
142+
{
143+
label: "For Contributors",
144+
items: [
145+
{
146+
label: "Contribution Guidelines",
147+
link: "contribute/guidelines/",
148+
},
149+
{
150+
label: "Working on documentation",
151+
link: "contribute/docs/",
152+
},
153+
{
154+
label: "Develop with Nix",
155+
link: "contribute/nix/",
156+
},
157+
{
158+
label: "Develop with Bazel",
159+
link: "contribute/bazel/",
160+
},
161+
{
162+
label: "Developing with Cargo",
163+
link: "contribute/cargo/",
164+
},
165+
],
166+
},
142167
{
143168
// Corresponds to https://diataxis.fr/reference/. Technical
144169
// descriptions with the intent to be used as consulting material.

0 commit comments

Comments
 (0)