Your phone is the terminal. Stream a Linux/Mac desktop to an iPhone over WebRTC through NAT, with audio and input. Open source, single binaries.

0 downloads

network-computer/infra/create-droplet.sh
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/network-computer.git
HTTPS
https://gitstable.com/git/askrobots/network-computer.git
SSH
ssh://git@gitstable.com:2222/askrobots/network-computer.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Dan Quellhorst Firefox policy: no WebRTC mDNS (a page using WebRTC made Firefox listen on UDP 5353) a1d92f3 1 month, 3 weeks ago History
create-droplet.sh · 3.2 KB · 57 lines
1#!/bin/sh
2# Create a computer, attach its desk, and provision it.
3# Usage: infra/create-droplet.sh [name] [region] [size]
4# Defaults come from the profile in NC_DESK_ENV (default infra/desk.env; see
5# desk.env.example and people.sh), then built-ins.
6#
7# The desk is a small DigitalOcean volume (desk-$NC_DESK, $NC_DESK_GB GB) that
8# outlives the computer: settings, documents, secrets, and the desk's identity
9# (login, PIN, pairing, certificate). It is created once, attached at boot, and
10# never deleted by any script. With NC_DOMAIN set (DNS on DigitalOcean) the
11# hostname is pointed at the new computer before provisioning, for https.
12set -e
13DIR=$(cd "$(dirname "$0")" && pwd)
14ENVF=${NC_DESK_ENV:-$DIR/desk.env}
15[ -f "$ENVF" ] && . "$ENVF"
16NAME=${1:-${NC_HOST_NAME:-nc}}; REGION=${2:-${NC_REGION:-nyc3}}; SIZE=${3:-${NC_SIZE:-s-2vcpu-4gb}}
17DESK=${NC_DESK:-$NAME}; DESK_GB=${NC_DESK_GB:-1}; VOL=desk-$DESK
18IMAGE=ubuntu-24-04-x64
19
20KEY_ID=$(doctl compute ssh-key list --format ID --no-header | paste -sd, -)
21[ -n "$KEY_ID" ] || { echo "no SSH key on DigitalOcean; add one with: doctl compute ssh-key import mykey --public-key-file ~/.ssh/id_ed25519.pub"; exit 1; }
22
23# the desk: find it, or create it once
24VOL_ID=$(doctl compute volume list --format ID,Name,Region --no-header | awk -v n="$VOL" '$2==n{print $1; exit}')
25if [ -n "$VOL_ID" ]; then
26 VOL_REGION=$(doctl compute volume list --format ID,Region --no-header | awk -v i="$VOL_ID" '$1==i{print $2}')
27 [ "$VOL_REGION" = "$REGION" ] || { echo "desk $VOL is in $VOL_REGION; a computer in $REGION cannot attach it"; exit 1; }
28 ATTACHED=$(doctl compute volume get "$VOL_ID" --format DropletIDs --no-header | tr -d '[] ')
29 [ -z "$ATTACHED" ] || { echo "desk $VOL is attached to droplet $ATTACHED; run 'infra/droplet.sh down' first"; exit 1; }
30 echo "desk $VOL found ($VOL_REGION)"
31else
32 echo "creating desk $VOL (${DESK_GB} GB, $REGION)..."
33 VOL_ID=$(doctl compute volume create "$VOL" --region "$REGION" --size "${DESK_GB}GiB" \
34 --fs-type ext4 --fs-label desk --tag nc-desk --desc "network-computer desk for $DESK" \
35 --format ID --no-header)
36fi
37
38echo "creating $NAME ($SIZE, $REGION) with desk attached..."
39doctl compute droplet create "$NAME" --region "$REGION" --size "$SIZE" --image "$IMAGE" \
40 --ssh-keys "$KEY_ID" --tag-names "nc,nc-$NAME" --volumes "$VOL_ID" --wait --format ID,Name,PublicIPv4 --no-header
41
42IP=""
43for i in $(seq 1 30); do
44 IP=$(doctl compute droplet list --format Name,PublicIPv4 --no-header | awk -v n="$NAME" '$1==n{print $2}')
45 [ -n "$IP" ] && break; sleep 3
46done
47[ -n "$IP" ] || { echo "no public IP yet; run: infra/droplet.sh status"; exit 1; }
48echo "droplet $NAME at $IP"
49if [ -n "$NC_DOMAIN" ]; then
50 # point DNS now: it propagates while the box provisions
51 sh "$DIR/dns-point.sh" "$NC_DOMAIN" "$IP"
52fi
53echo "waiting for ssh..."
54for i in $(seq 1 30); do ssh -o StrictHostKeyChecking=accept-new -o ConnectTimeout=5 root@"$IP" true 2>/dev/null && break; sleep 5; done
55
56PRICE=$(doctl compute size list --format Slug,PriceHourly --no-header | awk -v s="$SIZE" '$1==s{print $2}')
57NC_DESK_ENV=$ENVF NC_DOMAIN=$NC_DOMAIN NC_KEYBOARD=$NC_KEYBOARD NC_DESK_USER=${NC_DESK_USER:-user} NC_SIZE=$SIZE NC_PRICE_HOURLY=$PRICE sh "$DIR/provision-host.sh" "$IP" "$NAME"