If one or more OCI Functions users is not a tenancy administrator:
Sign in to the Console as a tenancy administrator.
Open the navigation menu and select Identity & Security. Under Identity, select Policies.
Select Create Policy, specify a name and description for the new policy, and select the tenancy's root compartment.
Use the Policy Builder to create the policy. Select Functions from the list of Policy use cases, and base the policy on the policy template Let users create, deploy, and manage functions and applications.
The policy template includes the following policy statements:
Allow group <group-name> to use cloud-shell in tenancy
Allow group <group-name> to manage repos in tenancy
Allow group <group-name> to read objectstorage-namespaces in tenancy
Allow group <group-name> to manage logging-family in tenancy
Allow group <group-name> to read metrics in tenancy
Allow group <group-name> to manage functions-family in tenancy
Allow group <group-name> to use virtual-network-family in tenancy
Allow group <group-name> to use apm-domains in tenancy
Allow group <group-name> to read vaults in tenancy
Allow group <group-name> to use keys in tenancy
Allow service faas to use apm-domains in tenancy
Allow service faas to read repos in tenancy where request.operation='ListContainerImageSignatures'
Allow service faas to {KEY_READ} in tenancy where request.operation='GetKeyVersion'
Allow service faas to {KEY_VERIFY} in tenancy where request.operation='Verify'
If necessary, you can restrict these policy statements by compartment.
Open the navigation menu and select Developer Services. Under Functions, select Applications.
Select the region you're using with OCI Functions.
Select Create Application.
Specify:
helloworld-app as the name for the new application. You'll deploy your first function in this application, and specify this application when invoking the function.
The VCN and subnet in which to run the function. Note that a public subnet requires an internet gateway in the VCN, and a private subnet requires a service gateway in the VCN.
Select the helloworld-app application you just created to display the application details page.
Select the Getting Started link, and then select Cloud Shell Setup.
Tip: The Getting Started page now displays commands tailored specifically for you. You copy and paste these commands to configure your Cloud Shell environment for functions development.
Select Launch Cloud Shell to display the Cloud Shell terminal window.
Configure the Fn Project context with the Oracle Cloud Infrastructure Registry address in the current region and tenancy that you want to use with OCI Functions:
where <repo-name-prefix> is a prefix of your choosing for the Oracle Cloud Infrastructure Registry repository in which to store images for the function. For example:
Configure the Fn Project context with the OCID of the compartment for repositories to and from which you want OCI Functions to push and pull function images, by entering:
Select Generate an Auth Token to display the Auth Tokens page, and select Generate Token.
Enter a meaningful description for the auth token in the Generate Token dialog, and select Generate Token. The new auth token is displayed (for example, 6aN...6MqX).
Copy the auth token immediately to a secure location from where you can retrieve it later, because you won't see the auth token again in the Console.
Change directory to the hello-java directory created in the previous step:
cd hello-java
Enter the following single Fn Project command to build the function and its dependencies as a Docker image called hello-java, push the image to the specified Docker registry, and deploy the function to OCI Functions in the helloworld-app application that you created earlier:
fn -v deploy --app helloworld-app
(Optional) Confirm that the function has been deployed to OCI Functions by selecting Functions (under Resources on the details page for the helloworld-app application) and noting that the hello-java function now appears.