Cloud Shell Architecture

Cloud Shell Architecture
Oracle OCI Cloud Shell Image

By complete accident, I ran into an issue with OCI Functions in the Cloud Shell. That novelty has caught me off guard, and I decided to take note of it.

In the Oracle Cloud, you cannot simply create an OCI Function; it must be declared through the OCI Application. The application binds your serverless function to the virtual cloud network (VCN) and one or more subnets. And it predefines the application architecture.

You choose x86, ARM, or both.

And you should choose wisely, because you cannot edit an application, not really. Now, let's go back to the Cloud Shell. I created an x86 application since the code contains binary-based dependencies. Pulled the function code into the Cloud Shell and attempted to deploy it. This attempt failed

$ fn deploy --app iad-ap-app-x86
Deploying hello-python to app: iad-ap-app-x86
Bumped to version 0.0.6
Using Container engine docker
Building image iad.ocir.io/ocuocictrng30/user12/hello-python:0.0.6 TargetedPlatform:  amd64HostPlatform:  arm64

Error during build. Run with `--verbose` flag to see what went wrong. eg: `fn --verbose CMD`

Fn: error running docker build: OL8 CloudShell does not support cross-compilation and multi-arch functions builds. Please ensure the architecture of your App matches the CloudShell architecture.

See 'fn <command> --help' for more information. Client version: 0.6.41

That's how I found that OCI Could Shell has architecture.

Turns out that the OCI Cloud Shell allows you to change the shell architecture, and the default value is "No preference." In my case, the ball rolled into the ARM-based VM. To change it:

  • Select the "Actions" menu in the terminal header and select "Architecture."
  • From the choices, select the architecture of your preference and then click the "Confirm and Restart" button.

After a minute or two, the terminal restarted in the requested state, preserving your command history and configuration context. Make sure you are still logged into the OCI repository and retry the deployment.

@cloudshell:hello-python (us-ashburn-1)$ fn deploy --app iad-ap-app-x86
Deploying hello-python to app: iad-ap-app-x86
Bumped to version 0.0.9
Using Container engine docker
Building image iad.ocir.io/ocuocictrng30/user12/hello-python:0.0.9 TargetedPlatform:  amd64HostPlatform:  amd64
...................................................................................
Using Container engine  docker  to push
Pushing iad.ocir.io/ocuocictrng30/user12/hello-python:0.0.9 to docker registry...Getting image source signatures
Copying blob 637640ef2c42 done   | 
Copying blob bab6c5af62fd done   | 
Copying blob 634c9a121149 done   | 
Copying blob 7606ac173f1d done   | 
Copying blob 4abc45914610 done   | 
Copying config be2d1a9730 done   | 
Writing manifest to image destination
Updating function hello-python using image iad.ocir.io/ocuocictrng30/user12/hello-python:0.0.9...
Successfully created function: hello-python with iad.ocir.io/ocuocictrng30/user12/hello-python:0.0.9
@cloudshell:hello-python (us-ashburn-1)$ 

Now Deployment Works.

With matched shell and application shapes, deployment proceeds without issues.

The Last-minute tip.

If you definitely need a mixed architecture application and want to build multi-architecture images, refer to this nice Red Hat Podman article. Because Oracle Cloud Shell uses Podman as a drop-in replacement for Docker.