apiVersion: v1 kind: Template labels: app: nodejs-theia template: nodejs-theia message: 'The following service(s) have been created in your project: ${NAME}. For more information about using this template see https://github.com/devcomb/nodejs-ex/blob/master/README.md.' metadata: annotations: description: An example Node.js application with Theia IDE but no database. For more information about using this template, including OpenShift considerations, see https://github.com/devcomb/nodejs-ex/blob/master/README.md. iconClass: icon-nodejs openshift.io/display-name: Node.js + Theia IDE openshift.io/documentation-url: https://github.com/devcomb/nodejs-ex openshift.io/long-description: This template defines resources needed to develop a NodeJS application with Theia IDE, including a build configuration and application deployment configuration. It does not include a database. openshift.io/provider-display-name: '' openshift.io/support-url: '' tags: quickstart,nodejs,theia template.openshift.io/bindable: 'false' name: nodejs-theia objects: - apiVersion: v1 kind: Route metadata: name: ${NAME}-nginx spec: port: targetPort: 8080-tcp tls: termination: edge to: kind: Service name: ${NAME}-nginx-${SERVICE_HASH} weight: 100 wildcardPolicy: None - apiVersion: v1 kind: Service metadata: name: ${NAME}-proxy-${SERVICE_HASH} annotations: service.alpha.openshift.io/serving-cert-secret-name: proxy-tls spec: ports: - name: ${NAME}-proxy port: 4180 targetPort: 4180 selector: name: ${NAME}-proxy - apiVersion: v1 kind: Service metadata: annotations: description: Exposes and load balances the application pods name: ${NAME}-${SERVICE_HASH} spec: ports: - name: web port: ${{SEC_PORT}} targetPort: ${{SEC_PORT}} selector: name: ${NAME} - apiVersion: v1 kind: ImageStream metadata: annotations: description: Keeps track of changes in the application image name: ${NAME} - apiVersion: v1 kind: BuildConfig metadata: annotations: description: Defines how to build the application template.alpha.openshift.io/wait-for-ready: "true" name: ${NAME} spec: output: to: kind: ImageStreamTag name: ${NAME}:latest postCommit: script: npm test source: contextDir: ${CONTEXT_DIR} git: ref: ${SOURCE_REPOSITORY_REF} uri: ${SOURCE_REPOSITORY_URL} type: Git strategy: sourceStrategy: env: - name: NPM_MIRROR value: "${NPM_MIRROR}" forcePull: true from: kind: DockerImage name: docker.io/centos/nodejs-8-centos7:latest type: Source triggers: - type: ImageChange - type: ConfigChange - apiVersion: v1 kind: DeploymentConfig metadata: annotations: description: Defines how to deploy the application server template.alpha.openshift.io/wait-for-ready: 'true' name: ${NAME} spec: replicas: 1 selector: name: ${NAME} strategy: type: Rolling template: metadata: labels: name: ${NAME} name: ${NAME} spec: containers: - name: ${NAME} image: ' ' livenessProbe: httpGet: path: / port: ${{SEC_PORT}} initialDelaySeconds: 30 timeoutSeconds: 3 ports: - containerPort: ${{SEC_PORT}} readinessProbe: httpGet: path: / port: ${{SEC_PORT}} initialDelaySeconds: 3 timeoutSeconds: 3 resources: limits: cpu: ${CPU_LIMIT} memory: ${MEMORY_LIMIT} volumes: - name: proxy-tls secret: secretName: proxy-tls triggers: - imageChangeParams: automatic: true containerNames: - ${NAME} from: kind: ImageStreamTag name: ${NAME}:latest type: ImageChange - type: ConfigChange - apiVersion: v1 kind: ServiceAccount metadata: name: ${NAME}-nginx annotations: serviceaccounts.openshift.io/oauth-redirectreference.primary: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"${NAME}-nginx"}}' - apiVersion: v1 kind: DeploymentConfig metadata: annotations: description: Defines how to deploy the application server template.alpha.openshift.io/wait-for-ready: 'true' name: ${NAME}-proxy spec: replicas: ${DEV_PODS} selector: name: ${NAME}-proxy strategy: type: Rolling template: metadata: labels: name: ${NAME}-proxy name: ${NAME}-proxy spec: serviceAccount: ${NAME}-nginx serviceAccountName: ${NAME}-nginx containers: - name: oauth-proxy image: docker.io/openshift/oauth-proxy:latest imagePullPolicy: IfNotPresent ports: - containerPort: 4180 name: public protocol: TCP args: - --http-address=:4180 - --provider=openshift - --openshift-service-account=${NAME}-nginx - --cookie-secret=${COOKIE_SECRET} - --cookie-secure=false - --set-xauthrequest - --upstream=http://${NAME}-nginx-${SERVICE_HASH}:8080 - --tls-cert=/etc/tls/private/tls.crt - --tls-key=/etc/tls/private/tls.key volumeMounts: - mountPath: /etc/tls/private name: proxy-tls resources: limits: cpu: ${CPU_PROXY_LIMIT} memory: ${MEMORY_PROXY_LIMIT} volumes: - name: proxy-tls secret: secretName: proxy-tls triggers: - type: ConfigChange - apiVersion: v1 kind: Service metadata: annotations: description: Exposes and load balances the application pods name: ${NAME}-development-${SERVICE_HASH} spec: ports: - name: theia-dev port: ${{THEIA_PORT}} targetPort: ${{THEIA_PORT}} - name: web-dev port: ${{SEC_PORT}} targetPort: ${{SEC_PORT}} selector: name: ${NAME}-development - apiVersion: v1 kind: DeploymentConfig metadata: annotations: description: Defines how to deploy the application server template.alpha.openshift.io/wait-for-ready: 'true' name: ${NAME}-development spec: replicas: 1 selector: name: ${NAME}-development strategy: type: Rolling template: metadata: labels: name: ${NAME}-development name: ${NAME}-development spec: containers: - name: ${NAME}-development env: - name: SEC_PROC value: "${SEC_PROC}" - name: DEV_MODE value: "${DEV_MODE}" image: ' ' ports: - containerPort: ${{SEC_PORT}} resources: limits: cpu: ${CPU_DEV_LIMIT} memory: ${MEMORY_DEV_LIMIT} volumes: - name: proxy-tls secret: secretName: proxy-tls triggers: - imageChangeParams: automatic: true containerNames: - ${NAME}-development from: kind: ImageStreamTag name: ${NAME}-development:latest type: ImageChange - type: ConfigChange - apiVersion: v1 kind: ImageStream metadata: annotations: description: Keeps track of changes in the application image name: ${NAME}-development - apiVersion: v1 kind: BuildConfig metadata: annotations: description: Defines how to build the application template.alpha.openshift.io/wait-for-ready: "true" name: ${NAME}-development spec: output: to: kind: ImageStreamTag name: ${NAME}-development:latest postCommit: script: npm test source: contextDir: ${CONTEXT_DIR} git: ref: ${SOURCE_REPOSITORY_REF_DEV} uri: ${SOURCE_REPOSITORY_URL_DEV} type: Git strategy: sourceStrategy: env: - name: GIT_REPO_REF value: "${SOURCE_REPOSITORY_REF_DEV}" - name: NPM_MIRROR value: "${NPM_MIRROR}" - name: DEV_MODE value: 'true' - name: GIT_USERNAME value: "${GIT_USERNAME}" - name: GIT_EMAIL value: "${GIT_EMAIL}" - name: GIT_PASSWORD value: "${GIT_PASSWORD}" - name: GIT_TOKEN value: "${GIT_TOKEN}" forcePull: true from: kind: DockerImage name: docker.io/devcomb/theia-openshift:latest type: Source triggers: - type: ImageChange - type: ConfigChange - apiVersion: v1 kind: DeploymentConfig metadata: annotations: description: Nginx proxy with authentication based routing template.alpha.openshift.io/wait-for-ready: 'true' labels: app: ${NAME}-nginx name: ${NAME}-nginx spec: replicas: 1 selector: name: ${NAME}-nginx strategy: type: Rolling template: metadata: labels: name: ${NAME}-nginx name: ${NAME}-nginx spec: containers: - env: - name: APPWEB1_ADDR value: ${NAME}-${SERVICE_HASH}:8080 - name: APPWEB2_ADDR value: ${NAME}-development-${SERVICE_HASH}:8080 - name: APPWEB3_ADDR value: ${NAME}-development-${SERVICE_HASH}:3000 - name: APPWEB4_ADDR value: ${NAME}-proxy-${SERVICE_HASH}:4180 - name: DEV_EMAILS_WITH_LOCATIONS value: "${DEV_EMAILS_WITH_LOCATIONS}" - name: DEV_EMAILS_WITH_LOCATIONS_IDE value: "${DEV_EMAILS_WITH_LOCATIONS_IDE}" image: ' ' name: ${NAME}-nginx ports: - containerPort: 8080 protocol: TCP - containerPort: 8443 protocol: TCP readinessProbe: exec: command: - cat - /tmp/health failureThreshold: 3 initialDelaySeconds: 5 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 10 resources: limits: cpu: ${CPU_NGINX_LIMIT} memory: ${MEMORY_NGINX_LIMIT} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File dnsPolicy: ClusterFirst restartPolicy: Always schedulerName: default-scheduler securityContext: {} terminationGracePeriodSeconds: 30 test: false triggers: - imageChangeParams: automatic: true containerNames: - ${NAME}-nginx from: kind: ImageStreamTag name: ${NAME}-nginx:latest type: ImageChange - type: ConfigChange - apiVersion: v1 kind: Service metadata: annotations: openshift.io/generated-by: OpenShiftWebConsole creationTimestamp: null labels: app: ${NAME}-nginx-${SERVICE_HASH} name: ${NAME}-nginx-${SERVICE_HASH} spec: ports: - name: 8080-tcp port: 8080 protocol: TCP targetPort: 8080 selector: name: ${NAME}-nginx sessionAffinity: None type: ClusterIP status: loadBalancer: {} - apiVersion: v1 kind: BuildConfig metadata: annotations: openshift.io/generated-by: OpenShiftWebConsole labels: app: ${NAME}-nginx name: ${NAME}-nginx spec: output: to: kind: ImageStreamTag name: ${NAME}-nginx:latest postCommit: {} runPolicy: Serial source: git: ref: master uri: 'https://github.com/devcomb/nginx-ex.git' type: Git strategy: sourceStrategy: from: kind: ImageStreamTag name: 'nginx:1.12' namespace: openshift type: Source triggers: - type: ImageChange - type: ConfigChange - apiVersion: v1 kind: ImageStream metadata: annotations: description: Keeps track of changes in the application image name: ${NAME}-nginx parameters: - description: List developer emails that will view development deployment only. displayName: Developer Emails. name: DEV_EMAILS_WITH_LOCATIONS value: 'changeme@example.com development;' required: false - description: List developer emails that will be able to view development-ide. displayName: Developer Emails with Access to IDE. name: DEV_EMAILS_WITH_LOCATIONS_IDE value: 'changeme@example.com development-ide;' required: false - description: Development pods to create. Default is 0 to save resources. displayName: Replica Dev Pod Count name: DEV_PODS value: '0' required: true - description: The URL of the repository with your application source code. displayName: Git Repository URL name: SOURCE_REPOSITORY_URL required: true value: https://github.com/openshift/nodejs-ex.git - description: Set this to a branch name, tag or other ref of your repository if you are not using the default branch. displayName: Git Reference name: SOURCE_REPOSITORY_REF - description: The URL of the repository with your dev application source code. displayName: Development Git Repository URL name: SOURCE_REPOSITORY_URL_DEV required: true value: https://github.com/openshift/nodejs-ex.git - description: Set this to a dev branch name, tag or other ref of your repository if you are not using the default branch. displayName: Development Git Reference name: SOURCE_REPOSITORY_REF_DEV required: true value: master - description: Run Node.js Application. displayName: Secondary Application name: SEC_PROC value: 'true' required: true - description: Node.js Application IDE port. displayName: Secondary Application Port name: SEC_PORT value: '8080' required: true - description: Run Theia IDE. displayName: IDE Application name: DEV_MODE value: 'true' required: true - description: Theia IDE port. displayName: IDE Application Port name: THEIA_PORT value: '3000' required: true - description: The name assigned to all of the frontend objects defined in this template. displayName: Name name: NAME required: true value: 'nodejs-theia' - description: The OpenShift Namespace where the ImageStream resides. displayName: Namespace name: NAMESPACE required: true value: 'openshift' - description: Maximum amount of memory the container can use. displayName: Memory Limit name: MEMORY_LIMIT required: true value: 256Mi - description: Maximum amount of CPU the container can use. displayName: CPU Limit name: CPU_LIMIT required: true value: '50m' - description: Maximum amount of memory the proxy container can use. displayName: Proxy Pemory Limit name: MEMORY_PROXY_LIMIT required: true value: 100Mi - description: Maximum amount of CPU the proxy container can use. displayName: Proxy CPU Limit name: CPU_PROXY_LIMIT required: true value: '10m' - description: Maximum amount of memory the nginx container(s) can use. displayName: Proxy Pemory Limit name: MEMORY_NGINX_LIMIT required: true value: 100Mi - description: Maximum amount of CPU the nginx container(s) can use. displayName: Proxy CPU Limit name: CPU_NGINX_LIMIT required: true value: '2m' - description: Maximum amount of memory the development container can use. displayName: Dev Memory Limit name: MEMORY_DEV_LIMIT required: true value: 512Mi - description: Maximum amount of CPU the development container can use. displayName: Dev CPU Limit name: CPU_DEV_LIMIT required: true value: '400m' - description: Set this to the relative path to your project if it is not in the root of your repository. displayName: Context Directory name: CONTEXT_DIR - description: The exposed hostname that will route to the Node.js service, if left blank a value will be defaulted. displayName: Application Hostname name: APPLICATION_DOMAIN value: '' - description: Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted. displayName: GitHub Webhook Secret from: '[a-zA-Z0-9]{40}' generate: expression name: GITHUB_WEBHOOK_SECRET - description: A secret string used to configure the Generic webhook. displayName: Generic Webhook Secret from: '[a-zA-Z0-9]{40}' generate: expression name: GENERIC_WEBHOOK_SECRET - description: The custom NPM mirror URL displayName: Custom NPM Mirror URL name: NPM_MIRROR value: '' - description: Force Builder Base Image Pull from Repo displayName: Force Pull Builder Image name: FORCE_PULL required: false value: 'true' - description: Secondary Application Run Command displayName: Secondary Application Run Command name: SEC_COMMAND value: 'exec npm run -d start' - description: Secondary Application Debug Command displayName: Secondary Application Debug Command name: SEC_DEBUG_COMMAND value: 'exec nodemon --inspect=5858' - description: Git URL for Theia to use displayName: Theia Git URL name: GIT_REPO_URL value: '' - description: Git Email for Theia to use displayName: Theia Git Email name: GIT_EMAIL value: '' - description: Git Username for Theia to use displayName: Theia Git Username name: GIT_USERNAME value: '' - description: Git Password for Theia to use displayName: Theia Git Password name: GIT_PASSWORD value: '' - description: Git Token for Theia to use displayName: Theia Git Token name: GIT_TOKEN value: '' - description: Generate hash for service names to use of nginx proxy. displayName: Service Hash from: '[a-z]{16}' generate: expression name: SERVICE_HASH required: true - description: Generate hash for cookie secret. displayName: Cookie Secret from: '[a-z]{20}' generate: expression name: COOKIE_SECRET required: true