@mikarinneoracle/oci-cdk-code-only-preview 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @mikarinneoracle/oci-cdk
|
|
1
|
+
# @mikarinneoracle/oci-cdk-code-only-preview
|
|
2
2
|
|
|
3
3
|
OCI Functions (Java, Python, Node.js), API Gateway, and related infrastructure via Terraform CDK. Run from your project root with `npx ocdk`.
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ Quick example (Python function + API Gateway):
|
|
|
7
7
|
```bash
|
|
8
8
|
mkdir my-python-function && cd my-python-function
|
|
9
9
|
fn init --runtime python
|
|
10
|
-
npm i --ignore-scripts @mikarinneoracle/oci-cdk
|
|
10
|
+
npm i --ignore-scripts @mikarinneoracle/oci-cdk-code-only-preview
|
|
11
11
|
export OCI_COMPARTMENT_ID='ocid1.compartment.oc1...gq'
|
|
12
12
|
|
|
13
13
|
# Deploy the function and API Gateway
|
|
@@ -86,10 +86,17 @@ Only **`OCI_COMPARTMENT_ID`** (or `OCI_COMPARTMENT_OCID`) is required for deploy
|
|
|
86
86
|
|
|
87
87
|
### Using an OCI CLI preview installation
|
|
88
88
|
|
|
89
|
-
Choose a non-default CLI executable without changing your shell `PATH
|
|
89
|
+
Choose a non-default CLI executable without changing your shell `PATH`. `OCI_CLI_PATH` must be the absolute path to the preview binary, not merely the directory containing it:
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
|
-
export OCI_CLI_PATH="
|
|
92
|
+
export OCI_CLI_PATH="/absolute/path/to/oci-preview-bin/oci"
|
|
93
|
+
"$OCI_CLI_PATH" --version
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
For the repository-local preview installation used in this checkout:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
export OCI_CLI_PATH="/Users/MRINNE/projects/ocdk/.tools/oci-preview-bin/oci"
|
|
93
100
|
```
|
|
94
101
|
|
|
95
102
|
The repository-local preview installation is required only for preview-only features such as Code-only Functions. Regular deployments continue to use `oci` from `PATH` unless `OCI_CLI_PATH` is set.
|
|
@@ -101,15 +108,31 @@ Code-only deployment first uses Terraform to create or manage the Function Appli
|
|
|
101
108
|
Activate the path with either `-code-only`, `--code-only`, or `OCI_CODE_ONLY=1`. The compatibility environment key `code-only=1` is also recognized when a process launcher can set a hyphenated environment name.
|
|
102
109
|
|
|
103
110
|
```bash
|
|
104
|
-
|
|
111
|
+
# Required: OCI CLI preview binary
|
|
112
|
+
export OCI_CLI_PATH="/Users/MRINNE/projects/ocdk/.tools/oci-preview-bin/oci"
|
|
113
|
+
"$OCI_CLI_PATH" --version
|
|
114
|
+
|
|
115
|
+
# Required: OCI target
|
|
105
116
|
export OCI_COMPARTMENT_ID='ocid1.compartment.oc1...'
|
|
106
|
-
|
|
107
|
-
|
|
117
|
+
|
|
118
|
+
# Required: code-only runtime and handler
|
|
108
119
|
export OCI_CODE_ONLY_RUNTIME_NAME='python312.ol9'
|
|
109
120
|
export OCI_FUNCTION_HANDLER='func.handler'
|
|
110
|
-
|
|
121
|
+
|
|
122
|
+
# Required in func.yaml: name: my-function
|
|
123
|
+
# Terraform creates the Function App; OCI CLI preview uploads the ZIP function
|
|
124
|
+
npx ocdk deploy --auto-approve --code-only
|
|
111
125
|
```
|
|
112
126
|
|
|
127
|
+
By default, the function name and Function App name both come from `func.yaml`'s `name`. Set these only to override that default or to use a differently named existing Function App:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
export OCI_FUNCTION_NAME='my-function'
|
|
131
|
+
export OCI_FUNCTION_APP_NAME='my-existing-function-app'
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
These settings are optional: `OCI_CODE_ONLY_SOURCE_DIR` (defaults to the current directory), `OCI_FUNCTION_MEMORY_MB` (from `func.yaml`, otherwise `256`), and `OCI_FUNCTION_TIMEOUT_SECONDS` (from `func.yaml`, otherwise `30`). `OCI_TENANCY_ID`, `OCI_REGION`, and `OCI_NAMESPACE` are also optional when they can be resolved from the active OCI CLI profile.
|
|
135
|
+
|
|
113
136
|
The archive is built from `OCI_CODE_ONLY_SOURCE_DIR` (or the current directory). It includes source files and excludes `node_modules`, `.git`, `.tools`, `.terraform`, and `cdktf.out`. The current preview path is function-only: it does not create an API Gateway because the CLI-managed function OCID is not in Terraform state.
|
|
114
137
|
|
|
115
138
|
Use the same flag or environment variable for deletion. OCDK deletes the CLI-managed function first, then lets Terraform destroy the Function App and its infrastructure:
|
|
@@ -118,7 +141,7 @@ Use the same flag or environment variable for deletion. OCDK deletes the CLI-man
|
|
|
118
141
|
npx ocdk destroy --code-only --auto-approve
|
|
119
142
|
```
|
|
120
143
|
|
|
121
|
-
Run from your project root (where your `func.yaml` / function code and `node_modules/@mikarinneoracle/oci-cdk` live):
|
|
144
|
+
Run from your project root (where your `func.yaml` / function code and `node_modules/@mikarinneoracle/oci-cdk-code-only-preview` live):
|
|
122
145
|
|
|
123
146
|
```bash
|
|
124
147
|
npx ocdk deploy
|
|
@@ -140,7 +163,7 @@ npx ocdk destroy
|
|
|
140
163
|
If you only need the utility temporarily, remove it after use:
|
|
141
164
|
|
|
142
165
|
```bash
|
|
143
|
-
npm uninstall --ignore-scripts @mikarinneoracle/oci-cdk
|
|
166
|
+
npm uninstall --ignore-scripts @mikarinneoracle/oci-cdk-code-only-preview
|
|
144
167
|
```
|
|
145
168
|
|
|
146
169
|
## IAM plan (API Gateway invoke + log tailing)
|