DEPRECATED! PLEASE USE https://github.com/adobe/aio-cli TO MANAGE YOUR NEW APPS!
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
.envfile in the project root and fill it as shown below
npm run devto start your local Dev server- App will run on
localhost:9080by default - Local dev server uses an expressJS proxy to invoke action code.
- You can invoke your back-end actions defined locally via the url
localhost:9080/actions/<action_name>
- Run
npm run testto run unit tests for ui and actions - Run
npm run e2eto run e2e tests - Run
npm run coverageto generate Code coverage report
npm run buildto build your ui:React code and build your actionsnpm run deployto deploy all actions on Runtime and static files to S3npm run undeployto undeploy the app
For each of the above command you can either append :ui or :actions, for
example npm run build:ui will only build the UI.
- aio runtime CLI for action deployments
- expressJS for local dev
- parcelJS for packaging UI App (React by default) and actions
- s3 for serving static files
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_URLvariable in.envto 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 usehttps://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_BUCKETvars in your.envfile. In that case make sure to create the bucket beforehand.
- We use the
nameandversionfields for the deployment. Make sure to fill those out. Do not use illegal characters as this might break the deployment (e.g./,@,#, ..).
- List your backend actions under the
actionsfield within the__CNA_PACKAGE__package placeholder. We will take care of replacing the package name placeholder by your project name and version. - For each action, use the
functionfield to indicate the path to the action code. - More documentation for supported action fields can be found here.
-
You have two options to resolve your actions' dependencies:
-
Packaged action file: Add your action's dependencies to the root
package.jsonand install them usingnpm install. Then set thefunctionfield inmanifest.ymlto point to the entry file of your action folder. We will useparcelJSto 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.jsonwith the action's dependencies. Then set thefunctionfield inmanifest.ymlto 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.
-
-
This variable controls the configuration generation for action URLs used by the UI.
-
REMOTE_ACTIONS=true npm run devto 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.