Search Docs…

Search Docs…

Guide

Preparing Proxus Packages for Cisco IOx-Enabled Devices

Preparing Proxus Packages for Cisco IOx-Enabled Devices

The scripts provided are specifically for preparing IOx packages of Proxus and NATS for deployment on Cisco IOx-enabled devices. This is just the package preparation step, not the actual installation on the IOx devices. Here's a detailed breakdown:

  1. Package Preparation
    The scripts will:

    • Download and set up the ioxclient tool

    • Pull the necessary Docker images (Proxus and NATS)

    • Create IOx package files for both Proxus and NATS

  2. Resulting Packages
    After running the script, you'll have two package files:

    • proxus/package.tar: The Proxus IOx package

    • nats/package.tar: The NATS IOx package

  3. Next Steps (not covered by the scripts)
    To actually deploy Proxus on your Cisco IOx devices, you'll need to:

    • Transfer these package files to your Cisco IOx-enabled device

    • Use Cisco's IOx Local Manager or ioxclient to install and activate the packages

  4. Script Usage

For Linux and macOS:

1. Open a terminal window.

2. Copy and paste the following script into your terminal:

set -eo pipefail
exec > >(tee -a logfile.log) 2>&1

# Color codes
BOLD='\033[1m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

# Logging function
log() {
    local level=$1
    local message=$2
    local timestamp=$(date +'%Y-%m-%d %H:%M:%S')
    case $level in
        INFO)
            echo -e "${BOLD}[${timestamp}] ${BLUE}INFO:${NC} $message"
            ;;
        SUCCESS)
            echo -e "${BOLD}[${timestamp}] ${GREEN}SUCCESS:${NC} $message"
            ;;
        WARNING)
            echo -e "${BOLD}[${timestamp}] ${YELLOW}WARNING:${NC} $message"
            ;;
        ERROR)
            echo -e "${BOLD}[${timestamp}] ${RED}ERROR:${NC} $message"
            ;;
    esac
}

create_package() {
    local app_name=$1 docker_image=$2 rootfs_name=$3 ports=$4 target=$5 description=$6
    mkdir -p "$app_name"
    cat > "$app_name/package.yaml" << EOF
descriptor-schema-version: "2.7"
info:
  name: "iox-${app_name}-edge"
  description: "${description}"
  version: "1.0"
app:
  cpuarch: "aarch64"
  type: "docker"
  resources:
    profile: c1.tiny
    network:
      - interface-name: eth0
        ports:
          tcp: [${ports}]
  startup:
    rootfs: ${rootfs_name}
    target: [${target}]
EOF
    (cd "$app_name" && "$IOXCLIENT" package .)
}

log "INFO" "Starting IOx package creation script for Proxus IIoT Platform"
log "INFO" "Visit ${BOLD}https://www.proxus.io/${NC} for more information"

echo # Empty line

os=$(uname | tr '[:upper:]' '[:lower:]')
arch=$(uname -m)

case "$os" in
    darwin) os_part="darwin_amd64" ;;
    linux)
        case "$arch" in
            aarch64) os_part="linux_arm64" ;;
            x86_64) os_part="linux_amd64" ;;
            *) os_part="linux_x86" ;;
        esac
        ;;
    *)
        case "$arch" in
            x86_64) os_part="windows_amd64" ;;
            *) os_part="windows_x86" ;;
        esac
        ;;
esac

download_url="https://pubhub.devnetcloud.com/media/iox/docs/artifacts/ioxclient/ioxclient-v1.17.0.0/ioxclient_1.17.0.0_${os_part}.zip"

log "INFO" "Downloading ioxclient from ${BOLD}$download_url${NC}"
wget -qO ioxclient.zip "$download_url"

log "INFO" "Extracting ioxclient"
unzip -oq ioxclient.zip
extracted_dir=$(ls -d ioxclient_*/ | head -n 1)

chmod +x "${extracted_dir}ioxclient"
IOXCLIENT=$(pwd)/"${extracted_dir}ioxclient"

log "INFO" "IOXCLIENT path: ${BOLD}$IOXCLIENT${NC}"
[[ ! -x "$IOXCLIENT" ]] && { log "ERROR" "ioxclient is not executable or not found."; exit 1; }

"$IOXCLIENT" --version

echo # Empty line

