Skip to content

Instantly share code, notes, and snippets.

@sarcasticadmin
Created October 17, 2024 06:48
Show Gist options
  • Save sarcasticadmin/780b5ecef0e4d5d7d0ff13cf9ff6ed27 to your computer and use it in GitHub Desktop.
Save sarcasticadmin/780b5ecef0e4d5d7d0ff13cf9ff6ed27 to your computer and use it in GitHub Desktop.
Oxide CLI (oxide-rs) nixpkg build test notes
# Test oxide-rs cli built via nixpkgs
./result/bin/oxide version
Oxide CLI 0.7.0+20240821.0
Built from commit: 2fd0e64a68cf8abe06dcca97dae2661d90efabe5 (dirty)
Oxide API: 20240821.0
# Login to rack silo, copy url into the browser
# Note: --no-browser seemed to be the only way I could get the one code to be displayed. Without out it nothing would output (--debug didnt help either)
./result/bin/oxide auth login --host https://<HOSTURL> --no-browser
# Check the status of your credentials
./result/bin/oxide ping
# if your user has a key then any VM created in the project will contain that key thanks
# to userdata and cloudinit
# ref: https://steveklabnik.com/writing/using-the-oxide-console/
./result/bin/oxide current-user ssh-key create --name 'robs-key' \
--description 'robs workstation key' \
--public-key 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMEiESod7DOT2cmT2QEYjBIrzYqTDnJLld1em3doDROq'
# Create a project so any mistakes are easy to cleanup
./result/bin/oxide project create --name nix1 --description "hello from nixpkgs rustcli"
# Create a VPC
# NOTE: seemed to be missing --ipv4 flag in the --help
./result/bin/oxide vpc create --project nix1 \
--dns-name nix1 \
--name nix-vpc \
--description "my nix vpc test"
# Create an image of debian (nixos coming soon)
./result/bin/oxide disk import --project nix1 \
--path ./debian-12-genericcloud-amd64.raw \
--disk debian12-boot \
--description "debian 12 cloud image" \
--snapshot debian12-snapshot \
--image debian12 \
--image-description "debian 12 original base image" \
--image-os debian \
--image-version "12"
# Create a new instance from the image and an ephemeral external IP will be added automatically
# NOTE: mem and size are awkward since help outputs in GiB which isnt recognized.
# A G for the size also doesnt seem to work, must be lower case
# NOTE: --start in help says value can be true or false but those values aren't valid
./result/bin/oxide instance from-image --project nix1 \
--image debian12 \
--name "deb1" \
--description "my first vm" \
--hostname "deb1" \
--memory 4g \
--ncpus 2 \
--size 20g
# Check the console to start instance and get external IP (not sure how to do this in the CLI) then SSH as debian user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment