Skip to content

Uses VirtualBox as a local backend for the Linode API. Much of the functionality of the Instances, Volumes, and Types APIs are implemented.

License

Notifications You must be signed in to change notification settings

derac/Local-Linode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Linode

Uses VirtualBox as a local backend for the Linode API. Much of the functionality of the Instances, Volumes, and Types APIs are implemented.

Setup

  1. Download Ubuntu Server 20.04 iso.
  2. Install VirtualBox onto the system.
  3. Follow the VirtualBox machine template setup instructions below.
  4. npm install
  5. npm run build
  6. npm start

VirtualBox machine template setup

  1. In VirtualBox Manager:
    1. Machine > New... (or ctrl+n)
      1. Name it ubuntu server template > Create
      2. File Size: 1 TB+ > Create
      3. Go to settings for ubuntu server template
      4. Storage > IDE optical drive (says "Empty") > Click disk icon dropdown > Choosea disk file... > Select the ISO you downloaded
      5. Click OK and start the VM.
  2. Ubuntu setup. (ctrl+c view mode is nice)
    1. Click next until you get to "Guided Storage configuration"
    2. Select "Custom storage layout" > Done
    3. Select the VBOX_HARDDISK and press enter > Add GPT Partition
    4. Size: 20G > Format: ext4 > Mount: / > Create
    5. Add another GPT Partition
    6. Size: 512M > Format: swap > Create
    7. Done > Continue
    8. Enter local-linode for all options > Done
    9. Check Install OpenSSH Server > Done
    10. Done > Wait for intallation to complete > Reboot Now
    11. Power off machine > Settings > Unmount install CD > Power on
    12. Machine GUI Menu > Devices > Insert Guest Additions image (may need to remove ubuntu iso)
  3. Log into the machine and run bash commands below.
  4. In Virtualbox Manager
    1. Machine GUI Menu > Devices > Optical Drives > Remove disk
    2. Power off machine > Machine settings
    3. Navigate to Network > Adapter 1 > Attached to: Select Host-only Adapter
    4. Navigate to Storage > Controller: SATA > Port Count > Enter 8
    5. Hit OK
    6. Right click machine > Export to OCI
    7. Format: Open Virtualization Format 2.0
    8. MAC Address Policy: Strip all network adapter MAC addresses
    9. Un-check Write Manifest file, might be faster
    10. File: "{default VirtualBox VMs folder}/ubuntu_server_template.ova"
  5. You can delete the Template you created in VirtualBox. If you need to update the OVA, you can edit a machine spawned by the script, re-export, and overwrite the template OVA.
sudo apt update
sudo apt upgrade -y
sudo apt install build-essential linux-headers-$(uname -r) -y
sudo mount /dev/cdrom /media
sudo /media/VBoxLinuxAdditions.run
sudo ufw allow ssh
sudo ufw enable

API Reference Pages

Postman collection for testing

Postman collection json file.

implementation details

  • many of the options for creating a new instance and config are not implemented, such as interfaces
  • the hotpluggable flag on vboxmanage storagectl causes a lot of issues. When attaching a drive to a running instance, it is set automatically and there isn't an issue. However, when using "--hotpluggable on", the vm will fail to start and other odd behavior. This must be worked around.
  • the VM can also get into states where it can't be controlled if operations are done on it before it's fully booted, it seems

TODO

  • resizing disks
  • automate creating template vm

About

Uses VirtualBox as a local backend for the Linode API. Much of the functionality of the Instances, Volumes, and Types APIs are implemented.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published