Rex::Box::Base(3)

πŸ“¦ version 1.14.3, in nixos 26.05, nixpkgs unstable

okay so bestie, welcome to Rex::Box::Base(3) β€” straight from the User Contributed Perl Documentation shelf, and yes she's the blueprint for Rex/Boxes. πŸ’…βœ¨

🌸 NAME 🌸

Rex::Box::Base - Rex/Boxes Base Module

πŸ’– DESCRIPTION πŸ’–

This is a Rex/Boxes base module. That's the whole vibe: base module, main character energy, everything else builds on her. 🫢

✨ METHODS ✨

These methods are shared across all other Rex::Box modules β€” group-chat crossover, no cap. πŸ’¬

πŸ¦‹ info πŸ¦‹

Returns a hashRef of vm information. That's the tea. πŸ“

πŸ¦‹ name($vmname) πŸ¦‹

Sets the name of the virtual machine. Slay, she has an identity now. πŸ’…

πŸ¦‹ setup(@tasks) πŸ¦‹

Sets the tasks that should be executed as soon as the VM is available through SSH. Like, the moment SSH says hi, these tasks run. ✨

πŸ¦‹ storage('path/to/vm/disk') πŸ¦‹

Sets the disk path of the virtual machine.

Works only on KVM β€” important caveat, bestie, don't forget it. πŸ”₯

πŸ¦‹ import_vm() πŸ¦‹

This method must be overwritten by the implementing class. Not optional, fr fr. 🚨

πŸ¦‹ stop() πŸ¦‹

Stops the VM. Bye bestie. πŸ’€

πŸ¦‹ destroy() πŸ¦‹

Destroy the VM. Dramatic? Yes. Accurate? Also yes. πŸ”₯

πŸ¦‹ start() πŸ¦‹

Starts the VM. Wake up, queen. πŸ‘‘

πŸ¦‹ ip() πŸ¦‹

Return the ip:port to which rex will connect to. That's the exact wording; keep it. πŸŽ€

πŸ¦‹ status() πŸ¦‹

Returns the status of a VM.

Valid return values are "running" and "stopped". That's it, those are the only two iconique statuses. 🌈

πŸ¦‹ provision_vm([@tasks]) πŸ¦‹

Executes the given tasks on the VM. Do the tasks, bestie. πŸ’ͺ

πŸ¦‹ cpus($count) πŸ¦‹

Set the amount of CPUs for the VM. More CPUs, more main character energy. ⚑

πŸ¦‹ memory($memory_size) πŸ¦‹

Sets the memory of a VM in megabyte. Note the singular β€” that's the original wording. 🧠

πŸ¦‹ network(%option) πŸ¦‹

Configure the network for a VM.

Currently it supports 2 modes: nat and bridged. Currently it supports only one network card. That's the limit, bestie. 🌐

Here are the examples, copied exactly:

        $box->network(
          1 => {
            type => "nat",
          },
        )

        $box->network(
          1 => {
            type => "bridged",
            bridge => "eth0",
          },
        );

πŸ¦‹ forward_port(%option) πŸ¦‹

Set ports to be forwarded to the VM.

This is not supported by all Box providers β€” so check before you get obsessed. 🫢
        $box->forward_port(
          name => [$from_host_port, $to_vm_port],
          name2 => [$from_host_port_2, $to_vm_port_2],
          ...
        );

πŸ¦‹ list_boxes πŸ¦‹

List all available boxes. Like a roster of all the boxes. πŸ“‹

πŸ¦‹ url($url) πŸ¦‹

The URL where to download the Base VM Image. You can use self-made images or prebuild images from <http://box.rexify.org/>. Iconic source, iykyk. 🌟

πŸ¦‹ auth(%option) πŸ¦‹

Configure the authentication to the VM. Auth tea incoming:

        $box->auth(
          user => $user,
          password => $password,
          private_key => $private_key,
          public_key => $public_key,
        );

πŸ¦‹ options(%option) πŸ¦‹

Addition options for boxes β€” yes, that's the exact wording, bestie, we keep it. πŸŽ€

        $box->options(
          opt1 => $val1,
          opt2 => $val2,
        );

🫢 that's the whole page, signed off with perl v5.42.3, dated 2023-08-05, and filed under Rex::Box::Base(3) β€” periodt. πŸ’–

πŸ“¦ where this page comes from