log "INFO" "Creating Proxus package"
docker pull proxusplatform/proxus-server:1.0.0.0-arm64
mkdir -p proxus
docker save -o proxus/rootfs.tar proxusplatform/proxus-server:1.0.0.0-arm64
create_package "proxus" \
              "proxusplatform/proxus-server:1.0.0.0-arm64" \
              "rootfs.tar" \
              "8084, 1883" \
              "\"dotnet\", \"Proxus.Server.dll\", \"GatewayID=2\", \"EdgeMode=Proxus\", \"BrokerUrl=nats://nats-leaf:4225\", \"BrokerUser=acc\", \"BrokerPassword=acc\"" \
              "Proxus Edge for IOx"

log "INFO" "Creating NATS package"
docker pull --platform linux/arm64 nats:latest
mkdir -p nats
docker save -o nats/rootfs.tar "nats"
create_package "nats" \
              "nats" \
              "rootfs.tar" \
              "4225" \
              "\"nats-server\"" \
              "NATS server for IOx"

echo # Empty line

log "SUCCESS" "IOx package creation script completed successfully"
log "INFO" "For more information about Proxus, visit ${BOLD}https://www.proxus.io/${NC}"

3. Press Enter to run the script.


For Windows:

1. Open PowerShell as Administrator.

2. Copy and paste the following script into your PowerShell window:

# Set error action preference to stop on any error
$ErrorActionPreference = "Stop"

# Start transcript for logging
Start-Transcript -Path "logfile.log" -Append

# Logging function
function Log {
    param (
        [string]$level,
        [string]$message
    )
    $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    Write-Host "[${timestamp}] ${level}: ${message}"
}

function Create-Package {
    param (
        [string]$app_name,
        [string]$docker_image,
        [string]$rootfs_name,
        [string]$ports,
        [string]$target,
        [string]$description
    )
    New-Item -Path $app_name -ItemType Directory -Force | Out-Null
    $packageYaml = @"
descriptor-schema-version: "2.7"
info:
  name: "iox-${app_name}-edge"
  description: "${description}"
  version: "1.0"
app:
  cpuarch: "aarch64"
  type: "docker"
  resources:
    profile: c1.tiny
    network:
      - interface-name: eth0
        ports:
          tcp: [${ports}]
  startup:
    rootfs: ${rootfs_name}
    target: [${target}]
"@
    Set-Content -Path "$app_name\package.yaml" -Value $packageYaml
    Push-Location $app_name
    & $IOXCLIENT package .
    Pop-Location
}

Log "INFO" "Starting IOx package creation script for Proxus IIoT Platform"
Log "INFO" "Visit https://www.proxus.io/ for more information"

Write-Host # Empty line

$arch = if ([Environment]::Is64BitOperatingSystem) { "amd64" } else { "x86" }
$os_part = "windows_$arch"

$download_url = "https://pubhub.devnetcloud.com/media/iox/docs/artifacts/ioxclient/ioxclient-v1.17.0.0/ioxclient_1.17.0.0_${os_part}.zip"

Log "INFO" "Downloading ioxclient from $download_url"
Start-BitsTransfer -Source $download_url -Destination "ioxclient.zip" -DisplayName "Downloading ioxclient"

Log "INFO" "Extracting ioxclient"
Expand-Archive -Path "ioxclient.zip" -DestinationPath "." -Force
$extracted_dir = Get-ChildItem -Directory -Filter "ioxclient_*" | Select-Object -First 1

$IOXCLIENT = Join-Path -Path $PWD -ChildPath "$($extracted_dir.Name)\ioxclient.exe"

Log "INFO" "IOXCLIENT path: $IOXCLIENT"
if (-not (Test-Path $IOXCLIENT)) {
    Log "ERROR" "ioxclient is not found."
    exit 1
}

# Create an empty config file if it doesn't exist
$configPath = "$env:USERPROFILE\.ioxclientcfg.yaml"
if (-not (Test-Path $configPath)) {
    New-Item -Path $configPath -ItemType File -Force | Out-Null
    Log "INFO" "Created empty config file: $configPath"
}

& $IOXCLIENT --version

Write-Host # Empty line

