### Install and Enable Nginx in Dockerfile Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/tasks/custom-image.md Install Nginx using apt-get and enable it to start automatically with systemd. Copy your website files to the appropriate directory. ```diff +RUN apt-get update && apt-get install -y nginx +RUN systemctl enable nginx +COPY ./my-website /var/www/html ``` -------------------------------- ### Install Go SDK Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/platform/go-sdk.md Install the latest version of the Slicer Go SDK using go get. ```bash go get github.com/slicervm/sdk@latest ``` -------------------------------- ### Quickstart: Create VM, Run Command, Delete VM Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/platform/typescript-sdk.md This example demonstrates creating a VM, executing a command on it, and then deleting the VM. It uses environment variables for configuration. ```typescript import { SlicerClient, GiB } from '@slicervm/sdk'; const client = SlicerClient.fromEnv(); // reads SLICER_URL + SLICER_TOKEN const vm = await client.vms.create( 'sbox', { cpus: 1, ramBytes: GiB(1) }, { wait: 'agent', waitTimeoutSec: 60 }, ); console.log(`created ${vm.hostname} (${vm.ip})`); try { const result = await vm.execBuffered({ command: 'uname', args: ['-a'] }); console.log(`exit=${result.exitCode}`); console.log(result.stdout.trim()); } finally { await vm.delete(); } ``` -------------------------------- ### Install K3s and Configure Cluster Autoscaler Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/autoscaling-k3s.md Automate K3s installation and cluster setup using K3sup Pro. This includes activating K3sup Pro, planning the cluster configuration, applying the configuration, and retrieving the kubeconfig and join token. ```bash # Download K3sup Pro (included with Slicer) curl -sSL https://get.k3sup.dev | PRO=true sudo -E sh k3sup-pro activate # Create K3s cluster k3sup-pro plan --user ubuntu ./devices.json k3sup-pro apply # Get kubeconfig and join token k3sup-pro get-config --local-path ~/k3s-cp-kubeconfig k3sup-pro node-token --user ubuntu --host 192.168.137.2 > ~/k3s-join-token.txt ``` ```bash k3sup-pro get-config \ --local-path ~/.kube/config \ --merge \ --context slicer-k3s-cp ``` -------------------------------- ### Test Custom Image with Slicer Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/platform/custom-images.md After pushing your custom image, restart Slicer and create a sandbox. This example shows how to update the sandbox YAML, start Slicer, and then execute a command within the created VM to verify package installation. ```bash slicer new sandbox \ --count=0 \ > sandbox.yaml # Edit sandbox.yaml and set the image: field to your custom image sudo slicer up ./sandbox.yaml export TOKEN=$(sudo cat /var/lib/slicer/auth/token) curl -sf -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -X POST http://127.0.0.1:8080/hostgroup/sandbox/nodes -d '{}' # Wait for agent, then check python is installed curl -sf -H "Authorization: Bearer $TOKEN" \ -X POST \ "http://127.0.0.1:8080/vm/sandbox-1/exec?cmd=python3&args=--version&stdout=true" ``` -------------------------------- ### Example: Python Sandbox Dockerfile Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/platform/custom-images.md This Dockerfile example installs Python 3, pip, and common data libraries into a Slicer systemd base image. Ensure you run apt-get clean to reduce image size. ```Dockerfile FROM ghcr.io/openfaasltd/slicer-systemd:6.1.90-x86_64-latest RUN apt-get update -qy \ && apt-get install -qy \ python3 \ python3-pip \ python3-venv \ && apt-get clean ``` -------------------------------- ### Install Documentation Dependencies Source: https://github.com/slicervm/docs.slicervm.com/blob/master/README.md Use this command to install the necessary Python packages for the documentation site. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install and Enable Slicer Systemd Service Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/getting-started/daemon.md Copies the service file to the systemd directory, reloads the systemd daemon, and enables and starts the service. The `--now` flag starts the service immediately. ```bash sudo cp ./vm.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable --now vm.service ``` -------------------------------- ### Start PiHole VM Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/pihole-adblock.md This command starts the PiHole VM using the generated `pihole.yaml` configuration file. ```bash sudo slicer up ./pihole.yaml ``` -------------------------------- ### Start Slicer VM Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/buildkit.md Starts the Slicer VM using the generated 'buildkit.yaml' configuration file. Ensure you have the configuration file in the current directory. ```bash sudo slicer up ./buildkit.yaml ``` -------------------------------- ### Download and Install Nvidia Driver Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/k3s-gpu.md Download and execute the Nvidia driver installation script. This script fetches and installs the necessary drivers for GPU support. ```bash curl -SLsO https://raw.githubusercontent.com/self-actuated/nvidia-run/refs/heads/master/setup-nvidia-run.sh chmod +x ./setup-nvidia-run.sh sudo bash ./setup-nvidia-run.sh ``` -------------------------------- ### Userdata Script for OpenCode Setup Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/opencode-agent.md A bash script to be executed as user data on a new VM. It installs OpenCode, sets permissions, and ensures it's executable. ```bash #!/usr/bin/env bash set -euo pipefail # Install opencode -> /usr/local/bin arkade get opencode --path /usr/local/bin >/dev/null chown ubuntu /usr/local/bin/opencode chmod +x /usr/local/bin/opencode ``` -------------------------------- ### Install Docker in Dockerfile Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/tasks/custom-image.md Install Docker by downloading and executing the official installation script. Add the default user to the docker group for access. ```diff +RUN curl -sLS https://get.docker.com | sh +RUN usermod -aG docker ubuntu ``` -------------------------------- ### Userdata Script for OpenCode Setup Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/opencode-agent.md This bash script installs the OpenCode CLI, prepares directories and authentication for the 'ubuntu' user, and defines a task for code generation. It assumes Ubuntu with curl and arkade preinstalled. ```bash #!/usr/bin/env bash # Ubuntu only. Requires: curl + arkade preinstalled. # Installs opencode, sets pre-auth, creates a daemonized systemd unit "opencode.service". set -euo pipefail # Install opencode -> /usr/local/bin arkade get opencode --path /usr/local/bin >/dev/null chown ubuntu /usr/local/bin/opencode chmod +x /usr/local/bin/opencode # Prep dirs & auth for user "ubuntu" (no group assumption) for d in /home/ubuntu/workdir /home/ubuntu/.local/share/opencode /home/ubuntu/.local/state /home/ubuntu/.cache; do mkdir -p "$d" chown ubuntu "$d" done cp /run/slicer/secrets/opencode-auth.json /home/ubuntu/.local/share/opencode/auth.json chown ubuntu /home/ubuntu/.local/share/opencode/auth.json chmod 600 /home/ubuntu/.local/share/opencode/auth.json # Task payload (edit as needed) cat >/home/ubuntu/workdir/task.txt <<'EOF' Create a new Go program with an HTTP server. Add GET /healthz returning 201 "Created". Print a git diff at the end. Use "arkade system install golang" to install Go into the environment. Then test the program with "go run main.go" and curl localhost:8080/healthz - make sure you kill the program after confirming the correct HTTP code was returned. Set the PATH variable to include /usr/local/go/bin so that the go command is found. EOF chown ubuntu /home/ubuntu/workdir/task.txt chmod 600 /home/ubuntu/workdir/task.txt ``` -------------------------------- ### Install Docker via Userdata Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/tasks/userdata.md This userdata script installs Docker on the VM. It fetches the installation script from the official Docker website. ```diff config: host_groups: - name: agent + userdata: | + # Install Docker + curl -fsSL https://get.docker.com | sh ``` -------------------------------- ### Install K3sup Pro Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/multiple-machine-k3s.md Downloads and installs K3sup Pro, a utility for easily installing K3s. The PRO=1 environment variable is used to ensure the Pro version is installed. ```bash PRO=1 curl -sSL https://get.k3sup.dev | sudo sh ``` -------------------------------- ### Install Docker and run container via Userdata Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/docker.md Use Userdata to install Docker and launch a container on the VM's first boot. This method delays boot time but is portable. Ensure the script has execute permissions. ```yaml config: host_groups: - name: vm userdata: | #!/bin/bash # Install Docker curl -fsSL https://get.docker.com | sh # Add user to docker group usermod -aG docker ubuntu docker run -d -p 5000:5000 --restart=always --name registry registry:3 ``` -------------------------------- ### Install K3s using K3sup Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/k3s-gpu.md Install K3s (a lightweight Kubernetes distribution) on the VM using k3sup. This command assumes you are logged into the VM. ```bash k3sup install --host 192.168.139.2 --user ubuntu ``` -------------------------------- ### Install Ollama on Ubuntu Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/gpu-ollama.md Update package lists, install the zstd utility, and then download and execute the Ollama installation script. This prepares the system for running AI models. ```bash sudo apt update -qy && \ sudo apt install -qy zstd curl -fsSL https://ollama.com/install.sh | sh ``` -------------------------------- ### Start Slicer VM with OpenFaaS Pro Configuration Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/openfaas.md Start the Slicer VM using the generated OpenFaaS Pro configuration file. This command provisions and boots the microVM. ```bash sudo slicer up -f openfaas-pro.yaml ``` -------------------------------- ### Start VM using Slicer CLI Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/storage/overview.md After resizing the disk image and performing necessary checks, use this command to start the virtual machine again using its configuration file. ```bash slicer up ./config.yaml ``` -------------------------------- ### Quick Install Slicer Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/getting-started/install.md Use this command to quickly install Slicer on your Linux system. It downloads and executes the installation script. ```bash curl -sLS https://get.slicervm.com | sudo bash ``` -------------------------------- ### Setup Jenkins Master Script Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/jenkins.md This bash script automates the installation and configuration of a Jenkins master on Debian/Ubuntu systems. It installs Jenkins, configures essential plugins and JCasC settings, and sets up systemd for service management. It also saves admin credentials for easy access. ```bash #!/usr/bin/env bash set -euxo pipefail # --- Tunables (override via env if you like) --- : "${ADMIN_USER:=admin}" : "${ADMIN_PASS:=$(openssl rand -base64 18)}" : "${JENKINS_HTTP_PORT:=8080}" # Best-guess URL (update later if you put it behind a domain/reverse-proxy) DEFAULT_IP=$(hostname -I | awk '{print $1}') : "${JENKINS_URL:=http://${DEFAULT_IP}:${JENKINS_HTTP_PORT}/}" export DEBIAN_FRONTEND=noninteractive if command -v apt-get >/dev/null 2>&1; then # ----- Ubuntu/Debian path ----- apt-get update && \ apt-get install -qy --no-install-recommends \ curl gnupg ca-certificates openjdk-17-jdk git # Add Jenkins apt repo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | tee /etc/apt/keyrings/jenkins-keyring.asc >/dev/null chmod a+r /etc/apt/keyrings/jenkins-keyring.asc echo "deb [signed-by=/etc/apt/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/" > /etc/apt/sources.list.d/jenkins.list apt-get update && \ apt-get install -qy --no-install-recommends \ jenkins else echo "This setup script targets Debian/Ubuntu (apt). If you need RHEL/Alma/Oracle/Rocky Linux, reach out to us via Discord." exit 1 fi # ----- Plugins configuration ----- # List of plugins to install (name[:version], one per line) cat > /var/lib/jenkins/plugins.txt <<'EOF' configuration-as-code git workflow-aggregator credentials ssh-credentials EOF # ----- JCasC config ----- CCFG_DIR="/var/lib/jenkins/casc_configs" mkdir -p "$CCFG_DIR" cat > "${CCFG_DIR}/jenkins.yaml" <<'YAML' jenkins: systemMessage: "Jenkins bootstrapped by SlicerVM.com\n" mode: EXCLUSIVE numExecutors: 0 remotingSecurity: enabled: true labelString: "system" securityRealm: local: allowsSignup: false users: - id: "${ADMIN_USER}" password: "${ADMIN_PASS}" authorizationStrategy: loggedInUsersCanDoAnything: allowAnonymousRead: false unclassified: location: adminAddress: "address not configured yet " url: "${JENKINS_URL}" YAML # Substitute vars into JCasC (simple inline envsubst using bash) sed -i "s|\\ ${ADMIN_USER}|${ADMIN_USER}|g" "${CCFG_DIR}/jenkins.yaml" sed -i "s|\\ ${ADMIN_PASS}|${ADMIN_PASS}|g" "${CCFG_DIR}/jenkins.yaml" sed -i "s|\\ ${JENKINS_URL}|${JENKINS_URL}|g" "${CCFG_DIR}/jenkins.yaml" # Ensure Jenkins uses our JCasC and skips the setup wizard install -d -m 0755 /etc/systemd/system/jenkins.service.d cat > /etc/systemd/system/jenkins.service.d/override.conf </dev/null 2>&1 || [ $tries -le 0 ]; do sleep 2; tries=$((tries-1)) done # Save creds somewhere easy to grab cat > /home/ubuntu/jenkins-admin.txt < /dev/null [Unit] Description=BuildKit Daemon After=network.target [Service] Type=simple ExecStart=/usr/local/bin/buildkitd --addr unix:///run/buildkit/buildkitd.sock --group buildkit Restart=always User=root [Install] WantedBy=multi-user.target EOF sudo systemctl daemon-reload sudo systemctl enable --now buildkitd ``` -------------------------------- ### Start Tenant B Daemon Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/platform/instance-per-tenant.md Execute this command to start the Slicer daemon for Tenant B using its generated configuration file. ```bash sudo slicer up tenant-b.yaml ``` -------------------------------- ### Install Claude Code and OpenCode Agents Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/coding-agents.md Shell into your Slicer VM and use `arkade` to install the specified AI agents. Binaries are installed to `/usr/local/bin` and persist if the VM is persistent. ```bash slicer vm shell slicer-1 # Install Claude Code arkade get claude --path /usr/local/bin # Install OpenCode arkade get opencode --path /usr/local/bin ``` -------------------------------- ### Install Arkade Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/tasks/pvm.md Install Arkade, a tool to download and manage OCI artifacts, which is used to fetch the PVM kernel packages. Ensure it's installed before proceeding. ```bash curl -sLS https://get.arkade.dev | sudo sh ``` -------------------------------- ### Install Slicer with ZFS Support Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/storage/zfs.md Run the Slicer installation script with the --zfs flag to enable ZFS storage. Specify the device for ZFS and optionally use --overwrite to clear existing data. Use with caution as this will destroy existing data. ```bash curl -sLS https://get.slicervm.com | sudo bash -s -- \ --zfs /dev/nvme0n1 \ --overwrite # Destroy any existing content on the disk ``` -------------------------------- ### Start Slicer Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/proxy/linux.md Starts the Slicer service. This command assumes the default slicer.yaml configuration. ```bash sudo slicer up ``` -------------------------------- ### OpenFaaS Edge Installation Script Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/openfaas-edge.md This bash script installs OpenFaaS Edge and optional components like a private registry and the Function Builder API. Configure installation by setting environment variables like INSTALL_REGISTRY and INSTALL_BUILDER. ```bash #!/usr/bin/env bash #============================================================================== # OpenFaaS Edge Installation Script #============================================================================== # This script installs OpenFaaS Edge, including optional # components like a private registry and function builder. #============================================================================== set -euxo pipefail #============================================================================== # CONFIGURATION #============================================================================== # Install additional services (registry and function builder) export INSTALL_REGISTRY=true export INSTALL_BUILDER=true #============================================================================== # SYSTEM PREPARATION and OpenFaaS Edge Installation #============================================================================== has_dnf() { [ -n "$(command -v dnf)" ] } has_apt_get() { [ -n "$(command -v apt-get)" ] } echo "==> Configuring system packages and dependencies..." if $(has_apt_get); then export HOME=/home/ubuntu sudo apt update -y # Configure iptables-persistent to avoid interactive prompts echo iptables-persistent iptables-persistent/autosave_v4 boolean false | sudo debconf-set-selections echo iptables-persistent iptables-persistent/autosave_v6 boolean false | sudo debconf-set-selections arkade oci install --path . ghcr.io/openfaasltd/faasd-pro-debian:latest sudo apt install ./openfaas-edge-*-amd64.deb --fix-broken -y if [ "${INSTALL_REGISTRY}" = "true" ]; then sudo apt install apache2-utils -y fi elif $(has_dnf); then export HOME=/home/slicer arkade oci install --path . ghcr.io/openfaasltd/faasd-pro-rpm:latest sudo dnf install openfaas-edge-*.rpm -y if [ "${INSTALL_REGISTRY}" = "true" ]; then sudo dnf install httpd-tools -y fi else fatal "Could not find apt-get or dnf. Cannot install dependencies on this OS." exit 1 fi # Install faas-cli arkade get faas-cli --progress=false --path=/usr/local/bin/ # Create the secrets directory and touch the license file sudo mkdir -p /var/lib/faasd/secrets touch /var/lib/faasd/secrets/openfaas_license #============================================================================== # PRIVATE REGISTRY AND FUNCTION BUILDER SETUP #============================================================================== ``` -------------------------------- ### Install K3s and Kubectl in VM Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/mac/linux-vm.md Installs K3s and kubectl within the VM using the 'arkade' tool. This prepares the VM to run Kubernetes workloads. ```bash arkade get k3sup kubectl k3sup install --local ``` -------------------------------- ### Monitor Slicer Logs Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/pihole-adblock.md These commands install `fstail` and then use it to monitor logs in the `/var/log/slicer/` directory, which is useful for observing the VM's installation progress. ```bash arkade get fstail sudo fstail /var/log/slicer/ ``` -------------------------------- ### Start Slicer Mac Daemon Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/mac/installation.md Starts the slicer-mac daemon. The first run will automatically pull and prepare the VM image. ```bash cd ~/slicer-mac ./slicer-mac up ``` -------------------------------- ### VM List Response Example Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/platform/single-instance.md An example JSON response when listing VMs. It shows a list of VM objects, each containing a hostname, an array of tags, and the VM's status. ```json [ {"hostname":"sandbox-1","tags":["user=alice","job=convert-video-123"],"status":"Running"}, {"hostname":"sandbox-2","tags":["user=bob","job=run-tests-456"],"status":"Running"} ] ``` -------------------------------- ### Start the VM Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/opencode-agent.md Initiate the virtual machine using the slicer command, referencing the OpenCode configuration file. ```bash sudo slicer up ./opencode.yaml ``` -------------------------------- ### Default VM Configuration Example Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/getting-started/walkthrough.md An example of a Slicer VM configuration file. It specifies host group settings, networking, storage, hypervisor, and API configuration. ```yaml config: host_groups: - name: vm storage: image storage_size: 25G count: 1 vcpu: 2 ram_gb: 4 network: bridge: brvm0 tap_prefix: vmtap gateway: 192.168.137.1/24 github_user: alexellis image: "ghcr.io/openfaasltd/slicer-systemd:6.1.90-x86_64-latest" hypervisor: firecracker api: port: 8080 bind_address: "127.0.0.1" ``` -------------------------------- ### Prepare Directories and Authentication for User Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/opencode-agent.md Sets up necessary directories and copies authentication files for a specified user. Ensures correct ownership and permissions for security. ```bash for d in /home/ubuntu/workdir /home/ubuntu/.local/share/opencode /home/ubuntu/.local/state /home/ubuntu/.cache; do mkdir -p "$d" chown ubuntu "$d" done cp /run/slicer/secrets/opencode-auth.json /home/ubuntu/.local/share/opencode/auth.json chown ubuntu /home/ubuntu/.local/share/opencode/auth.json chmod 600 /home/ubuntu/.local/share/opencode/auth.json ``` -------------------------------- ### Start Slicer within Nested VM Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/tasks/nested-virtualization.md Starts the Slicer daemon within the nested slicer0 VM using its configuration file. This completes the nested virtualization setup. ```bash sudo slicer up ./slicer1.yaml ``` -------------------------------- ### Install SlicerVM with ZFS (loopback) Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/getting-started/install.md Use this command to install SlicerVM with ZFS snapshot-based storage using a loopback device. This is suitable for development and testing environments. ```bash curl -sLS https://get.slicervm.com | sudo bash -s -- \ --zfs ``` -------------------------------- ### Create VM with Custom Resources and Userdata Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/platform/go-sdk.md Create a VM, overriding default resources like RAM and CPUs, and providing a boot script via the Userdata field. The script is executed upon VM startup. ```go node, err := client.CreateVM(ctx, "sandbox", slicer.SlicerCreateNodeRequest{ RamBytes: 4 * 1024 * 1024 * 1024, CPUs: 4, Userdata: "#!/bin/bash\napt update -qy && apt install -qy curl", }) ``` -------------------------------- ### Full Slicer YAML Configuration Example Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/reference/config.md This is a comprehensive example of a Slicer YAML configuration file. It demonstrates settings for host groups, storage, networking, API, and GitHub user for SSH access. ```yaml config: host_groups: - name: vm storage: image storage_size: 25G count: 1 vcpu: 2 ram_gb: 4 network: bridge: brvm0 tap_prefix: vmtap gateway: 192.168.137.1/24 github_user: alexellis image: "ghcr.io/openfaasltd/slicer-systemd:6.1.90-x86_64-latest" hypervisor: firecracker api: port: 8080 bind_address: "127.0.0.1" ``` -------------------------------- ### OpenFaaS Pro User Data Script Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/openfaas.md This script sets up an OpenFaaS Pro cluster within the Slicer VM. It installs necessary tools, configures K3s, applies OpenFaaS namespaces, creates a license secret, and installs OpenFaaS Pro using Helm. ```bash #!/bin/bash export HOME=/home/ubuntu export USER=ubuntu cd /home/ubuntu/ ( arkade get kubectl kubectx helm faas-cli k3sup stern --path /usr/local/bin chown $USER /usr/local/bin/* mkdir -p .kube ) ( k3sup install --local mv ./kubeconfig ./.kube/config chown $USER .kube/config ) ( kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml kubectl create secret generic \ -n openfaas \ openfaas-license \ --from-file license=/run/slicer/secrets/openfaas-license helm repo add openfaas https://openfaas.github.io/faas-netes/ helm repo update && \ helm upgrade --install openfaas \ --install openfaas/openfaas \ --namespace openfaas \ -f https://raw.githubusercontent.com/openfaas/faas-netes/refs/heads/master/chart/openfaas/values-pro.yaml chown -R $USER $HOME echo "export OPENFAAS_URL=http://127.0.0.1:31112" >> $HOME/.bashrc ) ``` -------------------------------- ### Start Slicer Proxy with Bind Address and Deny CIDR Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/proxy/linux.md Starts the Slicer proxy on the host, binding it to a specific IP address and denying access to a specified CIDR range. Requires CAP_NET_ADMIN for dummy adapter setup. ```bash sudo slicer proxy up \ --hostgroup sbox \ --bind 192.168.222.1 \ --deny-cidr 192.168.1.0/24 ``` -------------------------------- ### Automate NFS Client Setup with Userdata Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/tasks/share-files-with-nfs.md Configures a Slicer VM to automatically install the NFS client, create a mount point, and mount an NFS share upon boot using userdata. ```yaml config: host_groups: - name: vm userdata: | #!/bin/bash # Install NFS client apt update && apt install -y nfs-common # Create mount point mkdir -p /mnt/slicer_share # Add to fstab for persistent mounting echo "192.168.137.1:/srv/slicer_share /mnt/slicer_share nfs defaults 0 0" >> /etc/fstab # Mount immediately mount -a ``` -------------------------------- ### Add a sandbox VM and wait for agent Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/platform/quickstart.md Create a new sandbox VM and block until the in-guest agent is reachable. This ensures the VM is ready for immediate commands. Use `--cpus` and `--ram-gb` to specify resources, or provide them in the JSON body. Tags can be added for identification. ```bash slicer vm add sandbox --wait --timeout 60s ``` ```bash slicer vm add sandbox --wait --cpus 4 --ram-gb 8 ``` ```bash slicer vm add sandbox --wait --tag user=alice --tag job=convert-video-123 ``` -------------------------------- ### Start Slicer VM Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/proxy/mac.md Starts the Slicer application in a separate terminal. This command is typically run after the proxy has been started. ```bash cd ~/slicer-mac slicer-mac up ``` -------------------------------- ### Download K3sup Pro Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/ha-k3s.md Download and install K3sup Pro using curl. The PRO=true environment variable enables advanced features. Alternatively, manually move the binary to your PATH. ```bash curl -sSL https://get.k3sup.dev | PRO=true sudo -E sh ``` -------------------------------- ### Run the Go Program Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/platform/video-conversion.md Executes the Go program to perform the video conversion. Ensure the Go environment is set up. ```bash go run main.go ``` -------------------------------- ### Install VSCode Server via Userdata Script Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/remote-vscode.md This bash script installs VSCode server on a Linux VM. It adds the Microsoft package repository and installs the 'code' package. Ensure curl, gpg, and apt-transport-https are installed. ```bash #!/bin/bash ( sudo apt-get install -qy curl gpg apt-transport-https curl -sLS -o - https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg sudo install -D -o root -g root -m 644 microsoft.gpg /usr/share/keyrings/microsoft.gpg cat > /etc/apt/sources.list.d/vscode.sources << EOF Types: deb URIs: https://packages.microsoft.com/repos/code Suites: stable Components: main Architectures: amd64,arm64,armhf Signed-By: /usr/share/keyrings/microsoft.gpg EOF sudo apt install -qy apt-transport-https sudo apt update sudo apt install -qy code --no-install-recommends ) ``` -------------------------------- ### Run Docs Site Locally Source: https://github.com/slicervm/docs.slicervm.com/blob/master/README.md Execute this command to serve the documentation site on your local machine. ```bash mkdocs serve ``` -------------------------------- ### Set up Slicer Host Group (Bash) Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/platform/typescript-video-conversion.md Configure a Slicer host group for the example. Ensure SLICER_URL and SLICER_TOKEN are exported for subsequent commands. ```bash slicer new sdk --count=0 --graceful-shutdown=false > sdk.yaml sudo slicer up sdk.yaml export SLICER_URL="http://127.0.0.1:8080" export SLICER_TOKEN="$(sudo cat /var/lib/slicer/auth/token)" ``` ```bash export SLICER_URL=~/slicer-mac/slicer.sock ``` -------------------------------- ### Create a Simple Dockerfile Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/buildkit.md A basic Dockerfile example using Alpine Linux. This is used to demonstrate building an image with the remote builder. ```dockerfile FROM alpine:3.19 CMD ["echo", "Hello, BuildKit!"] ``` -------------------------------- ### Create VM with Default Settings Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/platform/go-sdk.md Create a new virtual machine using default settings for the specified host group. An empty request struct will utilize these defaults. ```go ctx := context.Background() node, err := client.CreateVM(ctx, "sandbox", slicer.SlicerCreateNodeRequest{}) if err != nil { log.Fatal(err) } fmt.Printf("hostname=%s ip=%s\n", node.Hostname, node.IP) ``` -------------------------------- ### Install PVM Kernel Packages Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/tasks/pvm.md Install the downloaded PVM kernel packages using dpkg. This command installs the kernel and associated modules onto the host system. ```bash sudo dpkg -i *.deb ``` -------------------------------- ### Create a Test Pod for Nvidia-SMI (Inline) Source: https://github.com/slicervm/docs.slicervm.com/blob/master/docs/examples/k3s-gpu.md Deploy a simple Pod that runs the `nvidia-smi` command to verify GPU access. This Pod uses the 'nvidia' runtime class. ```bash cat > nvidia-smi-pod.yaml <