# Deploying a demo application

Once you [have access](https://datalab.tuwien.ac.at/de/infrastructure/openshift/creating-a-project/), you can deploy the [Podtato-head demo application](https://github.com/podtato-head/podtato-head).

!!! warning
    Please make sure to replace the hostname for your application with `project-YOURPROJECTNAME.apps.datalab.unicloud.at` at
    the bottom of the YAML file.

Save the following YAML to a file on your computer, edit the hostname, then run `oc apply -f yourfile.yaml`. Your
application will be available on the configured endpoint.

```yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: podtato-head-entry
  labels:
    app: podtato-head
spec:
  selector:
    matchLabels:
      component: podtato-head-entry
  template:
    metadata:
      labels:
        component: podtato-head-entry
    spec:
      terminationGracePeriodSeconds: 5
      containers:
      - name: server
        image: ghcr.io/podtato-head/entry:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 9000
        env:
        - name: PODTATO_PORT
          value: "9000"
        resources:
          limits:
            memory: 100Mi
          requests:
            cpu: 20m
            memory: 50Mi
---
apiVersion: v1
kind: Service
metadata:
  name: podtato-head-entry
  labels:
    app: podtato-head
spec:
  selector:
    component: podtato-head-entry
  ports:
  - name: http
    port: 9000
    protocol: TCP
    targetPort: 9000
  type: LoadBalancer
  # change to NodePort if no LoadBalancer controller is available
  # type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: podtato-head-hat
  labels:
    app: podtato-head
spec:
  selector:
    matchLabels:
      component: podtato-head-hat
  template:
    metadata:
      labels:
        component: podtato-head-hat
    spec:
      terminationGracePeriodSeconds: 5
      containers:
        - name: server
          image:  ghcr.io/podtato-head/hat:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 9000
          env:
            - name: PODTATO_PORT
              value: "9000"
            - name: PODTATO_PART_NUMBER
              value: '01'
          resources:
            limits:
              memory: 100Mi
            requests:
              cpu: 20m
              memory: 50Mi
---
apiVersion: v1
kind: Service
metadata:
  name: podtato-head-hat
  labels:
    app: podtato-head
spec:
  selector:
    component: podtato-head-hat
  ports:
    - name: http
      port: 9001
      protocol: TCP
      targetPort: 9000
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: podtato-head-left-leg
  labels:
    app: podtato-head
spec:
  selector:
    matchLabels:
      component: podtato-head-left-leg
  template:
    metadata:
      labels:
        component: podtato-head-left-leg
    spec:
      terminationGracePeriodSeconds: 5
      containers:
        - name: server
          image:  ghcr.io/podtato-head/left-leg:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 9000
          env:
            - name: PODTATO_PORT
              value: "9000"
          resources:
            limits:
              memory: 100Mi
            requests:
              cpu: 20m
              memory: 50Mi
---
apiVersion: v1
kind: Service
metadata:
  name: podtato-head-left-leg
  labels:
    app: podtato-head
spec:
  selector:
    component: podtato-head-left-leg
  ports:
    - name: http
      port: 9002
      protocol: TCP
      targetPort: 9000
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: podtato-head-left-arm
  labels:
    app: podtato-head
spec:
  selector:
    matchLabels:
      component: podtato-head-left-arm
  template:
    metadata:
      labels:
        component: podtato-head-left-arm
    spec:
      terminationGracePeriodSeconds: 5
      containers:
        - name: server
          image:  ghcr.io/podtato-head/left-arm:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 9000
          env:
            - name: PODTATO_PORT
              value: "9000"
          resources:
            limits:
              memory: 100Mi
            requests:
              cpu: 20m
              memory: 50Mi
---
apiVersion: v1
kind: Service
metadata:
  name: podtato-head-left-arm
  labels:
    app: podtato-head
spec:
  selector:
    component: podtato-head-left-arm
  ports:
    - name: http
      port: 9003
      protocol: TCP
      targetPort: 9000
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: podtato-head-right-leg
  labels:
    app: podtato-head
spec:
  selector:
    matchLabels:
      component: podtato-head-right-leg
  template:
    metadata:
      labels:
        component: podtato-head-right-leg
    spec:
      terminationGracePeriodSeconds: 5
      containers:
        - name: server
          image:  ghcr.io/podtato-head/right-leg:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 9000
          env:
            - name: PODTATO_PORT
              value: "9000"
          resources:
            limits:
              memory: 100Mi
            requests:
              cpu: 20m
              memory: 50Mi
---
apiVersion: v1
kind: Service
metadata:
  name: podtato-head-right-leg
  labels:
    app: podtato-head
spec:
  selector:
    component: podtato-head-right-leg
  ports:
    - name: http
      port: 9004
      protocol: TCP
      targetPort: 9000
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: podtato-head-right-arm
  labels:
    app: podtato-head
spec:
  selector:
    matchLabels:
      component: podtato-head-right-arm
  template:
    metadata:
      labels:
        component: podtato-head-right-arm
    spec:
      terminationGracePeriodSeconds: 5
      containers:
        - name: server
          image:  ghcr.io/podtato-head/right-arm:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 9000
          env:
            - name: PODTATO_PORT
              value: "9000"
          resources:
            limits:
              memory: 100Mi
            requests:
              cpu: 20m
              memory: 50Mi
---
apiVersion: v1
kind: Service
metadata:
  name: podtato-head-right-arm
  labels:
    app: podtato-head
spec:
  selector:
    component: podtato-head-right-arm
  ports:
    - name: http
      port: 9005
      protocol: TCP
      targetPort: 9000
  type: ClusterIP
---
kind: Route
apiVersion: route.openshift.io/v1
metadata:
  name: potato-route
spec:
  host: project-<YOURPROJECTNAME>.apps.datalab.unicloud.at
  to:
    kind: Service
    name: podtato-head-entry
    weight: 100
  port:
    targetPort: http
  tls:
    termination: edge
    insecureEdgeTerminationPolicy: None
  wildcardPolicy: None
```