Log "INFO" "Creating Proxus package"
docker pull proxusplatform/proxus-server:1.0.0.0-arm64
New-Item -Path "proxus" -ItemType Directory -Force | Out-Null
docker save -o proxus/rootfs.tar proxusplatform/proxus-server:1.0.0.0-arm64
Create-Package -app_name "proxus" `
               -docker_image "proxusplatform/proxus-server:1.0.0.0-arm64" `
               -rootfs_name "rootfs.tar" `
               -ports "8084, 1883" `
               -target "`"dotnet`", `"Proxus.Server.dll`", `"GatewayID=2`", `"EdgeMode=Proxus`", `"BrokerUrl=nats://nats-leaf:4225`", `"BrokerUser=acc`", `"BrokerPassword=acc`"" `
               -description "Proxus Edge for IOx"

Log "INFO" "Creating NATS package"
docker pull --platform linux/arm64 nats:latest
New-Item -Path "nats" -ItemType Directory -Force | Out-Null
docker save -o nats/rootfs.tar "nats"
Create-Package -app_name "nats" `
               -docker_image "nats" `
               -rootfs_name "rootfs.tar" `
               -ports "4225" `
               -target "`"nats-server`"" `
               -description "NATS server for IOx"

Write-Host # Empty line

Log "SUCCESS" "IOx package creation script completed successfully"
Log "INFO" "For more information about Proxus, visit https://www.proxus.io/"

Stop-Transcript

3. Press Enter to run the script.

After running the appropriate script for your operating system, it will automatically download the necessary tools, create IOx packages for Proxus and NATS, and save them as `proxus/package.tar` and `nats/package.tar`. You can then use these packages to deploy Proxus on your Cisco IOx-enabled devices.

Preparing Proxus Packages for Cisco IOx-Enabled Devices

The scripts provided are specifically for preparing IOx packages of Proxus and NATS for deployment on Cisco IOx-enabled devices. This is just the package preparation step, not the actual installation on the IOx devices. Here's a detailed breakdown:

  1. Package Preparation
    The scripts will:

    • Download and set up the ioxclient tool

    • Pull the necessary Docker images (Proxus and NATS)

    • Create IOx package files for both Proxus and NATS

  2. Resulting Packages
    After running the script, you'll have two package files:

    • proxus/package.tar: The Proxus IOx package

    • nats/package.tar: The NATS IOx package

  3. Next Steps (not covered by the scripts)
    To actually deploy Proxus on your Cisco IOx devices, you'll need to:

    • Transfer these package files to your Cisco IOx-enabled device

    • Use Cisco's IOx Local Manager or ioxclient to install and activate the packages

  4. Script Usage

For Linux and macOS:

1. Open a terminal window.

2. Copy and paste the following script into your terminal:

set -eo pipefail
exec > >(tee -a logfile.log) 2>&1

# Color codes
BOLD='\033[1m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

# Logging function
log() {
    local level=$1
    local message=$2
    local timestamp=$(date +'%Y-%m-%d %H:%M:%S')
    case $level in
        INFO)
            echo -e "${BOLD}[${timestamp}] ${BLUE}INFO:${NC} $message"
            ;;
        SUCCESS)
            echo -e "${BOLD}[${timestamp}] ${GREEN}SUCCESS:${NC} $message"
            ;;
        WARNING)
            echo -e "${BOLD}[${timestamp}] ${YELLOW}WARNING:${NC} $message"
            ;;
        ERROR)
            echo -e "${BOLD}[${timestamp}] ${RED}ERROR:${NC} $message"
            ;;
    esac
}

create_package() {
    local app_name=$1 docker_image=$2 rootfs_name=$3 ports=$4 target=$5 description=$6
    mkdir -p "$app_name"
    cat > "$app_name/package.yaml" << EOF
descriptor-schema-version: "2.7"
info:
  name: "iox-${app_name}-edge"
  description: "${description}"
  version: "1.0"
app:
  cpuarch: "aarch64"
  type: "docker"
  resources:
    profile: c1.tiny
    network:
      - interface-name: eth0
        ports:
          tcp: [${ports}]
  startup:
    rootfs: ${rootfs_name}
    target: [${target}]
EOF
    (cd "$app_name" && "$IOXCLIENT" package .)
}

log "INFO" "Starting IOx package creation script for Proxus IIoT Platform"
log "INFO" "Visit ${BOLD}https://www.proxus.io/${NC} for more information"

echo # Empty line

os=$(uname | tr '[:upper:]' '[:lower:]')
arch=$(uname -m)

