Getting started with functions lab - MANDATORY There is also this secondary lab
You may consider the above lab as the best place to start using functions while the rest of this page is a repo for supplemental knowledge. In lab 301 and lab 302, we will build on the work from that lab. The bottom of this page in this repo has consolidated the terminal commands you will use in the above lab.
3 letter OCI region codes (useful for terminal commands in first lab)
Chapter 10 of this manual is useful for the registry
Preparing your container registry
Dockerizing your Python Application
Deploying docker image to project fn
Note: this lab will assume you have properly configured the project fn CLI on your machine
Begin by creating a new user.
Then create a group.
Add your created user to the functions group.
Create a policy for your group to enable function access. Note, you should probably be more secure than enabling tenancy wide access, but for speed - there is this option.
These are the policies you will need, click here to read more about IAM policies for functions. Navigate to developer services > functions, and create a new app.
These are performed in order and will setup your terminal to have fn and be connect to your cloud's container repository.
docker login iad.ocir.io
<TENANCY>/<USERNAME>
<TOKEN>
brew install fn
fn version
fn create context ocicontext1 --provider oracle
fn use context ocicontext1
fn update context oracle.profile functionsUser
fn update context oracle.compartment-id ocid1.tenancy.oc1..aaabkakkackakdnum3fd24qioebxwe3xuqdealrsa2g42gs4ja
fn update context api-url https://functions.us-ashburn-1.oci.oraclecloud.com
fn update context registry iad.ocir.io/<TENANCYNAME>/myrepo
fn init --runtime java helloworld-func
cd helloworld-func
fn -v deploy --app hellothere
fn invoke hellothere helloworld-func
Deploying your hello-world function to API Gateway
Querying an ATP database with Functions
Add functions user to the oci config file
Deploying a flask api on API Gateway