Skip to content

Latest commit

 

History

History
132 lines (91 loc) · 3.26 KB

SET-UP-LAB-NODE.md

File metadata and controls

132 lines (91 loc) · 3.26 KB

You might want to set up a lab node to run BYOI. Here's how to do that.

Starting with digital ocean

Note: if you don't want to use digital ocean, you can use any other cloud provider that supports docker. You'll just need to get an Ubuntu 24.04 machine set up with ssh access.

  1. Install doctl (this is the digital ocean cli). You can do this with brew install doctl or snap install doctl

  2. Authenticate with doctl:

doctl auth init
  1. If you don't have an ssh key, create one with the following command:
ssh-keygen -t ed25519
  1. Add the ssh key to your digital ocean account with the following command:
doctl compute ssh-key add --ssh-key-file ~/.ssh/id_ed25519.pub
  1. List your ssh keys with the following command:
doctl compute ssh-key list
  1. Set your ssh key ID as an environment variable:
export SSH_KEY_ID=<your-ssh-key-id>

Building the lab node

  1. Create a droplet with the following command:
export HOST_NAME=build-your-own-internet-lab-3
doctl compute droplet create \
    --ssh-keys $SSH_KEY_ID \
    --image ubuntu-24-04-x64 \
    --size s-2vcpu-4gb \
    --region sfo3 \
    --vpc-uuid cf4f0a3a-a4b6-4ced-8378-19c060c48bd6 \
    $HOST_NAME
  1. Find the IP address of the droplet with the following command:
while sleep 1; do
doctl compute droplet list --format ID,Name,PublicIPv4,PrivateIPv4
done

📝 NOTE: It may take a few minutes for the droplet to become active and for it to have an IP address.

Assign that IP address to the IP_ADDRESS environment variable:

export IP_ADDRESS=<your-ip-address>
  1. SSH into the droplet with the following command:
$ ssh root@$IP_ADDRESS
The authenticity of host '137.184.179.253 (137.184.179.253)' can't be established.
ED25519 key fingerprint is SHA256:ecjoIp/DNuZIvKIWdoVOhKedryaBhgjRZooH1iYMKGU.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
  1. Clone down the BYOI repo and run the playbook to set up the test user:
git clone https://github.com/build-your-own-internet/byoi.git
  1. Switch to the appropriate branch
cd byoi
git checkout tech-summit-2024-base
  1. Install Ansible:
cd ansible-setup/
apt update;apt install -y software-properties-common;add-apt-repository --yes --update ppa:ansible/ansible;apt install -y ansible;
  1. Set the test user password:

Ansible requires that passwords be provided in an encrypted (hashed) format when setting user passwords. To set the password securely without storing it in the playbook, we can use an environment variable to pass the hashed password to the playbook.

export TEST_USER_PASSWORD=$(openssl passwd -6 "your-super-secret-password")
  1. Run the playbook:
ansible-playbook setup_test_user.yml
  1. Test that the test user can run BYOI commands:

Log out of the droplet. Then log back in as the test user with the following command:

ssh test@$IP_ADDRESS
  1. Start the BYOI lab server:

Now, as the test user, run the following command to start the BYOI lab server:

byoi-rebuild

You're done!