Sample Usage Scenario

This section drives you through a sample scenario that shows how to perform basic operations with XESModule for Docker running in a Kubernetes cluster, such as:

  • deploy and start XESModule for Docker,
  • apply patches on individual Docker images,
  • submit test HIPAA data to XESModule for Docker and get validation results,
  • replicate deployments,
  • view logs in real time, and so on.

Follow the steps below to perform these operations.

  1. Create a new service account:

    kubectl create serviceaccount edifecs-registry-reader

  2. If you are using the Edifecs Docker Registry, update the service account to include the image pull secret required to access the Edifecs Docker Registry:

    kubectl patch serviceaccount edifecs-registry-reader -p '{"imagePullSecrets": [{"name": "edifecs-registry-key"}]}'

    This command uses the secret edifecs-registry-key discussed in Docker Images Distribution (see Step 3 in the email).

    Note If you have a different Docker registry with authentication, you have to create the edifecs-registry-key Kubernetes secret with those credentials.

Use XEServer license

  1. Attach the XEServer license (.lic file) to your cluster:

    kubectl create secret generic xes-license --from-file=license.lic

Deploy the sample XEServer application

  1. Download and extract the sample XEServer application:

    wget https://help.edifecsfedcloud.com/XESModuleDocker/9.2.2/Content/xeserver-k8s-samples.tar.gz && tar -zxf xeserver-k8s-samples.tar.gz

    Where xeserver-k8s-samples.tar.gz contains kustomize.yml files, the test HIPAA data, and a sample XEServer profile to run in Kubernetes as an example. For more information, see sample XEServer application.

  2. Attach the sample XEServer profile to the cluster:

    kubectl create configmap repository --from-file=xeserver-k8s-samples/web-edi-server/xes_92_server_sample_restful_ws.zip

    Note If you want to use XEServer profiles from the Smart Trading Cloud Repository, you can edit the corresponding manifest file or use additional kustomization files to override the reference to the profile as shown below.

    Copy
    kustomization.yml
    env:
    - name: PROFILE_URL
      value: file:/opt/Edifecs/repository/xes_92_server_sample_restful_ws.zip

    The credentials to access the Smart Trading Cloud Repository must be mounted to the pod in xeserver-k8s-samples/web-edi-server/base/xes-sample.yml:

    Copy

    xes-sample.yml

    volumeMounts:
    - mountPath: /opt/Edifecs/XEServer/platform/etc/repository.conf
      name: repository-conf

    To get the Smart Trading Cloud Repository credentials, either contact Edifecs support or use the file XEServer/platform/etc/repository.conf that holds your Smart Trading account credentials. The file repository.conf is generated by Edifecs Application Manager after you connected to Smart Trading Cloud Repository.

  3. Apply the XEServer 9.2 sample manifest that installs the XEngine-XEServer 9.2 suite:

    kubectl apply -k xeserver-k8s-samples/web-edi-server/9.2

  4. Check the pod status. You should be able to view the newly created pod of your deployment:

    kubectl get pod
    ...
    xes-sample-7d698c9587-5jlms      0/1      Init: 0/4     0      3s

    This indicates that the pod is getting initialized. Wait until the deployment is complete:

    kubectl wait --for=condition=available deployment xes-sample

Submit test data

  1. Send a test request with a sample HIPAA file 5010_270_x279_A1.dat:

    export XES_SVC_IP='kubectl get -o jsonpath="{.spec.clusterIP}" services xes-sample-svc';
    curl -X POST -v --data-binary @xeserver-k8s-samples/web-edi-server/5010_270_x279_A1.dat -k -H "Content-Type: text/plain" -o _result.zip "http://$XES_SVC_IP:8080/rest"

    The request produces a file _result.zip that contains validation results (XML/HTML Audit and LDNS reports, XData, Acks).

Patch XEngine

  1. You can patch your deployment by applying the newer version of XEngine (for example a hotfix) without interrupting your XEServer-based application. The XEngine hotfix image can be deployed from GCR as shown below:

    kubectl set image deployment/xes-sample \
    xe=us.gcr.io/edifecs/xe:9.2.x.x --record

  2. Check the pod status:

    kubectl get pod

    You can observe that a new deployment has started while the old deployment is still serving traffic:

    NAME READY STATUS RESTARTS AGE
    xes-sample-5df4bc679d-mv59v 1/1 Running 0 3h17m
    xes-sample-789d746c7d-q72qh 0/1 Init:0/4 0 2s
  3. Check the details of the new deployment (highlighted), such as the image used:

    kubectl describe pod |grep -E "Image:.*edifecs/xe:";
    ...
    Image: us.gcr.io/edifecs/xe:9.2.x.x
    Image: us.gcr.io/edifecs/xe:9.2

    Once the new deployment passes its pod's health checks, the old deployment is terminated and removed by Kubernetes:

    kubectl describe pod |grep -E "Image:.*edifecs/xe:";
    ...
    Image: us.gcr.io/edifecs/xe:9.2.x.x

Scale the solution

  1. To scale the sample solution, set three replicas, for example:

    kubectl scale deployment/xes-sample --replicas=3

    Observe two more replicas created:

    NAME READY STATUS RESTARTS AGE
    xes-sample-5df4bc679d-qppw6 1/1 Running 0 5h
    xes-sample-5df4bc679d-2q4g7 0/1 Init:0/4 0 1s
    xes-sample-5df4bc679d-gb675 0/1 Init:0/4 0 1s

Submit test data

  1. Start a loop to continuously send requests with HIPAA data to the cluster:

    export XES_SVC_IP='kubectl get -o jsonpath="{.spec.clusterIP}" services xes-sample-svc';
    while true;
    do curl -X POST -v --data-binary @xeserver-k8s-samples/web-edi-server/5010_270_x279_A1.dat -k -H "Content-Type: text/plain" -o _result.zip "http://$XES_SVC_IP:8080/rest";
    done

  2. Open separate terminals (one for each pod or at least two of them) and check the continuously generated logs:

    kubectl get pod

    NAME READY STATUS RESTARTS AGE
    xes-sample-<suffix1>-<suffix2> 1/1 Running 0 3m

    kubectl logs -f xes-sample-<suffix1>-<suffix2>

    You should be able to view the continuously generated XEServer logs in each pod in the corresponding terminal:

    xes.system.log 2020-10-10 | 17:44:41,282 | INFO | l Service/Native Processing Task: E110F2F2-9E75-44D3-A34C-5A6998D570D3 | XE task [E110F2F2-9E75-44D3-A34C-5A6998D570D3]: Severity file /opt/Edifecs/XEngine/config/SeverityConfig.xml is applied on DataNode(Group, {C3C853F7-C986-44F7-B4BA-14FF1DB4C8AC})

    Once you stop the data submission, the log generation stops in each terminal.

Patch XEServer/XEngine

  1. To install new XEServer/XEngine patches, apply the XEServer 9.2.3 sample manifest that installs XEngine/XEServer 9.2.3, a newer HIPAA (9.2.14), ECL (9.2.17), all without interrupting the processing:

    kubectl apply -k xeserver-k8s-samples/web-edi-server/9.2.3

Cleanup

  1. To perform a cleanup, run the following command:

    kubectl delete -f xeserver-k8s-samples/web-edi-server/base/xes-sample.yml