case "$os" in
    darwin) os_part="darwin_amd64" ;;
    linux)
        case "$arch" in
            aarch64) os_part="linux_arm64" ;;
            x86_64) os_part="linux_amd64" ;;
            *) os_part="linux_x86" ;;
        esac
        ;;
    *)
        case "$arch" in
            x86_64) os_part="windows_amd64" ;;
            *) os_part="windows_x86" ;;
        esac
        ;;
esac

download_url="https://pubhub.devnetcloud.com/media/iox/docs/artifacts/ioxclient/ioxclient-v1.17.0.0/ioxclient_1.17.0.0_${os_part}.zip"

log "INFO" "Downloading ioxclient from ${BOLD}$download_url${NC}"
wget -qO ioxclient.zip "$download_url"

log "INFO" "Extracting ioxclient"
unzip -oq ioxclient.zip
extracted_dir=$(ls -d ioxclient_*/ | head -n 1)

chmod +x "${extracted_dir}ioxclient"
IOXCLIENT=$(pwd)/"${extracted_dir}ioxclient"

log "INFO" "IOXCLIENT path: ${BOLD}$IOXCLIENT${NC}"
[[ ! -x "$IOXCLIENT" ]] && { log "ERROR" "ioxclient is not executable or not found."; exit 1; }

"$IOXCLIENT" --version

echo # Empty line

log "INFO" "Creating Proxus package"
docker pull proxusplatform/proxus-server:1.0.0.0-arm64
mkdir -p proxus
docker save -o proxus/rootfs.tar proxusplatform/proxus-server:1.0.0.0-arm64
create_package "proxus" \
              "proxusplatform/proxus-server:1.0.0.0-arm64" \
              "rootfs.tar" \
              "8084, 1883" \
              "\"dotnet\", \"Proxus.Server.dll\", \"GatewayID=2\", \"EdgeMode=Proxus\", \"BrokerUrl=nats://nats-leaf:4225\", \"BrokerUser=acc\", \"BrokerPassword=acc\"" \
              "Proxus Edge for IOx"

log "INFO" "Creating NATS package"
docker pull --platform linux/arm64 nats:latest
mkdir -p nats
docker save -o nats/rootfs.tar "nats"
create_package "nats" \
              "nats" \
              "rootfs.tar" \
              "4225" \
              "\"nats-server\"" \
              "NATS server for IOx"

echo # Empty line

log "SUCCESS" "IOx package creation script completed successfully"
log "INFO" "For more information about Proxus, visit ${BOLD}https://www.proxus.io/${NC}"

3. Press Enter to run the script.


For Windows:

1. Open PowerShell as Administrator.

2. Copy and paste the following script into your PowerShell window:

# Set error action preference to stop on any error
$ErrorActionPreference = "Stop"

# Start transcript for logging
Start-Transcript -Path "logfile.log" -Append

# Logging function
function Log {
    param (
        [string]$level,
        [string]$message
    )
    $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    Write-Host "[${timestamp}] ${level}: ${message}"
}

function Create-Package {
    param (
        [string]$app_name,
        [string]$docker_image,
        [string]$rootfs_name,
        [string]$ports,
        [string]$target,
        [string]$description
    )
    New-Item -Path $app_name -ItemType Directory -Force | Out-Null
    $packageYaml = @"
descriptor-schema-version: "2.7"
info:
  name: "iox-${app_name}-edge"
  description: "${description}"
  version: "1.0"
app:
  cpuarch: "aarch64"
  type: "docker"
  resources:
    profile: c1.tiny
    network:
      - interface-name: eth0
        ports:
          tcp: [${ports}]
  startup:
    rootfs: ${rootfs_name}
    target: [${target}]
"@
    Set-Content -Path "$app_name\package.yaml" -Value $packageYaml
    Push-Location $app_name
    & $IOXCLIENT package .
    Pop-Location
}

Log "INFO" "Starting IOx package creation script for Proxus IIoT Platform"
Log "INFO" "Visit https://www.proxus.io/ for more information"

Write-Host # Empty line

$arch = if ([Environment]::Is64BitOperatingSystem) { "amd64" } else { "x86" }
$os_part = "windows_$arch"

$download_url = "https://pubhub.devnetcloud.com/media/iox/docs/artifacts/ioxclient/ioxclient-v1.17.0.0/ioxclient_1.17.0.0_${os_part}.zip"

