Virtual or baremetal machine

Introduction

To start, please read first the basics of the Slices basic infrastructure service.

Starting your first Virtual or Baremetal Machine

The basic infrastructure service offers a broad range of available resources: from a light virtual machine to a heavy duty bare metal server. In this guide we will create a single virtual or baremetal machine.

From now on, we will use subcommands of slices bi. Let’s have a look at the help of this command:

(slices-venv) ~/.ssh$ slices bi --help

  Usage: slices bi [OPTIONS] COMMAND [ARGS]...

  Initialize BI Context.

 ╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────╮
  --site-id        SITEID  Site ID [env var: SLICES_BI_SITE_ID] [default: bi-orchestrator]                          --help                   Show this message and exit.                                                             ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
 ╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────────╮
  console            Open a browser with a console to a resource. Also print the link that is opened.               create             Request basic infrastructure (BI) resource.                                                    create-from-file   Request basic infrastructure (BI) resources, described in a file.                              destroy            Destroy one or more basic infrastructure resources.                                            extend             Extend the expiration date of one or more basic infrastructure resources (on a single site).   list-resources     List basic infrastructure details of BI resources in an experiment.                            reset              Hard reset a resource.                                                                         show               Show single resource details.                                                                  ssh                Log in to a resource using SSH. Alternatively, show info, such as the login command.          ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
 ╭─ Commands with subcommands ─────────────────────────────────────────────────────────────────────────────────────╮
  diskimage          Disk images.                                                                                   flavor             Flavors.                                                                                      ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

To create a machine, we use the command slices bi create. You can run this command with --help for an overview of the available configuration parameters:

(slices-venv) ~$ slices bi create --help

  Usage: slices bi create [OPTIONS] RESOURCE

  Request basic infrastructure (BI) resource.

 ╭─ Arguments ───────────────────────────────────────────────────────────────────────────────────────────────────────╮
  *    resource      TEXT  Name of the resource. [required]                                                          ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
 ╭─ Options ─────────────────────────────────────────────────────────────────────────────────────────────────────────╮
  *  --experiment            TEXT                  Experiment name or ID. [env var: SLICES_EXPERIMENT] [required]        --image                 TEXT                  ID of the image. [default: Ubuntu 24.04.1]                            --flavor                TEXT                  ID of the flavor [default: default per site]                          --duration      -d      DURATION_OR_DATETIME  Lifetime of the resource. Can be extended later on.                                                                 [default: 3h]                                                         --user-data             FILENAME              File with cloudinit user-data.                                        --wait                                        Wait till resource is ready after creation.                           --public-ipv4                                 Request a public IPv4.                                                --count                 INTEGER               Number of resources to create.                                        --ssh-key               SSH-KEY               (Extra) SSH public key to register for login.                                                                       [env var: SLICES_SSH_KEY]                                             --ssh-key-file          FILENAME              (Extra) SSH public key file to use for login.                                                                       [env var: SLICES_SSH_KEY_FILE]                                        --help                                        Show this message and exit.                                       ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

The defaults are chosen in a way that they work both for a virtual machine and a baremetal machine. With setting the below environment variables you choose between vm and baremetal for the rest of this tutorial.

(slices-venv) ~$ export SLICES_BI_SITE_ID=be-gent1-bi-vm1
      or  export SLICES_BI_SITE_ID=be-gent1-bi-baremetal1
(slices-venv) ~$ export SLICES_EXPERIMENT=first-experiment
(slices-venv) ~$ slices bi create server
✨ Created server with ID r_be-gent1-bi-vm1_01ja6smxsefvtvv3b4hqkze4mc

Note

In a typical simple workflow, you will work with resources on a single site and within a single experiment. Then, it’s very easy to define the environment variables SLICES_BI_SITE_ID and SLICES_EXPERIMENT as almost all slices bi commands need that information. However, you can always use the arguments --site-id and --experiment (they will also overrule the environment variables).

Of course, if you want to finetune your operating system and flavor of the machine, this is also possible. The sites offer a few different operating systems where you can choose from. The images will differ from site to site with some common ones (typically the ubuntu OS). Use slices bi diskimage list to get an overview of the available disk images for a site. Each image has a unique ID and a friendly name. Both can be used.

(slices-venv) ~$ slices bi diskimage list
                                               Images
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┓
┃ ID                                                Name            Created At             Tags ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━┩
│ image_be-gent1-bi-vm1_7rhy7cadxf8t6rrny5743g7p5w  Ubuntu 24.04.1  2024-10-15 01:33 CEST       │
│ image_be-gent1-bi-vm1_01hxc1pwntes4r2a317hx3je6g  Ubuntu 22.04.5  2024-05-08 14:09 CEST       │
│ image_be-gent1-bi-vm1_01hxc1pvhgegcs44xpdm376kf6  Debian 12.7     2024-05-08 14:09 CEST       │
│ image_be-gent1-bi-vm1_01hxc1pa0af0yvb65p1tr5t5fc  Debian 12.5     2024-05-08 14:08 CEST       │
└──────────────────────────────────────────────────┴────────────────┴───────────────────────┴──────┘

We can also choose the appropriate ‘flavor’ for our machine, which determines the amount of CPU, memory and disk space that we will have.

