# Creating a Deployment and Service

## Prerequisites

If you are logged in as a cluster administrator, log out and log back in as a regular user.

## Procedure

1. Edit the `tibemsd-template.yaml` template and override the default parameters as needed.
2. Create a deployment and service with an EMS server using the modified template.

## Example

For example,

    > oc login -u <user>
    > oc process -f tibemsd-template.yaml -p EMS_SERVICE_NAME=emsdev01 \
         -p EMS_PUBLIC_PORT="7779" -p EMS_PVC="claim-nfs-ems-project"  \
      | oc create -f -

The `oc process` operation transforms the `tibemsd-template.yaml` template into a list of resources using the default and overridden parameter values. That list is then passed on to `oc create` for creation. In the above example, a deployment, a ReplicaSet, a pod, and a service are created. All four objects can be selected using the `emsdev01` label.

The service exposes itself as `emsdev01` inside the cluster and maps the internal port `7222` to port `7779` inside and outside the cluster. The PVC `claim-nfs-ems-project` is used to mount the NFS shared folders. Default values of other parameters are used to pull the EMS Docker image from the Docker registry and to set the `uid` of the container.

You can verify the results using the following commands:

    > oc get --selector name=emsdev01 all
    > oc describe deploy/emsdev01
    > oc describe svc/emsdev01

or in the OpenShift Web Console.

To deploy additional EMS servers

    > oc process -f tibemsd-template.yaml -p EMS_SERVICE_NAME=emsdev02  \
         -p EMS_PUBLIC_PORT="7780" -p EMS_PVC="claim-nfs-ems-project"   \
      | oc create -f -
    > oc process -f tibemsd-template.yaml -p EMS_SERVICE_NAME=emsdev03  \
         -p EMS_PUBLIC_PORT="7781" -p EMS_PVC="claim-nfs-ems-project"   \
      | oc create -f -

Copyright © Cloud Software Group, Inc. All rights reserved.