Log "INFO" "Downloading ioxclient from $download_url"
Start-BitsTransfer -Source $download_url -Destination "ioxclient.zip" -DisplayName "Downloading ioxclient"

Log "INFO" "Extracting ioxclient"
Expand-Archive -Path "ioxclient.zip" -DestinationPath "." -Force
$extracted_dir = Get-ChildItem -Directory -Filter "ioxclient_*" | Select-Object -First 1

$IOXCLIENT = Join-Path -Path $PWD -ChildPath "$($extracted_dir.Name)\ioxclient.exe"

Log "INFO" "IOXCLIENT path: $IOXCLIENT"
if (-not (Test-Path $IOXCLIENT)) {
    Log "ERROR" "ioxclient is not found."
    exit 1
}

# Create an empty config file if it doesn't exist
$configPath = "$env:USERPROFILE\.ioxclientcfg.yaml"
if (-not (Test-Path $configPath)) {
    New-Item -Path $configPath -ItemType File -Force | Out-Null
    Log "INFO" "Created empty config file: $configPath"
}

& $IOXCLIENT --version

Write-Host # Empty line

Log "INFO" "Creating Proxus package"
docker pull proxusplatform/proxus-server:1.0.0.0-arm64
New-Item -Path "proxus" -ItemType Directory -Force | Out-Null
docker save -o proxus/rootfs.tar proxusplatform/proxus-server:1.0.0.0-arm64
Create-Package -app_name "proxus" `
               -docker_image "proxusplatform/proxus-server:1.0.0.0-arm64" `
               -rootfs_name "rootfs.tar" `
               -ports "8084, 1883" `
               -target "`"dotnet`", `"Proxus.Server.dll`", `"GatewayID=2`", `"EdgeMode=Proxus`", `"BrokerUrl=nats://nats-leaf:4225`", `"BrokerUser=acc`", `"BrokerPassword=acc`"" `
               -description "Proxus Edge for IOx"

Log "INFO" "Creating NATS package"
docker pull --platform linux/arm64 nats:latest
New-Item -Path "nats" -ItemType Directory -Force | Out-Null
docker save -o nats/rootfs.tar "nats"
Create-Package -app_name "nats" `
               -docker_image "nats" `
               -rootfs_name "rootfs.tar" `
               -ports "4225" `
               -target "`"nats-server`"" `
               -description "NATS server for IOx"

Write-Host # Empty line

Log "SUCCESS" "IOx package creation script completed successfully"
Log "INFO" "For more information about Proxus, visit https://www.proxus.io/"

Stop-Transcript

3. Press Enter to run the script.

After running the appropriate script for your operating system, it will automatically download the necessary tools, create IOx packages for Proxus and NATS, and save them as `proxus/package.tar` and `nats/package.tar`. You can then use these packages to deploy Proxus on your Cisco IOx-enabled devices.

Preparing Proxus Packages for Cisco IOx-Enabled Devices

The scripts provided are specifically for preparing IOx packages of Proxus and NATS for deployment on Cisco IOx-enabled devices. This is just the package preparation step, not the actual installation on the IOx devices. Here's a detailed breakdown:

  1. Package Preparation
    The scripts will:

    • Download and set up the ioxclient tool

    • Pull the necessary Docker images (Proxus and NATS)

    • Create IOx package files for both Proxus and NATS

  2. Resulting Packages
    After running the script, you'll have two package files:

    • proxus/package.tar: The Proxus IOx package

    • nats/package.tar: The NATS IOx package

  3. Next Steps (not covered by the scripts)
    To actually deploy Proxus on your Cisco IOx devices, you'll need to:

    • Transfer these package files to your Cisco IOx-enabled device

    • Use Cisco's IOx Local Manager or ioxclient to install and activate the packages

  4. Script Usage

For Linux and macOS:

1. Open a terminal window.

2. Copy and paste the following script into your terminal:

set -eo pipefail
exec > >(tee -a logfile.log) 2>&1

# Color codes
BOLD='\033[1m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