(slices-venv) ~$ slices bi flavor list
                        Slices BI Flavors on be-gent1-bi-vm1
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ Name       Desc                            (v)CPUs  RAM (GiB)  Root Disk (GB) ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ m1.medium  Medium General Purpose VM       4        8          10             │
│ m1.tiny    Minimal VM                      1        1          0              │
│ m1.xlarge  Extra Large General Purpose VM  8        16         40             │
│ m1.small   Small General Purpose VM        1        2          10             │
│ m1.large   Large General Purpose VM        4        16         20             │
└───────────┴────────────────────────────────┴─────────┴───────────┴────────────────┘

Let us look at an example with some options. This example is for be-gent1-bi-vm1, look at the output of the above commands for choices at other sites: let us request a small VM called server2 with the Debian 12.7 disk image, which we will start in our experiment called first-experiment for a duration of 1 day. Note that we also show how to use --experiment as alternative to the SLICES_EXPERIMENT environment variable.

(slices-venv) ~$ slices bi create server2 --duration 1d --image "Debian 12.7" --flavor m1.small --experiment first-experiment
✨ Created server with ID r_be-gent1-bi-vm1_01ja6smxsefvtvv3b4hqkze4mc

Note

To prevent resources from being abandoned without being properly cleaned up, all resources have a limited lifetime. This lifetime has a maximum of 2160 hours (=90 days). You can however always extend your resources lifetime (see further) up to 90 days into the future. This might change in the future. It might require specific quota to have long running experiments. **The default duration is currently 3 hours. Use --duration to change this.

The status of this new machine can be queried by listing the resources in your experiment first-experiment:

(slices-venv) ~$ slices bi list-resources
                                 Resources in experiment exp_expauth.ilabt.imec.be_01ja6rp4mcff5vv4awam662n3d
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ ID                                            Name    Status  Created At             Expires At             Public IPv4  Private IPv4 ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ r_be-gent1-bi-vm1_01ja6smxsefvtvv3b4hqkze4mc  server │starting│ 2024-10-15 02:36 CEST  2024-10-16 02:35 CEST               10.10.221.8  │
└──────────────────────────────────────────────┴────────┴────────┴───────────────────────┴───────────────────────┴─────────────┴──────────────┘

We see that the machine is still starting at the moment. If the status is reported as up we can login with ssh on our machine. If you also started the server2, you will see two machines listed.

Accessing the machine

Once the machine has reached the state up, you can login. As you can see in the output of the slices bi list-resources command above, the machine has a private IP address. Slices offers SSH jump hosts which allow you to seamlessly connect into the machine.

Use slices bi ssh <resource id> to SSH into your machine (this also uses automatically the right login name, e.g. debian or ubuntu):

(slices-venv) ~/.ssh$ slices bi ssh server
ssh -J proxy@xxx debian@10.10.221.8
Linux server 6.1.0-26-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64
...
debian@server:~$

You can also manually use the printed ssh command in a terminal. With sudo you can execute commands as root on the machine. With sudo su you become root on the machine.

Note

With all commands you can use the ID or Name of the machine.

Emergency access to the machine

If, due to certain circumstances, you lose SSH access to your machine (for example due to unexpected side-effects of a firewall change) you have a few options to regain access to your machine. The options can vary per site. Hard resetting the machine will work on all sites. Console access is available for the virtual machines.

Rebooting the machine

If a simple hard reboot of your machine can solve the problem, you can use slices bi reset. You can check the uptime afterwards.

(slices-venv) ~/.ssh$ slices bi reset server

Console access

This currently only works on be-gent1-bi-vm1. The service offers console access to your VM via web-based VNC, which offers you a virtual display and keyboard.

Use slices bi console to get the URL to your console:

(slices-venv) ~/.ssh$ slices bi console server
Console user: xxx
Console pass: xxx
Console URL: https://xxx

You should browse to the URL (depending on your setup, a browser might automatically start up) and then you will be able to use that login and password to login on the console.

Permanent storage

The be-gent1-bi-baremetal1 site has also permanent storage attached to the nodes through nfs (be-gent1-bi-vm1 has not). This is organised per project (and is thus accessible by all members of your project). You will find on each node a mount /proj/projectname-PG0. This location will persist between experiments.

Extending the lifetime of your machine

To extend the lifetime of a resource, use slices bi extend. For example, to extend the lifetime of your machine to 2 days from now:

(slices-venv) ~/.ssh$ slices bi extend server --duration 2d
Extending Experiment container from 2024-10-16 03:38 CEST to 2024-10-17 03:53 CEST...
Extending resource on be-gent1-bi-vm1 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
♻ Resources on site be-gent1-bi-vm1 now expire on 2024-10-17 03:53 CEST.

Terminating the machine

When you have finished your work on the machine, we ask you to clean up and remove your machine. As stated before, every resource has an expiration time. At that time, the resource will be lost automatically and is unrecoverable.

However you can also manually terminate a machine as follows. For this we use the slices bi destroy command, which needs an experiment name and resource id.

Note

In this command we force you to use the --experiment option to prevent any surprise of destroying the wrong resource.

(slices-venv) ~/.ssh$ slices bi destroy --experiment first-experiment server
Deleting server ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% -:--:--