SpectroCloud/RaspberryPiEdgePrep: Difference between revisions

From DER's LLC
Jump to navigation Jump to search
 
Line 70: Line 70:
  export AUTH_TOKEN=`curl --insecure -X POST -H "Content-Type: application/json" -d '{"username":"admin","password":"<password>"}' https://api.ders-vertex.dersllc.com/v1/auth/syslogin | jq -r '.Authorization'`
  export AUTH_TOKEN=`curl --insecure -X POST -H "Content-Type: application/json" -d '{"username":"admin","password":"<password>"}' https://api.ders-vertex.dersllc.com/v1/auth/syslogin | jq -r '.Authorization'`
  #echo $AUTH_TOKEN
  #echo $AUTH_TOKEN
  echo "curl --insecure -X GET -H 'Authorization: $AUTH_TOKEN'  https://api.ders-vertex.dersllc.com/v1/system/config/edgeNative/image" | bash -
  echo "curl --insecure -X GET -H 'Authorization: $AUTH_TOKEN'  https://api.vertex.dersllc.com/v1/system/config/edgeNative/image" | bash -
  echo "curl --insecure -X PUT -H 'Authorization: $AUTH_TOKEN' -H 'Content-Type: application/json' -d '{\"spec\":{\"imagesHostEndpoint\":\"$IMG_HOST_ENDPOINT\",\"stylusImagesEndpoint\":\"$STYLUS_IMG_ENDPOINT\"}}' https://api.ders-vertex.dersllc.com/v1/system/config/edgeNative/image" | bash -
  echo "curl --insecure -X PUT -H 'Authorization: $AUTH_TOKEN' -H 'Content-Type: application/json' -d '{\"spec\":{\"imagesHostEndpoint\":\"$IMG_HOST_ENDPOINT\",\"stylusImagesEndpoint\":\"$STYLUS_IMG_ENDPOINT\"}}' https://api.vertex.dersllc.com/v1/system/config/edgeNative/image" | bash -





Latest revision as of 20:50, 25 February 2025

Prepare Environment

##################################
# Setup NFS Mount (NOT REQUIRED) #
##################################
apt update -y
apt install nfs-common -y
snap install oras --classic
snap install docker
snap install k9s
echo "172.16.85.15:/Download      /nfs/Download    nfs vers=4.0    0 0" >> /etc/fstab
systemctl daemon-reload
mkdir -p /nfs/Download
mount -a
##########################
# Download Edge Binaries #
##########################
# Location: RETOOL -> Palette Release -> Vertex Info -> Airgap Binaries -> edge-rke2 -> <k8s_version>
# Location: RETOOL -> Palette Release -> Vertex Info -> Airgap Binaries -> edge-native-byoi

#############################
## TRUST HomeLab CA CERTS  ##
#############################
curl --insecure https://ders-gitlab.dersllc.com/ders/ders-proxy/-/raw/master/AddTrustExternalCARoot.crt > /usr/local/share/ca-certificates/ders-star-ca.crt
curl --insecure https://ders-gitlab.dersllc.com/ders/vmware-se/-/raw/main/HomeLab/DERS-CA-CERT/ders-ca.cer > /usr/local/share/ca-certificates/ders-ssca.crt
update-ca-certificates

###########################################
# Upload the Binaries into AirGapped Repo #
###########################################
# SET VARIABLES
export OCI_IMAGE_REGISTRY=harbor.dersllc.com
export OCI_IMAGE_BASE=spectro-images
export OCI_PACK_REGISTRY=harbor.dersllc.com
export OCI_PACK_BASE=spectro-packs
export AGENT_VERSION="v4.5.14"

docker login $OCI_IMAGE_REGISTRY -u admin -p '<Password>'
oras login $OCI_IMAGE_REGISTRY --username 'admin' --password '<Password>'

bash /nfs/Download/airgap-vertex-pack-edge-k8s-1.29.12.bin
bash /nfs/Download/airgap-vertex-pack-edge-k8s-1.31.4.bin
bash /nfs/Download/airgap-vertex-pack-edge-native-byoi-2.1.0.bin
bash /nfs/Download/airgap-vertex-pack-edge-rke2-1.31.4.bin

###########################
# Sync the Repo in Vertex #
###########################
# Navigate to: https://ders-vertex.dersllc.com/system
# Administration -> Pack Registries -> DERS-Harbor -> sync

################################################
# Pull the arm64 agent and push to Airgap Repo #
################################################
docker pull us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION
docker tag us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION
docker push $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION

###############################
# Enable Pause Agent Upgrades #
###############################
# Navigate to: edge-pi Project -> Project Settings -> Platform -> Platform Settings -> Pause Agent Upgrades

Troubleshooting

ERROR: system image is not defined cannot apply upgrade"

export IMG_HOST_ENDPOINT="us-docker.pkg.dev/palette-images/edge"
export STYLUS_IMG_ENDPOINT="harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge"

export AUTH_TOKEN=`curl --insecure -X POST -H "Content-Type: application/json" -d '{"username":"admin","password":"<password>"}' https://api.ders-vertex.dersllc.com/v1/auth/syslogin | jq -r '.Authorization'`
#echo $AUTH_TOKEN
echo "curl --insecure -X GET -H 'Authorization: $AUTH_TOKEN'  https://api.vertex.dersllc.com/v1/system/config/edgeNative/image" | bash -
echo "curl --insecure -X PUT -H 'Authorization: $AUTH_TOKEN' -H 'Content-Type: application/json' -d '{\"spec\":{\"imagesHostEndpoint\":\"$IMG_HOST_ENDPOINT\",\"stylusImagesEndpoint\":\"$STYLUS_IMG_ENDPOINT\"}}' https://api.vertex.dersllc.com/v1/system/config/edgeNative/image" | bash -


docker pull us-docker.pkg.dev/palette-images/edge/stylus-framework-linux-arm64:v4.5.14 --platform linux/arm64
docker tag us-docker.pkg.dev/palette-images/edge/stylus-framework-linux-arm64:v4.5.14 harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-framework-linux-arm64:v4.5.14
docker push harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-framework-linux-arm64:v4.5.14

docker pull us-docker.pkg.dev/palette-images/edge/stylus-linux-arm64:v4.5.14 --platform linux/arm64
docker tag us-docker.pkg.dev/palette-images/edge/stylus-linux-arm64:v4.5.14 harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-linux-arm64:v4.5.14
docker push harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-linux-arm64:v4.5.14

docker pull us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:v4.5.14 --platform linux/arm64
docker tag us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:v4.5.14 harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-agent-mode-linux-arm64:v4.5.14
docker push harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-agent-mode-linux-arm64:v4.5.14



Set Static IP Address (NOT WORKING)

# SSH to the Raspberry Pi or use the console.
# Set Static IP Address by running the following:
cat > /etc/netplan/50-cloud-init.yaml << "EOF"
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses:
      - 172.16.84.33/22
      nameservers:
        addresses:
        - 172.16.84.10
        search:
         - dersllc.com
      routes:
      -   to: default
          via: 172.16.84.1
EOF

netplan apply