-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: minor refactor of pill documentation location and contents
- Loading branch information
1 parent
dcda575
commit e507b57
Showing
2 changed files
with
48 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,22 @@ | ||
# Running a pill with Ares | ||
# Making your own pill to run with Ares | ||
|
||
We can run a pill with Ares by performing a one-line modification to Vere in order | ||
to use Ares as a serf. This is accurate as of August 2023 - details may have | ||
changed since then. | ||
Ares development and testing, unlike regular development and ship operation, currently requires careful control over what pill is used to launch a ship. This document details how pills are created for the purposes of development and testing. | ||
|
||
We first cover how to run `rust/ares/test_data/baby.pill`, then | ||
`hoon/scaffolding/azimuth-pill.hoon`, and finally some information on how to | ||
make your own pill. | ||
## Example: `baby.pill` | ||
|
||
## Modify Vere | ||
`baby.pill` is an extremely minimal Arvo-shaped core and Hoon standard library equipped with `%sham` jets needed to run it. `~wicdev-wisryt`` [streamed a video](https://youtu.be/fOVhCx1a-9A) of its development. You can find the source Hoon for `baby.pill` in `resources/pills/src/baby/baby.hoon`, and the limited version of Hoon that it uses in `resources/pills/src/baby/cradle.hoon`. A pre-compiled `baby.pill` is already available at `resources/pills/baby.pill`. However, the steps to compile it yourself are documented below. | ||
|
||
Download the Vere repo and open `/pkg/vere/lord.c`. Search for `u3_lord_init()`. | ||
In this function definition, you will find several lines that look something | ||
like | ||
1. Boot a fake `zod` using an ordinary Urbit executable (not the one you created | ||
to run Ares as serf) | ||
2. Run `|mount %base` | ||
3. Copy the contents of `resources/pills/src/baby/` to `/path/to/fake/zod/base/lib/` | ||
4. Run `|commit %base` | ||
5. Run `.baby/pill -build-file %/lib/baby/hoon`. This will make a file named `baby.pill` in `/path/to/fake/zod/.urb/put/` | ||
|
||
``` | ||
arg_c[0] = god_u->bin_c; // executable | ||
arg_c[1] = "serf"; // protocol | ||
arg_c[2] = god_u->pax_c; // path to checkpoint directory | ||
arg_c[3] = key_c; // disk key | ||
arg_c[4] = wag_c; // runtime config | ||
... | ||
``` | ||
|
||
Change the right hand side of the first line to the path of the Ares executable | ||
as a string literal (probably something like `rust/ares/target/debug/ares`): | ||
|
||
``` | ||
arg_c[0] = "/path/to/ares"; | ||
``` | ||
|
||
Next we need to compile the new version of Vere that uses Ares as a serf. See | ||
[INSTALL.md](https://github.com/urbit/vere/blob/develop/INSTALL.md) in the Vere | ||
repo on how to do this. Now `cd` to the directory you'd like this version of | ||
Vere to reside in and make a symlink to the `urbit` executable you just | ||
created like so: | ||
|
||
``` | ||
ln -s path/to/vere/repo/bazel-bin/pkg/vere/urbit ares-urbit | ||
``` | ||
|
||
## Run `baby.pill` | ||
|
||
`baby.pill` is an extremely minimal Arvo-shaped core and Hoon standard library | ||
equipped with `%sham` jets needed to run it. ~wicdev-wisryt [streamed a | ||
video](https://youtu.be/fOVhCx1a-9A) of its development. You can find the Hoon | ||
for `baby.pill` in the Ares repo at `/hoon/scaffolding/baby.hoon`, and the | ||
library is `hoon/scaffolding/cradle.hoon`. | ||
|
||
The jammed pill is already in the Ares repo at `rust/ares/test_data/baby.pill`. | ||
To run it with our new version of Vere, we make a fakezod with `baby.pill` as | ||
the pill: | ||
|
||
``` | ||
./ares-urbit -F zod -B /path/to/ares/rust/ares/test_data/baby.pill | ||
``` | ||
|
||
This will boot a fakezod. If it writes `effect` to the terminal with every | ||
keystroke, you have succeeded! | ||
|
||
## Run `azimuth-pill.pill` | ||
|
||
Next we will show how to build a pill that processes an Azimuth snapshot, called | ||
`azimuth-pill.pill`. | ||
|
||
Boot a fakezod using the ordinary Urbit executable (not the one you created | ||
above) and run `|mount %`. | ||
|
||
Next, copy the contents of the `hoon/scaffolding/` folder from the Ares repo to | ||
`path/to/fakezod/base/lib` and run `|commit %base`, then | ||
You can now use this pill to boot a ship using your Vere + Ares executable: | ||
|
||
```bash | ||
./ares-urbit -F dev -B /path/to/fake/zod/.urb/put/baby.pill | ||
``` | ||
.azimuth-pill/pill -build-file %/lib/azimuth-pill/hoon | ||
``` | ||
|
||
This will make a file `azimuth-pill.pill` in `path/to/fakezod/.urb/put`. | ||
|
||
Now we can run this pill with the version of Vere we built above: | ||
|
||
``` | ||
./ares-urbit -F dev -B /path/to/fakezod/.urb/put/azimuth-pill.pill | ||
``` | ||
|
||
If you succeeded, you should see the standard boot header followed by `ran a | ||
thousand logs` every few moments. If you're running an optimized build (e.g. | ||
`opt-level = 3`) of Ares this should finish in a few minutes or less. If you're | ||
running an unoptimized build (e.g. `opt-level = 0`) this could take much longer. | ||
|
||
## Making your own pill | ||
|
||
At time of writing, most jets have not yet been ported to Ares and so you cannot | ||
boot a typical solid pill. However, following the example of `baby.pill` and the | ||
development video linked above, and making use of the simplified standard libary | ||
`cradle.hoon`, you can still get Ares to run some interesting non-trivial Hoon. | ||
|
||
After making your own pill, you can write it to disk with `.my-pill/pill | ||
-build-file /path/to/my/pill` from a fakezod, and then run it just like you did | ||
with `baby.pill` and `azimuth-pill.pill` above. | ||
If it writes `effect` to the terminal with every keystroke, you have succeeded! |