rolandweber / Pityoulish

A collection of programming/debugging exercises to support a course on Distributed Systems.
Creative Commons Zero v1.0 Universal
7 stars 0 forks source link

Run server in IBM Cloud #106

Closed rolandweber closed 4 years ago

rolandweber commented 4 years ago

Instructions are in src/pod/DeployOnKubernetes.md.


Get the server running on a free Kubernetes cluster in IBM Cloud. Part of #97.

Free clusters expire after 30 days. I've got to make the setup repeatable, so I can run a different free cluster for each session with the students.

The reason why I want to push the image into the IBM Cloud Registry is to reduce external network traffic, for which I might get charged.

rolandweber commented 4 years ago

Registering for a Pay-as-you-go account got me $200 credit within the first 30 days. Should be plenty, with network traffic being the only paid service I'm planning to make use of. 30 days suffice to figure out how to run the server in Cloud, but the student sessions will be afterwards. We'll see.

rolandweber commented 4 years ago

I'm installing the IBM Cloud developer tools locally for trying out. Eventually, I'd like to have GitHub workflows (actions) for deploying.

grrr They're installing docker, while I'm using podman. Tough luck.

rolandweber commented 4 years ago

The images I build on my workstation with podman are not visible to docker and vice versa. Setting up a GitHub workflow to push an image into IBM Cloud Registry will be a priority.

Maybe afterwards, I can get rid of the container-registry plugin and docker on my workstation again.

rolandweber commented 4 years ago

Here's how to authenticate against the IBM Cloud Container Registry for pushing images: https://cloud.ibm.com/docs/Registry?topic=Registry-registry_access#registry_access_apikey_auth_other The trick is to use "iamapikey" as the user name.

I should be able to push directly with podman from my workstation, or promote images from GitHub to IBM Cloud with skopeo in a GitHub workflow.

rolandweber commented 4 years ago

Pushing from my workstation works on the second attempt. It's "iamapikey", not "ibmapikey" ;-)

rolandweber commented 4 years ago

I got the pod running, and could connect to the Socket server port.

The Java RMI exercise requires some more effort. The ports in the container must be the same as those outside. And the external IP address of the worker node needs to be passed as hostname to Java RMI. That's because the internal port number and provided hostname appears in the stubs that Java RMI returns.

rolandweber commented 4 years ago

I've made the server ports and hostname configurable through environment variables. But somehow, I cannot get the port mapping to work - not even for the Socket server port anymore. Getting tired now... will try another day.

rolandweber commented 4 years ago

Duh... it works better when I use the external IP address of the worker node.

kubectl describe nodes | grep IP
  InternalIP:  10.x.y.z
  ExternalIP:  184.x.y.z

Got it working now for both Sockets and Java RMI. Still have to write it down though.