Urbit

Purpose

Ease your organization into Urbit by using the Urbit ID system to validate users. Use the Landscape viewer to distribute software - in this case a simple hyperlink to an internally developed web app. No hoon coding required. The web app must be modified to accept white listed Urbit IDs.

Prepare Linux

The following is a modification of the hello app found on developers.urbit.org. I am starting with a new instance of Debian 11 on AWS. Note that some of the commands below will need to be modified with your AWS credentials, configuration. This video walks through the process.

Update, install some utilities and create a swap space:

1
2
3
4
5
6
7
sudo apt-get update
sudo apt-get install git

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

edit fstab:

1
sudo nano /etc/fstab

add the following line:

/etc/fstab
1
/swapfile swap swap defaults 0 0

Prepare new desk contents

Clone the required desks and merge them into your project desk OR git clone the limsn project and apply modifications. Note that this process slightly differs from developers.urbit.org which is out of date:

1
2
3
4
5
6
7
8
9
10
11
12
13
projects$ git clone https://github.com/urbit/urbit urbit-git
projects$ git clone https://github.com/tloncorp/landscape

projects$ mkdir urblimsn

cp -rfL /home/mbc/projects/urbit-git/pkg/base-dev/* /home/mbc/projects/urblimsn
cp -rfL /home/mbc/projects/landscape/desk-dev/* /home/mbc/projects/urblimsn

projects/urblimsn$ echo "[%zuse 415]" > sys.kelvin
projects/urblimsn$ echo "~zod" > desk.ship

projects/urblimsn$ nano desk.docket-0

Modify the contents of desk.docket-0 to suit your needs:

desk.docket-0
1
2
3
4
5
6
7
8
9
10
11
:~  title+'LIMS*Nucleus'
info+'A link to LIMS*Nucleus Web App.'
color+0x81.88c9
image+'https://github.com/mbcladwell/limsn/raw/main/limsn/pub/img/las-walpha-small.png'
base+'limsn'
glob-ames+[~zod 0v0]
version+[0 0 1]
website+'https://github.com/mbcladwell/urblimsn'
license+'MIT'
==

The merged desks, auxilliary files and glob can be cloned, see below.

Prepare fake zod

Start up a fake zod, create and mount a new desk, delete the desk and git clone its replacement:

1
2
3
4
5
6
curl -L https://urbit.org/install/linux-x86_64/latest | tar xzk --transform='s/.*/urbit/g' && ./urbit
./urbit -F zod
~zod:dojo>|new-desk %limsn
~zod:dojo>|mount %limsn

Ctrl-d (to kill zod)

cd into zod and delete the new desk. git clone its replacement. The cloned directory contains the merged dev desks, desk.ship etc. as well as a glob:

1
2
3
4
cd ./zod
zod$ rm -rf ./limsn
zod$ git clone https://github.com/mbcladwell/urblimsn.git limsn
cd ..

Get the glob out of the desk or the desk will not compile:

1
$ mv ./zod/limsn/glob .

On local machine transfer glob to local machine:

1
scp -r -i labsolns.pem admin@ec2-3-145-214-48.us-east-2.compute.amazonaws.com:./glob . 

On zod:

1
2
~zod:dojo>|commit %limsn
~zod:dojo>|install our %limsn

Assuming fake zod is on your local machine you can point your browser to localhost:8080 and see landscape with a new LIMS*Nucleus tile with spinner indicating “loading”. For AWS I use my temporary IP: http://3.142.185.219:8080.

To complete the install you must upload the glob. First modify index.html to suit your needs:

index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script src="https://unpkg.com/@urbit/http-api"></script>
<script src="/session.js"></script>
</head>
<body>
</body>
<script>
location.replace('http://3.145.214.48:3000/urbit?name=' + window.ship);
</script>
</html>

The javascript helper scripts are discussed in the http api guide. Note the ‘window.ship’ variable which provides the ship name (‘zod’ in this example) for appending to your web app’s urbit controller. In LIMS*Nucleus, urbit ids must be white listed in the ‘person’ table:

1
2
3
4
5
6
7
8
9
10
11
lndb=> select * from person;
id | lnuser | passwd | salt | email | usergroup
----+----------+------------------+------------------+-------------------+-----------
1 | ln_admin | 1d52114553ae31b3 | a39b69e5fd79854b | info@labsolns.com | admin
2 | ln_user | ca6468f6ff4a82e6 | e999f4c34635f943 | | user
3 | demo | 97f8647f1067346d | 55ecb01c50cb1ae1 | | user
7 | zod | 1f4973fea4b98a05 | 616c7e5555c1df62 | | admin
8 | nus | 9a58637cbeab8afc | 8e4d24fcb45af66c | | user
(5 rows)

lndb=>

Note the the urbit ID password hashes are a hash of the salt only as the password is blank. Urbit users come to the app prevalidated.

To upload the glob navigate to localhost:8080/docket/upload, select the limsn desk, press browse and select the glob directory and press the “glob!” button. Returning to zod you should now see:

Click on the LIMS*Nucleus tile and you will be redirected to the web app and logged in.

To allow zod to distribute this link, at the dojo:

1
~zod:dojo>:treaty|publish %limsn

Now if I create a fake ~nus on the same instance of AWS but broadcast on port 8081, I can query ~zod on 8080 for software offered. We can piggyback on the Urbit desk distribution mechanism to distribute software - though in this example we are simply distributing a hyperlink allowing redirection: