A starter project for building a cloud native app (CNA) on top of Adobe I/O Runtime.
Install the AIO CLI and runtime plugin
npm install -g @adobe/aio-cli
aio plugins install @adobe/aio-cli-plugin-runtime
npm install
Create a .env
file in the project root and fill it as shown below
npm run dev
to start your local Dev serverlocalhost:9080
by defaultlocalhost:9080/actions/<action_name>
npm run test
to run unit tests for ui and actionsnpm run e2e
to run e2e testsnpm run coverage
to generate Code coverage reportnpm run build
to build your ui:React code and build your actionsnpm run deploy
to deploy all actions on Runtime and static files to S3npm run undeploy
to undeploy the appFor each of the above command you can either append :ui
or :actions
, for
example npm run build:ui
will only build the UI.
.env
WHISK_APIVERSION=v1
WHISK_APIHOST=https://adobeioruntime.net
WHISK_AUTH=<AUTH>
WHISK_NAMESPACE=<namespace>
# either TVM URL
TVM_URL=https://adobeioruntime.net/api/v1/web/adobeio/tvm/get-s3-upload-token
# Or bring your own S3 credentials and bucket
AWS_ACCESS_KEY_ID=<access-key>
AWS_SECRET_ACCESS_KEY=<secret>
S3_BUCKET=<bucket>
Set the TVM_URL
variable in .env
to point to a deployed CNA token vending
machine. It
allows you to download temporary and restricted credentials to upload your
static files to S3. Credentials will be cached in .aws.tmp.creds.json
. Users
with a valid namespace for Adobe I/O Runtime can simply use
https://adobeioruntime.net/api/v1/web/adobeio/tvm/get-s3-upload-token
.
Alternatively, you can bring your own AWS credentials by defining
AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
, S3_BUCKET
vars in your .env
file. In that case make sure to create the bucket beforehand.
package.json
name
and version
fields for the deployment. Make sure to fill
those out. Do not use illegal characters as this might break the deployment
(e.g. /
, @
, #
, ..).manifest.yml
actions
field within the __CNA_PACKAGE__
package placeholder. We will take care of replacing the package name placeholder
by your project name and version.function
field to indicate the path to the action
code.You have two options to resolve your actions' dependencies:
Packaged action file: Add your action's dependencies to the root
package.json
and install them using npm install
. Then set the function
field in manifest.yml
to point to the entry file of your action
folder. We will use parcelJS
to package your code and dependencies into a
single minified js file. The action will then be deployed as a single file.
Use this method if you want to reduce the size of your actions.
Zipped action folder: In the folder containing the action code add a
package.json
with the action's dependencies. Then set the function
field in manifest.yml
to point to the folder of that action. We will
install the required dependencies within that directory and zip the folder
before deploying it as a zipped action. Use this method if you want to keep
your action's dependencies separated.
REMOTE_ACTIONS
This variable controls the configuration generation for action URLs used by the UI.
REMOTE_ACTIONS=true npm run dev
to run the UI locally but access
remotely deployed actions.
Below is a configuration to run VS Code deubgger to launch and debug both the UI and Actions together.
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Server",
"runtimeExecutable": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
"program": "${workspaceFolder}/scripts/parcel.proxy.js",
"restart": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "chrome",
"request": "launch",
"name": "Client",
"url": "http://localhost:9080",
"webRoot": "${workspaceFolder}/we-src/src",
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
}
],
"compounds": [
{
"name": "Server/Client",
"configurations": ["Server", "Client"]
}
]
}
Contributions are welcomed! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.