# Logging function
log() {
    local level=$1
    local message=$2
    local timestamp=$(date +'%Y-%m-%d %H:%M:%S')
    case $level in
        INFO)
            echo -e "${BOLD}[${timestamp}] ${BLUE}INFO:${NC} $message"
            ;;
        SUCCESS)
            echo -e "${BOLD}[${timestamp}] ${GREEN}SUCCESS:${NC} $message"
            ;;
        WARNING)
            echo -e "${BOLD}[${timestamp}] ${YELLOW}WARNING:${NC} $message"
            ;;
        ERROR)
            echo -e "${BOLD}[${timestamp}] ${RED}ERROR:${NC} $message"
            ;;
    esac
}

create_package() {
    local app_name=$1 docker_image=$2 rootfs_name=$3 ports=$4 target=$5 description=$6
    mkdir -p "$app_name"
    cat > "$app_name/package.yaml" << EOF
descriptor-schema-version: "2.7"
info:
  name: "iox-${app_name}-edge"
  description: "${description}"
  version: "1.0"
app:
  cpuarch: "aarch64"
  type: "docker"
  resources:
    profile: c1.tiny
    network:
      - interface-name: eth0
        ports:
          tcp: [${ports}]
  startup:
    rootfs: ${rootfs_name}
    target: [${target}]
EOF
    (cd "$app_name" && "$IOXCLIENT" package .)
}

log "INFO" "Starting IOx package creation script for Proxus IIoT Platform"
log "INFO" "Visit ${BOLD}https://www.proxus.io/${NC} for more information"

echo # Empty line

os=$(uname | tr '[:upper:]' '[:lower:]')
arch=$(uname -m)

case "$os" in
    darwin) os_part="darwin_amd64" ;;
    linux)
        case "$arch" in
            aarch64) os_part="linux_arm64" ;;
            x86_64) os_part="linux_amd64" ;;
            *) os_part="linux_x86" ;;
        esac
        ;;
    *)
        case "$arch" in
            x86_64) os_part="windows_amd64" ;;
            *) os_part="windows_x86" ;;
        esac
        ;;
esac

download_url="https://pubhub.devnetcloud.com/media/iox/docs/artifacts/ioxclient/ioxclient-v1.17.0.0/ioxclient_1.17.0.0_${os_part}.zip"

log "INFO" "Downloading ioxclient from ${BOLD}$download_url${NC}"
wget -qO ioxclient.zip "$download_url"

log "INFO" "Extracting ioxclient"
unzip -oq ioxclient.zip
extracted_dir=$(ls -d ioxclient_*/ | head -n 1)

chmod +x "${extracted_dir}ioxclient"
IOXCLIENT=$(pwd)/"${extracted_dir}ioxclient"

log "INFO" "IOXCLIENT path: ${BOLD}$IOXCLIENT${NC}"
[[ ! -x "$IOXCLIENT" ]] && { log "ERROR" "ioxclient is not executable or not found."; exit 1; }

"$IOXCLIENT" --version

echo # Empty line

log "INFO" "Creating Proxus package"
docker pull proxusplatform/proxus-server:1.0.0.0-arm64
mkdir -p proxus
docker save -o proxus/rootfs.tar proxusplatform/proxus-server:1.0.0.0-arm64
create_package "proxus" \
              "proxusplatform/proxus-server:1.0.0.0-arm64" \
              "rootfs.tar" \
              "8084, 1883" \
              "\"dotnet\", \"Proxus.Server.dll\", \"GatewayID=2\", \"EdgeMode=Proxus\", \"BrokerUrl=nats://nats-leaf:4225\", \"BrokerUser=acc\", \"BrokerPassword=acc\"" \
              "Proxus Edge for IOx"

log "INFO" "Creating NATS package"
docker pull --platform linux/arm64 nats:latest
mkdir -p nats
docker save -o nats/rootfs.tar "nats"
create_package "nats" \
              "nats" \
              "rootfs.tar" \
              "4225" \
              "\"nats-server\"" \
              "NATS server for IOx"

echo # Empty line

log "SUCCESS" "IOx package creation script completed successfully"
log "INFO" "For more information about Proxus, visit ${BOLD}https://www.proxus.io/${NC}"

3. Press Enter to run the script.


For Windows:

1. Open PowerShell as Administrator.

2. Copy and paste the following script into your PowerShell window:

# Set error action preference to stop on any error
$ErrorActionPreference = "Stop"

# Start transcript for logging
Start-Transcript -Path "logfile.log" -Append

# Logging function
function Log {
    param (
        [string]$level,
        [string]$message
    )
    $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    Write-Host "[${timestamp}] ${level}: ${message}"
}

