Create an Asset Compute project

Asset Compute projects are Node.js projects, generated using the Adobe I/O CLI, that adhere to a certain structure that allow them to be deployed to Adobe I/O Runtime and integrated with AEM as a Cloud Service. A single Asset Compute project can contain one or more Asset Compute workers, with each having a discrete HTTP end-point referenceable from an AEM as a Cloud Service Processing Profile.

Generate a project

Click-through of generating an Asset Compute project (No audio)

Use the Adobe I/O CLI Asset Compute plug-in to generate a new, empty Asset Compute project.

  1. From the command line, navigate to the folder to contain the project.
  2. From the command line, execute aio app init to begin the interactive project generation CLI.
  3. Select Org
    • Select the Adobe Org that has AEM as a Cloud Service, Project Firefly are registered with
  4. Select Project
    • Locate and select the Project. This is the Project title created from the Firefly project template, in this case WKND AEM Asset Compute
  5. Select Workspace
    • Select the Development workspace
  6. Which Adobe I/O App features do you want to enable for this project? Select components to include
    • Select Actions: Deploy runtime actions
    • Use the arrows keys to select and space to unselect/select, and Enter to confirm selection
  7. Select type of actions to generate
    • Select Adobe Asset Compute Worker
    • Use the arrows keys to select, space to unselect/select, and Enter to confirm selection
  8. How would you like to name this action?
    • Use the default name worker.
    • If your project contains multiple workers that perform different asset computations, name them semantically

Generate console.json

The developer tool requires a file named console.json that contains the necessary credentials to connect to Adobe I/O. This file is downloaded from the Adobe I/O console.

  1. Open the Asset Compute worker’s Adobe I/O project
  2. Select the project workspace to download the console.json credentials for, in this case select Development
  3. Go to the root of the Adobe I/O project and tap Download All in the upper-right corner.
  4. A file is downloaded as a .json file prefixed with the project and workspace, for example: wkndAemAssetCompute-81368-Development.json
  5. You can either
    • Rename the file as config.json and move it in the root of your Asset Compute worker project. This is the approach in this tutorial.

    • Move it into an arbitrary folder AND reference that folder from your .env file with a configuration entry ASSET_COMPUTE_INTEGRATION_FILE_PATH. The file path can be absolute or relative to the root of your project. For example:

      • ASSET_COMPUTE_INTEGRATION_FILE_PATH=/Users/example-user/secrets/wkndAemAssetCompute-81368-Development.json

      Or

      • ASSET_COMPUTE_INTEGRATION_FILE_PATH=../../secrets/wkndAemAssetCompute-81368-Development.json.json

NOTE
The file contains credentials. If you store the file within your project, make sure to add it to your .gitignore file to prevent from being shared. The same applies to the .env file – These credentials files must not be shared, or stored in Git.

Review the anatomy of the project

The generated Asset Compute project is a Node.js project for use as a specialized Adobe Project Firefly project. The following structural elements are idiosyncratic to Asset Compute project:

  • /actions contains subfolders, and each subfolder defines an Asset Compute worker.
    • /actions/<worker-name>/index.js defines the JavaScript used to perform the work of this worker.
      • The folder name worker is a default, and can be anything, as long as it is registered in the manifest.yml.
      • More than one worker folder can be defined under /actions as needed, however they must be registered in the manifest.yml.
  • /test/asset-compute contains the test suites for each worker. Similar to the /actions folder, /test/asset-compute can contain multiple subfolders, each corresponding to the worker it tests.
    • /test/asset-compute/worker, representing a test suite for a specific worker, contains subfolders representing a specific test-case, along with the test input, parameters, and expected output.
  • /build contains the output, logs, and artifacts of Asset Compute test case executions.
  • /manifest.yml defines what Asset Compute workers the project provides. Each worker implementation must be enumerated in this file to make them available to AEM as a Cloud Service.
  • /console.json defines Adobe I/O configurations
    • This file can be generated/updated using the aio app use command.
  • /.aio contains configurations used by the aio CLI tool.
    • This file can be generated/updated using the aio app use command.
  • /.env defines environment variables in a key=value syntax and contains secrets that should not be shared. To protect these secrets, this file should NOT be checked into Git and is ignored via the project’s default .gitignore file.
    • This file can be generated/updated using the aio app use command.
    • Variables defined in this file can be overridden by exporting variables on the command line.

For more details on project structure review, review the Anatomy of an Adobe Project Firefly project.

The bulk of the development takes place in the /actions folder developing worker implementations, and in /test/asset-compute writing tests for the custom Asset Compute workers.

Asset Compute project on GitHub

The final Asset Compute project is available on GitHub at:

GitHub contains the final state of the project, fully populated with the worker and test cases, but does not contain any credentials, that is, .env, console.json or .aio.

On this page