Skip to content

Instantly share code, notes, and snippets.

@timroster
Last active January 7, 2024 02:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timroster/6e34ffeee5e63020c6529da08248af9b to your computer and use it in GitHub Desktop.
Save timroster/6e34ffeee5e63020c6529da08248af9b to your computer and use it in GitHub Desktop.
Getting started with LinuxONE Community Cloud for IBM App Modernization workshops

Setting up your vm for the IBM Application Modernization workshop

For this workshop, you will request and use your own virtual machine from the LinuxONE Community Cloud. Setup for the virtual machine should take about 30-45 minutes.

Step 1. Sign up for the LinuxONE Community Cloud and request a VM

Visit the LinuxONE Community Cloud and request a new VM using the Try a LinuxONE Virtual Server button.

Complete the form and confirm your email to activate your LinuxONE Community Cloud account.

When the account is activated, open the Deployment Guide and scroll to First time setup. Follow the steps to create your virtual machine. Important: select a RHEL 7.6 virtual machine (it may look a little different from screenshots, but that's ok) and complete all steps including verifying that you can log in to the virtual machine from your workstation.

Step 2. Configure your virtual machine for the workshop

As provisioned, the virtual machine needs some additional packages to be installed so that you can complete all of the hands-on labs for the workshop. The virtual machine docker configuration will also need a copy of the signing certificate used by the ICP container image registry.

Use the setupVM.sh script included in this gist file to configure the virtual machine. Log in to your virtual machine and run these commands:

curl -LO https://gist.githubusercontent.com/timroster/6e34ffeee5e63020c6529da08248af9b/raw/87e9186b374ea92cefdf3dd8aedffd4ce8f2e75d/setupVM.sh
chmod +x setupVM.sh
./setupVM.sh

Step 3. Verify docker setup

After running the setup script on your VM, you should be able to run docker commands. Test it out:

We are following the Red Hat enterprise linux convention of using the sudo command to invoke docker.

sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository registry.access.redhat.com/hello-world ... 
Pulling repository registry.access.redhat.com/hello-world
Trying to pull repository docker.io/library/hello-world ... 
latest: Pulling from docker.io/library/hello-world
d39d9a31884d: Pull complete 
Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8
Status: Downloaded newer image for docker.io/hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (s390x)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

If you saw a message similar to the above, congratulations! You are all set with a LinuxONE vm that can run docker containers and perform other tasks for the workshop labs.

#!/bin/bash
# Adjust these parameters based on the specifics of the ICP cluster
CLUSTER_HOST=cluster103.icp
CLUSTER_IP=148.100.92.103
# no editing needed below EXCEPT to update the registry certificate when running in a new cluster
REGISTRY_URL=$CLUSTER_HOST\:8500
echo "adding cluster to hosts file"
echo "$CLUSTER_IP $CLUSTER_HOST" | sudo tee -a /etc/hosts > /dev/null
# set up docker and maven (includes ibm java 8)
sudo yum install -y docker maven
# set up clis
curl -kLo cloudctl-linux-s390x-3.1.2-1203 https://$CLUSTER_IP:8443/api/cli/cloudctl-linux-s390x
chmod +x cloudctl-linux-s390x-3.1.2-1203
sudo mv cloudctl-linux-s390x-3.1.2-1203 /usr/local/bin/cloudctl
curl -kLo kubectl-linux-s390x-v1.12.4 https://$CLUSTER_IP:8443/api/cli/kubectl-linux-s390x
chmod +x kubectl-linux-s390x-v1.12.4
sudo mv kubectl-linux-s390x-v1.12.4 /usr/local/bin/kubectl
curl -kLo helm-linux-s390x-v2.9.1.tar.gz https://$CLUSTER_IP:8443/api/cli/helm-linux-s390x.tar.gz
tar -xf helm-linux-s390x-v2.9.1.tar.gz
sudo mv linux-s390x/helm /usr/local/bin
rm -rf helm-linux-s390x-v2.9.1.tar.gz linux-s390x
# configure docker with private registry CA credentials - update this with your registry CA cert
cat << EOF > ca.crt
-----BEGIN CERTIFICATE-----
M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QYIKwYBBQUHAwIwCwYDVR0PBAQD
AgWgMDAGA1UdEQQpMCeHBH8AAAGCCWxvY2FsaG9zdIcElGRcZ4IOY2x1c3RlcjEw
My5pY3AwDQYJKoZIhvcNAQELBQADggIBABC2/40DZ2Np2ixJMMNECzviw9B8ljlM
5YA/D6dAp2WbPCPAkAi1srNnUGXdHIT0Yr9aPrVFsaV3gAHp6rVYg4EfAr0mhJtT
rqnOP8gzYBqmRFHYqwgH42Cy4KiC6dhgyqq5kVQw931AFPBd/+7/Rq61KGrYBsAe
GVxDUq+4WB82rOMslPjjztStso/ijXKWFtVVUcMEhoNiwH90y06qCfP3YMLvCnIz
nliUY6r7tQdH27z0y5FKmaTk7TRagQ5WSJ64nlYCYnrI/dYmifvDBC9wuDI0x499
3mFI9hZbcRdzGUVuw/dR2H1Sjgv6xv+ULEli8yyaAvly0IkgQ4nevKkzk6Yc/MXf
PpMtE0ua2R0i3bCSOfgaeOVh0ofi4qWZaK/9qVjSaCDC+8A9keQvij+fLIliLghs
tG9Hn81QUlkfRYxMzmB4uVaNQB9Sy1P+z8A7OUrrbsN9JrnzuUk+VEmxgolAlFdL
ejuWc0dd9MyNkoDWxGC3uAzVEBAqYIxRF/Uq98pBtgQxiEe6DNhtf+YoRT2zGac1
OVS1TfTAP3abrAcreSCKdScmE3OkckBNXDbHe/SK2NI6IWEr3xWtBSwhIqvnyeb9
qhF0cLVN1VvbERjV1p9wjSEFreT/TIUlURfdF8qc1x5XhuWDtkCrwGZf+cZ8Lyyj
hY4IGnrfrPGv
-----END CERTIFICATE-----
EOF
sudo mkdir -p /etc/docker/certs.d/${REGISTRY_URL}
sudo cp ca.crt /etc/docker/certs.d/${REGISTRY_URL}
rm ca.crt
# start up docker engine
sudo systemctl start docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment