Deno runner

A deno-runner component allows you to deploy a Deno application stored in a git repository.

Basic information

To deploy a deno, the deno-runner component type will download the code from a public or private git repository, and execute the code accordingly. The following snippets shows a minimal deno application that will listen for incoming requests in port 8000.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: deno-private-repository-example
spec:
  components:
    - name: deno-example
      type: deno-runner
      properties:
        repoUrl: https://github.com/my-org/my-repository
        entryPoint: main.ts
        ports:
          - port: 8000
        ingresses:
          - targetPort: 8000
        allowNet: "true"

The runner, also supports the following properties:

name description
denoPath Deno path indicates the path inside the repository where the deno code is found and should be used as working directory
entryPoint File that must be passed to the deno run command as argument
allowNet Allow network access
allowSys Allow access to APIs that provide information about user’s operating system
allowEnv Allow environment access for things like getting and setting of environment variables
allowhrTime Allow high-resolution time measurement
allowFfi Allow loading of dynamic libraries
allowRead Allow file system read access
allowWrite Allow file system write access
allowRun Allow running subprocesses
allowAll Allow all permissions

Private repositories

To clone a private GitHub repository, you will need to pass two environment variables: GITHUB_TOKEN, and USER_NAME. To create a token, check the official GitHub documentation on Git PAT (Personal Access Token).

The following example, showcases how to reference a secret git-token using the storage trait. To create the secret, you can either create it manually, add it as a raw kubernetes object as part of the application, or use the data section in the storage secret trait.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: deno-private-repository-example
spec:
  components:
    - name: deno-example
      type: deno-runner
      properties:
        repoUrl: https://github.com/my-org/my-private-repository
        entryPoint: main.ts
        ports:
          - port: 8000
        ingresses:
          - targetPort: 8000
        allowNet: "true"
        allowEnv: "true"
      traits:
        - type: storage
          properties:
            secret:
              - name: git-token
                mountToEnvs:
                - envName: GITHUB_TOKEN
                  secretKey: GITHUB_TOKEN
                - envName: USER_NAME
                  secretKey: USER_NAME

Full example

To illustrate the usage of the deno-runner component, use the following application that will deploy the official deno with apollo example:

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: deno-apollo-example
spec:
  components:
    - name: deno-apollo-example
      type: deno-runner
      properties:
        repoUrl: https://github.com/denoland/examples
        entryPoint: main.ts
        denoPath: with-apollo/
        ports:
          - port: 8000
        ingresses:
          - targetPort: 8000
        allowNet: "true"
        allowRead: "true"
        allowEnv: "true"

Limitations

The current version of the deno runner component does not provide support for deno tasks and it is limited to deno run execution types. If you want access to other types of deno deployments, have feedback on the component, or suggestions for the future, please open a support ticket so it can be prioritized in the roadmap.