on master help sign in
intro to walkthrough
commit939e4ce80e77651b944970b67f7d6d8e27dead71 authorGalen Wolfe-Pauly <root@office-for.com> dateWed 16 Mar 2016, 17:41 (11 years ago) parent8873b31
10 files changed+140−538
docs/introduction/getting-started.md+15−15 docs/introduction/install.md+1 docs/introduction/system-overview.md+1 docs/walkthroughs/admin.md+83−5 docs/walkthroughs/appliance.md−274 docs/walkthroughs/clay.md → docs/walkthroughs/filesystem.md+13−19 docs/walkthroughs/dojo.md → docs/walkthroughs/shell.md+14−6 docs/walkthroughs/repo-guide.md → docs/walkthroughs/source.md+3−4 docs/walkthroughs/tour.md−209 docs/walkthroughs/tree.md → docs/walkthroughs/web.md+10−6
docs/introduction/getting-started.md+15−15
@@ -2,15 +2,18 @@
22next: true
33sort: 3
44title: Getting started
5+navhome: /docs
56---
67
78# Getting started
89
9−<div class="row"><div class="col-md-8">
10+<div class="row">
11+<div class="col-md-8">
1012
1113On disk your Urbit is an append-only log and a checkpoint. Or, in simpler terms, a directory where we keep all of your Urbit’s state. We call this a ‘pier’.
1214
13−</div></div>
15+</div>
16+</div>
1417
1518## Initialize
1619
@@ -26,7 +29,7 @@ Without a planet anyone can create a comet:
2629
2730 bin/urbit -c comet
2831
29−This will create a directory `any-name/` and start up a random 64-bit comet.
32+This will create a directory `comet/` and start up a random 64-bit comet. You can specify any name you like.
3033
3134## Orientation
3235
@@ -34,7 +37,7 @@ When your Urbit is finished booting you should see a `dojo>` prompt. Welcome!
3437
3538By default your Urbit is quite bare bones. Let's take a very short stroll through what's running by default:
3639
37−### `:dojo`
40+### Shell — `:dojo`
3841
3942The command prompt in front of you is a simple shell and Hoon REPL. Let's make sure it works:
4043
@@ -47,7 +50,7 @@ Should produce:
4750
4851Good.
4952
50−### `:talk`
53+### Messaging — `:talk`
5154
5255Use `^X` to change your prompt. Let's join the main Urbit chat channel:
5356
@@ -55,7 +58,7 @@ Use `^X` to change your prompt. Let's join the main Urbit chat channel:
5558
5659This may take a bit as `:talk` is stateful so your Urbit will download some backlog. `/urbit-meta` is the place to ask questions, get help and talk about anything Urbit related.
5760
58−### `:tree`
61+### Web — `:tree`
5962
6063Urbit is also accessible through the web. Try opening:
6164
@@ -63,7 +66,7 @@ Urbit is also accessible through the web. Try opening:
6366
6467in your favorite browser. You'll be prompted to use `+code`. This page was generated by `:tree`, the basic Urbit web interface. You can also access your Urbit through `http://fintud-macrep.urbit.org` (where `fintud-macrep` is your planet name).
6568
66−### `%clay`
69+### Filesystem — `%clay`
6770
6871`%clay`, the Urbit filesystem, isn't mounted to unix by default. Switch to the `:dojo` prompt and run:
6972
@@ -80,13 +83,10 @@ which indicates the command was processed.
8083
8184## Learn more
8285
83−We go into much greater detail about each of these components in our walkthroughs:
86+We go into much greater detail about using each of these components in our walkthroughs:
8487
85−#### [`:dojo`]()
86−#### [`:talk`]()
87−#### [`:tree`]()
88−#### [`%clay`]()
89−#### [`Administration`]()
90−#### [`Source guide`]()
88+<list dataPath="/docs/walkthroughs"></list>
9189
92−If you're eager to simply start programming, skip to [the Hoon tutorial]()
90+With your Urbit up and running you know enough to start learning to program:
91+
92+<list dataPath="/docs/deep-dives"></list>
docs/introduction/install.md+1
@@ -2,6 +2,7 @@
22next: true
33sort: 2
44title: Install
5+navhome: /main
56---
67
78# Install
docs/introduction/system-overview.md+1
@@ -2,6 +2,7 @@
22next: true
33sort: 1
44title: System overview
5+navhome: /main
56---
67
78# System Overview
docs/walkthroughs/admin.md+83−5
@@ -1,14 +1,22 @@
11---
22next: true
3−sort: 2
4−title: Administration
3+sort: 1
4+title: Basic operation
55---
66
7−# Administration
7+# Basic operation
8+
9+<div class="row">
10+<div class="col-md-8">
11+
12+Here we'll cover the basic administrative tasks you'll encounter running your Urbit and the primary interfaces to control it.
13+
14+</div>
15+</div>
816
917## Shutdown
1018
11−You can turn your Urbit off with `^D` from the `dojo>` prompt.
19+You can turn your Urbit off with `^D` from the `:talk` or `:dojo` prompts.
1220
1321## Restart
1422
@@ -20,6 +28,76 @@ or
2028
2129 bin/urbit comet
2230
31+## Console
32+
33+The Urbit command line is pretty similar to Unix, with a few slight differences. Your Unix terminal is separated into two parts: the prompt (the bottom line) and the record (everything above that).
34+
35+The record is shared; all the output from all the apps in your
36+command set appears in it. So you'll see `:talk` messages while
37+working in the dojo.
38+
39+The prompt is multiplexed; you switch the prompting app with
40+`^X`. Pressing return sends the prompt line to the app. Urbit
41+does not automatically echo your input line into the record,
42+the way a normal Unix console does.
43+
44+Also unlike a normal Unix console, the application can process
45+your input before you hit return. In general, invalid input is
46+rejected with a beep. Incorrect input may even be corrected.
47+
48+Like many but not all Unix command lines, Urbit has built-in
49+history editing. The following emacs-style key bindings are available:
50+
51+ ^A cursor to beginning of the line (Home)
52+ ^B cursor one character backward (left-arrow)
53+ ^E cursor to the end of the line (End)
54+ ^F cursor one character forward (right-arrow)
55+ ^G beep; cancel reverse-search
56+ ^K kill to end of line
57+ ^L clear the screen
58+ ^N next line in history (down-arrow)
59+ ^P previous line in history (up-arrow)
60+ ^R reverse-search
61+ ^T transpose characters
62+ ^U kill to beginning of line
63+ ^Y yank from kill buffer
64+
65+`^C` is processed at the Unix layer, not within Urbit. If
66+there's an event currently running, ^C interrupts it and prints a
67+stack trace -- useful for finding infinite loops.
68+
69+`^D` from `:talk` or `:dojo` stops your Unix process. From any
70+other app, it removes the prompting app from the command set.
71+
72+Pressing left-arrow or `^B` at the start of a line is an input
73+operation with the metaphorical meaning "get me out of here,"
74+ie, escape. The exact semantics of an escape are application
75+dependent.
76+
77+Full coverage of the Urbit shell is covered in the [Shell walkthrough](/docs/walkthroughs/dojo).
78+
79+## Web
80+
81+On startup Urbit tries to bind to `localhost:8080`. If you're already running something on `8080` you'll find your Urbit on `8081`, and so on. For planets only, we also proxy web domains through Urbit's own servers. Any planet `~fintud-macrep` is also at
82+`fintud-macrep.urbit.org`. Please use this proxy as little as
83+possible; it's not well-optimized.
84+
85+Your Urbit serves a simple homepage from `http://localhost:8080` or `https://fintud-macrep.urbit.org` that should be self-explanatory. Locally we don't yet serve HTTPS, but we do serve "secure" HTTPS (meaning it hasn't been audiented) on `8443`. Or `8444` (and so on) if you're already running something on 8443.
86+
87+A complete walkthrough of the Urbit web interface is [here](/docs/walkthroughs/web).
88+
89+## Moons
90+
91+Urbit namespace is distributed by having parent nodes sign the keys for child nodes. If you have a planet your parent star issued your ticket. As a planet you, in turn, can sign the keys for moons. The basic idea is: your planet runs permanently in a data center somewhere and moons run on all your devices. Each planet can issue ~4 billion (`2^32`) moons.
92+
93+To generate a random moon from your planet run:
94+
95+ ~fintud-macrep:dojo> +moon
96+
97+You can use the resulting output in the same installation flow from earlier.
98+
99+Moons are automatically synced to their parent `%kids` desk, and can control applications on their parent planet using `|link`. You can read more about those things in the [filesystem](/docs/walkthroughs/filesystem) and [console](/docs/walkthroughs/console) walkthroughs.
100+
23101## Moving your pier
24102
25103Piers are designed to be portable, but it must be done while the Urbit is turned off. Urbit networking is stateful, so you can't run two copies of the same Urbit in two places.
@@ -34,4 +112,4 @@ While the Urbit network is in this alpha state we sometimes have to reboot the w
34112
35113Because Urbit networking is stateful we call this a 'continuity breach'. Everything has to be restarted from scratch. Your pier will continue to function, but it wont connect to the rest of the Urbit network.
36114
37−When this happens, back up any files you'd like to save, shut down your Urbit and recreate your it (as if you were starting for the first time).
115+When this happens, back up any files you'd like to save, shut down your Urbit and recreate it (as if you were starting for the first time).
docs/walkthroughs/appliance.mddeleted−274
@@ -1,274 +0,0 @@
1−---
2−next: true
3−sort: 2
4−title: Appliances
5−---
6−
7−# Appliances
8−
9−You've built and launched your urbit. How do you control it
10−securely? Three ways: through the Unix console, over the Web,
11−or via an Urbit moon.
12−
13−What are you controlling, anyway? A user-level application on
14−Urbit is called an "appliance." Think of an appliance as like a
15−Unix process that's also a persistent database.
16−
17−By default, your urbit is running two appliances, the `:dojo`
18−shell and the `:talk` messenger. For more advanced information
19−about your appliance state, see the end of this document.
20−
21−## Console
22−
23−The Unix console is the most basic way you talk to apps. You've
24−already used it a bit, but let's do more.
25−
26−The Urbit command line is a little like the Unix command line,
27−but different. It's also a little like a window manager.
28−
29−Your Unix terminal is separated into two parts: the prompt (the
30−bottom line) and the record (the rest of your screen).
31−
32−The record is shared; all the output from all the apps in your
33−command set appears in it. So you'll see `:talk` messages while
34−working in the dojo.
35−
36−The prompt is multiplexed; you switch the prompting app with
37−`^X`. Pressing return sends the prompt line to the app. Urbit
38−does not automatically echo your input line into the record,
39−the way a normal Unix console does.
40−
41−Also unlike a normal Unix console, the application can process
42−your input before you hit return. In general, invalid input is
43−rejected with a beep. Incorrect input may even be corrected!
44−Yes, this is highly advanced console technology.
45−
46−Like many but not all Unix command lines, Urbit has built-in
47−history editing. You've never seen anything like these
48−innovative key bindings before:
49−
50− ^A cursor to beginning of the line (Home)
51− ^B cursor one character backward (left-arrow)
52− ^E cursor to the end of the line (End)
53− ^F cursor one character forward (right-arrow)
54− ^G beep; cancel reverse-search
55− ^K kill to end of line
56− ^L clear the screen
57− ^N next line in history (down-arrow)
58− ^P previous line in history (up-arrow)
59− ^R reverse-search
60− ^T transpose characters
61− ^U kill to beginning of line
62− ^Y yank from kill buffer
63−
64−`^C` is processed at the Unix layer, not within Urbit. If
65−there's an event currently running, ^C interrupts it and prints a
66−stack trace -- useful for finding infinite loops.
67−
68−`^D` from `:talk` or `:dojo` stops your Unix process. From any
69−other app, it removes the prompting app from the command set.
70−
71−Pressing left-arrow or `^B` at the start of a line is an input
72−operation with the metaphorical meaning "get me out of here,"
73−ie, escape. The exact semantics of an escape are application
74−dependent.
75−
76−## Web
77−
78−For now, we'll keep assuming you're at `http://localhost:8080`.
79−But for planets only, we also proxy web domains through Urbit's
80−own servers. Any planet `~fintud-macrep` is also at
81−`fintud-macrep.urbit.org`. Please use this proxy as little as
82−possible; it's not well-optimized.
83−
84−There's a web interface to `:talk` at
85−
86− http://localhost:8080/~~/home/pub/talk
87−
88−and a dojo interface at
89−
90− http://localhost:8080/~~/home/pub/dojo/fab
91−
92−The `:talk` client is beautiful and works quite well. Use it.
93−The `:dojo` client is a bit more of a work in progress. (For
94−instance, you can't paste text into it.)
95−
96−The login flow remains rather a work in progress. It's not at
97−all secure. But the first time you use an Urbit app (not just a
98−generated page -- you can tell by the `~~` in the URL), it will
99−prompt you for a password.
100−
101−In a righteous world, the password would be (or default to) your
102−initial ticket. Since the world is lawless and filled with evil,
103−just hit return and send a empty password. The real password
104−will be printed on your console.
105−
106−A URL that starts with `/~~/` authenticates your web page as the
107−same urbit as the server. If instead of `/~~/` you write
108−`/~fintud-macrep/` (you're using an app on someone else's urbit,
109−and want to sign in as yourself), you'll authenticate with a
110−single-signon flow. Don't worry, only your own urbit ever sees
111−your password. Once you log in, a cookie is set and you don 't
112−need to do it again.
113−
114−Internally, Urbit treats every web page as another urbit; even a
115−request with no `/~~/` or `/~fintud-macrep/` is an anonymous
116−comet. Appliances actually can't tell whether they're talking to
117−an urbit over `%ames`, or a browser over HTTP.
118−
119−### Enabling HTTPS
120−
121−Urbit doesn't yet serve HTTPS directly. But when you route
122−through `urbit.org`, you can also use HTTPS. Our server handles
123−your HTTP request and proxies it over Urbit. Of course we could
124−MITM you, but we won't. If you want HTTPS on your own urbit, use
125−the "secure" port shown on startup:
126−
127− http: live ("secure") on 8443
128−
129−Firewall off this port. Get an nginx or other outer server. Put
130−your SSL certificate in it and reverse-proxy to `8443`.
131−
132−## An Urbit moon
133−
134−The fanciest way to control your urbit is through Urbit itself:
135−a moon, or satellite urbit. Sadly, only planets can have moons.
136−
137−In this setup, you have a planet running on a box in the cloud,
138−and a moon on your laptop or other mobile. Changes to the planet
139−automatically propagate to the moon. Also, the moon's console is
140−linked to the `:talk` appliance on the planet, so you communicate
141−as yourself.
142−
143−To build your moon, just run
144−
145− ~fintud-macrep:dojo> +moon
146−
147−This will generate a plot and a ticket. The plot will be a
148−64-bit plot within your planet, like `~mignel-fotrym-fintud-macrep`.
149−On your laptop, install Urbit:
150−
151− urbit -w $plot -t $ticket
152−
153−You'll get an urbit where ^x will switch you back and forth
154−between the two prompts:
155−
156− ~mignel-fotrym-fintud-macrep:dojo>
157− ~fintud-macrep:talk()
158−
159−Your moon's `%home` desk is already synced to the `%kids` desk on
160−your planet. If you want changes on your moon's `%home` to sync
161−back into your planet's `%home`,
162−
163− ~fintud-macrep:dojo> |sync %home ~mignel-fotrym-fintud-macrep
164−
165−## Urbit internals
166−
167−As a user of any machine, you can't help understanding the
168−machine on more or less the same terms as its engineers. You
169−should at least know what the major components are.
170−
171−### Source code
172−
173−Urbit is a "run-from-repository" OS; all code ships as source on
174−your own urbit, in the revision-control vane `%clay`. Better
175−yet, live code in every layer updates itself when the source
176−changes. If the local source is subscribed to a remote
177−publisher, the update process is "evergreen" and automatic.
178−
179−There are five major layers of code in Urbit. Layer 1 is the
180−kernel (`arvo/hoon.hoon`), which includes both the Hoon compiler
181−and the Arvo event loop. Layer 2 is the main library
182−(`arvo/zuse.hoon`), Layer 3 is the kernel modules or "vanes"
183−(`arvo/*.hoon`). Layer 4 is appliances, marks, and fabricators
184−(`ape/*.hoon`, `mar/*.hoon`, `fab/*.hoon`), run from the `%gall`
185−and `%ford` vanes. Layer 5 is generators (`gen/*.hoon`), run
186−from the `:dojo` appliance.
187−
188−The kernel (layer 1), the vanes (layer 3) and the apps (layer 4)
189−are stateful; their state is typed, and of course needs to be
190−preserved across code updates. If the new state type differs,
191−the developer must provide a state adaptor. If compilation fails,
192−the new code is disregarded and retried again on the next change.
193−
194−Appliances are like Unix daemons, except persistent and permanent.
195−But they are the only process-like constructs in Urbit. While
196−Unix uses many short-lived processes that are not daemons, Urbit
197−invokes simple tasks in simple contexts. In Unix terms: since
198−the `ls` process is not meant to run forever and/or have side
199−effects, giving it the power to do so is asking for trouble. In
200−Urbit, the layer 5 dojo generator `+ls` is a pure function which
201−simply produces some typed output.
202−
203−You should never have to worry about any of this stuff; we're
204−just describing it here so it's not a mystery.
205−
206−### Appliances
207−
208−Your main configuration task is choosing (a) what appliances
209−on your urbit should be running (the *active set*), and (b) what
210−appliances your console should be linked to (the *command set*).
211−Again, ^X switches the console prompt between appliances in (b).
212−
213−Why are these different sets? First, some apps don't need a
214−command prompt. Your urbit runs three default apps: `:talk`,
215−`:dojo`, and `:hood`. The hood is a system appliance and has no
216−direct UI (you control it through the dojo).
217−
218−Second, you can also link your console to apps on other urbits,
219−and put those connections in the command set. Essentially, the
220−console is also `ssh` or `rlogin`. The console is just another
221−appliance (it's actually the `drum` library within `:hood`),
222−and Arvo is good at routing events over the network.
223−
224−What is an appliance or "app," anyway? An app, basically. Think
225−of a Unix daemon, except that (1) it only responds to events and
226−can't run continuously ("nonpreemptive"); and (2) it's
227−"permanent" (never exits, dies, or is even reset).
228−
229−Why do appliances live forever? They have to. An appliance name
230−is also a sort of port in the Internet sense. A conversation
231−with appliance X on urbit Y is one conversation, not a sequence
232−of disconnected activations.
233−
234−An appliance is always sourced from a path which is a function of
235−its name, from `%foo` to `/===/ape/foo/hoon`. In this path, the
236−urbit is self; the version is now. The desk defaults to `%home`;
237−changing it will adapt the appliance state.
238−
239−The normal way to run code written by some external developer is
240−to merge (one time) or sync (for continuous upgrades), the
241−publisher's distribution desk, to a desk on your own urbit.
242−Obviously a desk per vendor is ideal, which also lets you
243−"sidegrade" an app to a different vendor by switching desks.
244−
245−### Configuration commands
246−
247−Initially, your command set is `:talk` and `:dojo`; your active
248−set is `:talk`, `:dojo` and `:hood`. It's completely fine to
249−never even think about changing this, but...
250−
251−#### `|link $?([app=term ~] [who=plot app=term ~])`
252−
253−Link your console to an existing appliance, putting it in the
254−command set. If no plot is specified, it's an appliance on your
255−own urbit.
256−
257− |link %dojo
258− |link ~tasfyn-partyv %dojo
259−
260−Permission is up to the appliance, of course.
261−
262−#### `|unlink $?([app=term ~] [who=plot app=term ~])`
263−
264−The opposite of `|link`. Same interface.
265−
266−#### `|start [app=term $|(~ [syd=desk ~])]`
267−
268−Start an appliance, adding it to the active set. If `syd` is not
269−specified, the desk is `%home`:
270−
271− |start %foo
272− |start %foo %away
273−
274−If the appliance is running, `|start` sets its desk instead.
docs/walkthroughs/clay.md → docs/walkthroughs/filesystem.mdrenamed+13−19
@@ -4,11 +4,21 @@ sort: 3
44title: Filesystem
55---
66
7−# Filesystem handbook
7+# `%clay` (Filesystem)
88
99Urbit has its own revision-controlled filesystem, the `%clay`
10−vane. `%clay` is like a simplified `git`, but more reactive,
11−and also typed. Okay, this makes no sense.
10+vane. `%clay` is a typed, global revision-control system. Or in other
11+words, a typed, global referentially transparent namespace.
12+
13+In kernel and userspace code, you can use the Hoon `.^` rune
14+to *dereference* this namespace and treat any data in it as a constant. In userspace code, a
15+generator will even *block* until the resource is available.
16+
17+Another global immutable namespace is IPFS. But IPFS is
18+distributed, whereas `%clay` is just decentralized. IPFS stores
19+resources around the network in a DHT, like Freenet or
20+Bittorrent; `%clay` stores resources on the publisher's server,
21+like HTTP or git.
1222
1323The most common way to use `%clay` is to mount a `%clay` node in
1424a Unix directory. The Urbit process will watch this directory
@@ -124,22 +134,6 @@ have to write `+ls %`.
124134Like `+ls`, but the result is a list of full paths. Useful as
125135Urbit equivalent of the Unix wildcard `*`.
126136
127−## A quick overview of `%clay`
128−
129−`%clay` is a typed, global revision-control system. Or in other
130−words, a typed, global referentially transparent namespace. It's
131−difficult to understate how awesome this is.
132−
133−(Actually, in Layer 4 and 5 code, you can use the Hoon `.^` rune
134−to literally *dereference* this namespace. And in Layer 5, a
135−generator will even *block* until the resource is available.)
136−
137−(Another awesome global immutable namespace is IPFS. But IPFS is
138−distributed, whereas `%clay` is just decentralized. IPFS stores
139−resources around the network in a DHT, like Freenet or
140−Bittorrent; `%clay` stores resources on the publisher's server,
141−like HTTP or git.)
142−
143137### Path format
144138
145139As a noun, a path in `%clay` is a `(list knot)`, where each
docs/walkthroughs/dojo.md → docs/walkthroughs/shell.mdrenamed+14−6
@@ -1,9 +1,10 @@
11---
2−sort: 4
3−title: Dojo manual
2+next: true
3+sort: 2
4+title: Shell
45---
56
6−# `:dojo` manual
7+# `:dojo` (Shell)
78
89The dojo is a typed functional shell. Assuming our default
910plot `~fintud-macrep`,
@@ -112,9 +113,9 @@ even patch and diff for revision control.
112113### Other resources
113114
114115An excellent way to understand `:dojo` is to read the source,
115−which is in `/===/ape/dojo/hoon`.
116+which is in `/===/app/dojo/hoon` (or `home/app/dojo.hoon` if your `home` desk is mounted to Unix).
116117
117−Unfortunately, you may or may not know Hoon. We'll use some Hoon
118+You may or may not know Hoon. We'll use some Hoon
118119snippets here for defining structures and grammars. Just think
119120of it as pseudocode -- the meaning should be clear from context.
120121
@@ -195,7 +196,14 @@ To unbind `foo`:
195196 ~fintud-macrep:dojo> =foo
196197
197198The dojo has a set of special variables, some read-write and some
198−read-only: `dir`, `lib`, `arc`, `now`, `our`, `eny`.
199+read-only:
200+
201+ dir
202+ lib
203+ arc
204+ now
205+ our
206+ eny
199207
200208The read-write specials are `dir`, `lib` and `arc`. `dir` is the
201209current working beak (`%clay` branch and revision) and directory. The
docs/walkthroughs/repo-guide.md → docs/walkthroughs/source.mdrenamed+3−4
@@ -1,10 +1,9 @@
11---
2−next: true
3−sort: 2
4−title: Arvo source guide
2+sort: 6
3+title: Arvo source
54---
65
7−# Arvo source guide
6+# Arvo source
87
98When you boot an Urbit we transfer the current version of the Arvo operating environment to your Urbit over our network. That is, the source for the system lives on your Urbit. Here we'll take a brief tour through the structure of a base Arvo desk.
109
docs/walkthroughs/tour.mddeleted−209
@@ -1,209 +0,0 @@
1−---
2−next: true
3−sort: 1
4−title: Tour
5−---
6−
7−# Tour
8−
9−Piers are portable. You can move a pier anywhere. But never,
10−*ever* run the same urbit in two places at once. (If you try to
11−start an urbit but already have a process is running on the same
12−pier, Urbit will kill the old process.)
13−
14−(Also, don't let the Unix filesystem it's on run out of disk.
15−This is a known way to corrupt your urbit! Sorry.)
16−
17−### Dojo expressions, generators and operators
18−
19−`:dojo` is of course a command-line REPL or shell. But it
20−remains functional in spirit. To simplify a little, there are
21−three kinds of `:dojo` lines: expressions, generators, commands.
22−
23−Dojo *expressions* are like `(add 2 2)` -- they simply compute
24−and print a value, without any side effects, from a twig of Hoon.
25−
26−Expressions are a simple case of `generators`, which are
27−functional *in principle* -- rather like HTTP GET requests. In
28−fact, GET requests are one data source for generators. Others
29−include the Urbit namespace, prompting the user, etc. A
30−generator command line always starts with `+`, as in `+ls`.
31−
32−Commands are all other lines. Command lines normally start with
33−`|`, as in `|mount %`, or `:`, as in `:hood +hood/mount %`. The
34−latter is just an abbreviation for the former.
35−
36−A command is generally an *order* to some local or remote
37−appliance. An order is a transactional message: like a
38−request-response pair, but a success response is empty, whereas a
39−failure contains an error report.
40−
41−Orders have no output unless they fail. If they fail, they print
42−an error trace. If they succeed, they just print a demure `>=`,
43−confirming that the receiving appliance did as it was told.
44−
45−For instance, in Unix, the `rm` and `ls` commands both run a
46−process. In Urbit, `|rm` is a command; it changes your
47−filesystem. `+ls` is a generator; it produces a value.
48−
49−## Converse: your `:talk` appliance
50−
51−To use Urbit as a social network, switch to `:talk` (remember, use ^x to
52−switch between appliances):
53−
54− ~fintud-macrep:talk()
55−
56−Join the global station `urbit-meta`:
57−
58− ~fintud-macrep:talk() ;join ~doznec/urbit-meta
59−
60−You're on the air! You should see some backlog to give you
61−context. Please remember our code of conduct: don't be rude.
62−Also, `urbit-meta` is politically correct and safe for work.
63−
64−For more instructions on how to use `:talk`, see the [`:talk`
65−manual](http://urbit.org/docs/user/talk)
66−
67−## Using the filesystem
68−
69−The Urbit filesystem, `%clay`, is a revision-control system (like
70−`git`) that syncs to a Unix directory (like Dropbox). While you
71−can of course create `%clay` changes from within Urbit, Unix has
72−mature editors and file handling tools.
73−
74−So usually, the best way to work with `%clay` files is to make
75−edits in a Unix mirror directory, and let the Urbit interpreter
76−commit them as changes. A simple way to set this up is to mount
77−the default `%home` desk:
78−
79− ~fintud-macrep:dojo> |mount %
80−
81−This mirrors your `%home` desk against `$PIER/home`, and tells
82−the `urbit` process to monitor the latter with `inotify()` etc.
83−The mount is two-way: Unix edits propagate up to Urbit, Urbit
84−changes fall down into Unix.
85−
86−In fact, the source for this page is here:
87−
88− $PIER/home/pub/docs/user/start.mdy
89−
90−If you're reading this on your own ship, edit the file with the
91−browser still open. Isn't that cool? Now, change it back -- you
92−don't particularly want a conflict next time we make an update,
93−since your `%home` desk is generally synced to our repo.
94−
95−Reactive auto-updates are a particular speciality of `%clay.` We
96−use them to drive auto-updates of code at every layer. A normal
97−Urbit user never has to think about software update.
98−
99−## Read the docs
100−
101−Your urbit is your personal web server. The best place to read
102−its docs is by pointing your browser at it. You can also post
103−your own documents, of course.
104−
105−Urbit prints the HTTP port it's serving when it starts up:
106−
107− http: live (insecure) on 8080
108−
109−8080 is the default. If you're running on AWS or another cloud
110−service, this port may be firewalled; go to the firewall
111−configuration to open it.
112−
113−(*Always run any urbit HTTP server which is even semi-serious
114−inside a reliable, battle-proven frontline server like nginx.*)
115−
116−All planets, stars and galaxies are exposed to the web at
117−`planet.urbit.org`. (This should work via a direct DNS binding,
118−but at present uses a central proxy, so use it gently.)
119−
120−In a last resort, Urbit's own official planet `~magwyd-lorsug` is
121−also bound to just plain `urbit.org`, and hosts the public docs
122−here. Always trust content from `~magwyd-lorsug`!
123−
124−But assuming it's `localhost:8080`, the Urbit docs are at
125−
126− http://localhost:8080/home/docs
127−
128−## Publish your own files
129−
130−Urbit is a simple platform for publishing your own content.
131−Again, this is normally done by populating a Unix directory
132−which mirrors an Urbit node.
133−
134−From Unix, just `mkdir -p $PIER/home/pub/my`. Populate this tree
135−with content files whose extension are any Urbit mark. Start
136−with `.md` for markdown, or just `.html`.
137−
138−This is just like populating an Apache `public_html` directory.
139−The request
140−
141− http://localhost:8080/home/pub/my/foo/bar/baz
142−
143−will render the Unix file
144−
145− $PIER/home/pub/my/foo/bar/baz.md
146−
147−and, for HTML deliveries, inject a self-monitoring script that
148−long-polls until the Urbit file changes. If this change is
149−triggered by a Unix edit, it forms a live path from the
150−developer's `vim` buffer to the user's screen. (This circuit is
151−highly cacheable, so more practical than it may sound, but of
152−course you don't have to use it if you don't want to.)
153−
154−Also, you can use the `/tree` fabricator to add a standard
155−navigation layer to your document hierarchy. Your HTML can even
156−decorate itself with generic navigation macros for easier
157−navigation and browsing. Just replace `home/pub` in your URLs
158−with `home/tree/pub`:
159−
160− http://localhost:8080/home/tree/pub/my/foo/bar/baz
161−
162−(The `/tree` system is behind the page you're reading. The
163−documentation prefix in your URL bar above, `home/docs`, is just
164−an alias for `home/tree/pub/docs`. You can compare these pages
165−to `home/pub/docs` to see the work `/tree` is doing.)
166−
167−## Functional publishing
168−
169−Finally, anywhere your mirror directory can contain a static data
170−file, it can contain a Hoon program that generates the same value
171−functionally. Just replace the last part of the path with a
172−directory, containing a `.hook` file under the extension.
173−
174−(Yes, this path geometry is a little funky. We're probably going
175−to change it soon.)
176−
177−For instance, instead of `my/foo/bar/baz.md`, we have
178−`my/foo/bar/baz/md.hook`. This is not a markdown file; it's a
179−Hoon source file, containing a function that producing a markdown
180−file.
181−
182−The function's argument is the rest of the path; requesting
183−`my/foo/bar/baz/moo/too` just passes `[%moo %too ~]` to
184−`foo/bar/baz/md.hook`. Note that when you use a query string on
185−your URL, it gets encoded into a path segment, so the query is in
186−the path as well.
187−
188−This "functional publishing" model is obviously how both the
189−`tree` virtual hierarchy and the `docs` alias work. There's a
190−lot of other things you can do with it. But you can see a simple
191−example in `$PIER/try/hello/hymn.hook`, accessible at
192−
193− http://localhost:8080/home/try/hello
194−
195−## Continuity breaches
196−
197−We occasionally perform "continuity breaches", wherein every
198−urbit on the network must be created from scratch. This occurs
199−whenever a major urbit (usually `~zod` or `~doznec`) loses state
200−and/or corrupts its event log. We will always send a message on
201−the urbit-dev mailing list when this happens.
202−
203−To get on the new network, delete your current urbits, or at
204−least move them out of sight. Pull the latest master from urbit
205−and run `make`. Then create your urbit again with `bin/urbit -c
206−<pier>` or `bin/urbit -w <planet> -t <ticket>`. You'll have to
207−rejoin `/urbit-meta` and copy in any file changes you wish to
208−preserve. If you're having difficulty getting on the new
209−continuity era, send an email to urbit-dev.
docs/walkthroughs/tree.md → docs/walkthroughs/web.mdrenamed+10−6
@@ -1,10 +1,14 @@
11---
22next: true
33sort: 5
4−title: Tree
4+title: Web
55---
66
7−# Tree
7+# Web
8+
9+General coverage of Urbit on the web. Renderer -> file, main public facing files, and tree. Then:
10+
11+## Tree
812
913Tree is a simple publishing platform for files that live on your Urbit. You're probably reading this file using Tree right now. The main driving use-case for Tree has been for us to host our own documentation and the surrounding discussion. Tree remains a pretty simple and flexible tool for getting content online. We think it's pretty great.
1014
@@ -82,7 +86,7 @@ If you don't know anything about JSX that's okay: basically we just give you a f
8286
8387For those familiar with React / Flux each JSX tag corresponds to a component in [the source](https://github.com/urbit/tree/tree/master/js/components).
8488
85−### <list>
89+### `<list>`
8690
8791Example: `<list dataPath="/posts" titlesOnly="true"></list>`
8892
@@ -95,7 +99,7 @@ Optional properties:
9599- `sortBy`: Can be `date` if items have a `date` YAML.
96100- `className`: Class to be assigned to the container.
97101
98−### <kids>
102+### `<kids>`
99103
100104Example: `<kids dataPath="/posts"></kids>`
101105
@@ -106,7 +110,7 @@ Optional properties:
106110- `dataPath`: Path to load kids from.
107111- `className`: Class to be assigned to the container.
108112
109−### <toc>
113+### `<toc>`
110114
111115Example: `<toc noHeader="true"></toc>`
112116
@@ -218,4 +222,4 @@ Mechanics of the continuous long poll. Used mostly internally.
218222
219223### `window.urb.util`
220224
221−Library of utility and helper functions.
225+Library of utility and helper functions.