schemaVersion: 2.1.0
metadata:
  name: nodejs-configmap
  namespace: admin-codeready
projects:
  - name: nodejs-configmap
    zip:
      location: 'http://devfile-registry.openshift-workspaces.svc:8080/resources/v2/nodejs-configmap.zip'
components:
  - container:
      args:
        - sh
        - '-c'
        - '${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}'
      endpoints:
        - exposure: public
          name: nodejs-configmap
          protocol: http
          targetPort: 8080
      env:
        - name: NODE_CONFIGMAP_PATH
          value: /projects/nodejs-configmap/app-config.yml
        - name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE
          value: /remote-endpoint/plugin-remote-endpoint
        - name: THEIA_PLUGINS
          value: 'local-dir:///plugins/sidecars/tools'
        - name: CHE_DASHBOARD_URL
          value: 'https://devspaces-openshift-workspaces.apps.crw-airgap-v10.crw-qe.com'
        - name: CHE_PLUGIN_REGISTRY_URL
          value: 'https://devspaces-openshift-workspaces.apps.crw-airgap-v10.crw-qe.com/plugin-registry/v3'
        - name: CHE_PLUGIN_REGISTRY_INTERNAL_URL
          value: 'http://plugin-registry.openshift-workspaces.svc:8080/v3'
      image: 'registry.redhat.io/devspaces/udi-rhel8@sha256:4a6d60e87363eb819447e3193fe5eb5f4560fd949e2e29cc816a3df0b75146b6'
      memoryLimit: 3Gi
      sourceMapping: /projects
      volumeMounts:
        - name: npm
          path: /home/user/.npm
        - name: kube
          path: /home/theia/.kube
        - name: remote-endpoint
          path: /remote-endpoint
        - name: plugins
          path: /plugins
    name: tools
  - name: npm
    volume:
      size: 512Mi
  - name: kube
    volume: {}
commands:
  - exec:
      commandLine: npm install
      component: tools
      group:
        kind: build
      label: Install dependencies
      workingDir: '${PROJECTS_ROOT}/nodejs-configmap'
    id: 1-install
  - exec:
      commandLine: node --inspect=9229 .
      component: tools
      group:
        kind: run
      label: Run application
      workingDir: '${PROJECTS_ROOT}/nodejs-configmap'
    id: 2-run
  - exec:
      commandLine: npm run openshift
      component: tools
      group:
        kind: run
      label: Deploy application
      workingDir: '${PROJECTS_ROOT}/nodejs-configmap'
    id: 3-deploy
  - exec:
      commandLine: |
        echo
        echo "Before you can deploy this application to an openshift cluster,"
        echo "you must run 'oc login ...' in the tools terminal."
        echo
      component: tools
      group:
        kind: run
      label: Before deploy
      workingDir: '${PROJECTS_ROOT}/nodejs-configmap'
    id: 4-deploy-info
