Copy of github.com/askrobots/network-computer (MIT): a desk you reach from anything. The original lives on GitHub.

2 downloads

network-computer/infra/provision-host.sh
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/demo/network-computer.git
HTTPS
https://gitstable.com/git/demo/network-computer.git
SSH
ssh://git@gitstable.com:2222/demo/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.

GitStable demo README: say this is a copy and where the original is cde82c2 13 hours, 36 minutes ago History
provision-host.sh · 1.7 KB · 35 lines
1#!/bin/sh
2# Provision any reachable Ubuntu 24.04 box (any provider, or bare metal) by IP.
3# Copies provision/ and runs apply.sh. This is the provider-agnostic core that
4# every create-*.sh script calls once its instance is up.
5#
6# [NC_DOMAIN=nc.example.com] infra/provision-host.sh <ip> [host-name] [ssh-user]
7#
8# NC_DOMAIN turns on a Let's Encrypt certificate; its A record must already
9# point at <ip> (infra/dns-point.sh does that for DigitalOcean DNS).
10set -e
11IP=$1; NAME=${2:-nc}; USER=${3:-root}
12[ -n "$IP" ] || { echo "usage: provision-host.sh <ip> [host-name] [ssh-user]"; exit 1; }
13ROOT=$(cd "$(dirname "$0")/.." && pwd)
14
15echo "waiting for ssh on $IP..."
16for i in $(seq 1 40); do
17 ssh -o StrictHostKeyChecking=accept-new -o ConnectTimeout=5 "$USER@$IP" true 2>/dev/null && break
18 sleep 5
19done
20
21echo "copying provision/ and running apply.sh..."
22ssh "$USER@$IP" 'mkdir -p /root/provision'
23scp -q -r "$ROOT/provision/." "$USER@$IP":/root/provision/
24# sudo only if not already root
25PFX=""; [ "$USER" = root ] || PFX="sudo "
26# the profile's personal settings (keys too) go as a file, never on a command line
27if [ -n "$NC_DESK_ENV" ] && [ -f "$NC_DESK_ENV" ]; then
28 scp -q "$NC_DESK_ENV" "$USER@$IP":/root/provision/person.env
29 ssh "$USER@$IP" "${PFX}chmod 600 /root/provision/person.env"
30fi
31# NC_SIZE and NC_PRICE_HOURLY (optional) only label the desktop dashboard
32ssh "$USER@$IP" "NC_PUBLIC_IP=$IP NC_HOST_NAME=$NAME NC_DOMAIN=$NC_DOMAIN NC_DESK_USER=$NC_DESK_USER NC_KEYBOARD=$NC_KEYBOARD NC_SIZE=$NC_SIZE NC_PRICE_HOURLY=$NC_PRICE_HOURLY ${PFX}sh /root/provision/apply.sh"
33echo
34if [ -n "$NC_DOMAIN" ]; then URL="https://$NC_DOMAIN"; else URL="http://$IP:8765"; fi
35echo "done. rendezvous: $URL secrets: ssh $USER@$IP ${PFX}cat /etc/nc/env"