function Create-Package {
    param (
        [string]$app_name,
        [string]$docker_image,
        [string]$rootfs_name,
        [string]$ports,
        [string]$target,
        [string]$description
    )
    New-Item -Path $app_name -ItemType Directory -Force | Out-Null
    $packageYaml = @"
descriptor-schema-version: "2.7"
info:
  name: "iox-${app_name}-edge"
  description: "${description}"
  version: "1.0"
app:
  cpuarch: "aarch64"
  type: "docker"
  resources:
    profile: c1.tiny
    network:
      - interface-name: eth0
        ports:
          tcp: [${ports}]
  startup:
    rootfs: ${rootfs_name}
    target: [${target}]
"@
    Set-Content -Path "$app_name\package.yaml" -Value $packageYaml
    Push-Location $app_name
    & $IOXCLIENT package .
    Pop-Location
}

Log "INFO" "Starting IOx package creation script for Proxus IIoT Platform"
Log "INFO" "Visit https://www.proxus.io/ for more information"

Write-Host # Empty line

$arch = if ([Environment]::Is64BitOperatingSystem) { "amd64" } else { "x86" }
$os_part = "windows_$arch"

$download_url = "https://pubhub.devnetcloud.com/media/iox/docs/artifacts/ioxclient/ioxclient-v1.17.0.0/ioxclient_1.17.0.0_${os_part}.zip"

Log "INFO" "Downloading ioxclient from $download_url"
Start-BitsTransfer -Source $download_url -Destination "ioxclient.zip" -DisplayName "Downloading ioxclient"

Log "INFO" "Extracting ioxclient"
Expand-Archive -Path "ioxclient.zip" -DestinationPath "." -Force
$extracted_dir = Get-ChildItem -Directory -Filter "ioxclient_*" | Select-Object -First 1

$IOXCLIENT = Join-Path -Path $PWD -ChildPath "$($extracted_dir.Name)\ioxclient.exe"

Log "INFO" "IOXCLIENT path: $IOXCLIENT"
if (-not (Test-Path $IOXCLIENT)) {
    Log "ERROR" "ioxclient is not found."
    exit 1
}

# Create an empty config file if it doesn't exist
$configPath = "$env:USERPROFILE\.ioxclientcfg.yaml"
if (-not (Test-Path $configPath)) {
    New-Item -Path $configPath -ItemType File -Force | Out-Null
    Log "INFO" "Created empty config file: $configPath"
}

& $IOXCLIENT --version

Write-Host # Empty line

Log "INFO" "Creating Proxus package"
docker pull proxusplatform/proxus-server:1.0.0.0-arm64
New-Item -Path "proxus" -ItemType Directory -Force | Out-Null
docker save -o proxus/rootfs.tar proxusplatform/proxus-server:1.0.0.0-arm64
Create-Package -app_name "proxus" `
               -docker_image "proxusplatform/proxus-server:1.0.0.0-arm64" `
               -rootfs_name "rootfs.tar" `
               -ports "8084, 1883" `
               -target "`"dotnet`", `"Proxus.Server.dll`", `"GatewayID=2`", `"EdgeMode=Proxus`", `"BrokerUrl=nats://nats-leaf:4225`", `"BrokerUser=acc`", `"BrokerPassword=acc`"" `
               -description "Proxus Edge for IOx"

Log "INFO" "Creating NATS package"
docker pull --platform linux/arm64 nats:latest
New-Item -Path "nats" -ItemType Directory -Force | Out-Null
docker save -o nats/rootfs.tar "nats"
Create-Package -app_name "nats" `
               -docker_image "nats" `
               -rootfs_name "rootfs.tar" `
               -ports "4225" `
               -target "`"nats-server`"" `
               -description "NATS server for IOx"

Write-Host # Empty line

Log "SUCCESS" "IOx package creation script completed successfully"
Log "INFO" "For more information about Proxus, visit https://www.proxus.io/"

Stop-Transcript

3. Press Enter to run the script.

After running the appropriate script for your operating system, it will automatically download the necessary tools, create IOx packages for Proxus and NATS, and save them as `proxus/package.tar` and `nats/package.tar`. You can then use these packages to deploy Proxus on your Cisco IOx-enabled devices.

Proxus

© 2024

Proxus

© 2024