Running an SXAPI application using the sxapi operator

Install the SXApi operator

Install the SXApi operator into an openshift cluster using the following command

oc apply -f https://raw.githubusercontent.com/startxfr/sxapi-operator/main/load-catalog.yaml

For more information on how to use this operator, see sxapi operator repository

Run your sxapi instance

After installing the sxapi operator, you can run an sxapi application with the following application definition

apiVersion: sxapi.startx.fr/v1alpha1
kind: SXApi
metadata:
  name: sxapi-sample
spec:
  context:
    app: default-sxapi
    cluster: localhost
    component: sxapi
    environment: myenv
    scope: myscope
    version: "0.0.5"
  sxapi:
    data: |
      sxapi.yml: |-
        name: default
        description: Description of the default sxapi instance (defined in sxapi operator)
        version: "0.3.59"
        debug: false
        resources:
          serviceinfo-sample:
            _class: serviceinfo
        log:
          filters:
            level: '0,1,2,3,4'
            type: debug,info,error,warn
        server:
          port: '8077'
          endpoints:
          - path: "/"
            body: |-
                <html>
                <head><title>Example application (operator default values)</title></head>
                <body>
                  <h1>SXAPI is live ! (operator's managed)</h1>
                  <p>
                    This example is deployed using the sxapi operator example based on the 
                    <a href="https://helm-repository.readthedocs.io/en/latest/charts/sxapi.html" target="_blank">sxapi chart</a>
                    available in the <a href="https://helm-repository.readthedocs.io" target="_blank">startx helm repository</a>. 
                  </p>
                  <p>
                    You could check the following endpoints :</p>
                  <ul>
                    <li><a href="./health">Health status (used by readiness probe)</a></li>
                    <li><a href="./info">Information about the application</a></li>
                  </ul>
                </body>
                </html>
          - path: "/health"
            resource: serviceinfo-sample
            endpoint: health
          - path: "/info"
            resource: serviceinfo-sample
            endpoint: info
    debug: true
    expose:
      enabled: true
    profile: prod:start
    replicas: 2

You can instanciate this application with the fllowing command

vi sxapi-apps.yaml
# copy and paste the content of the previous yaml content
oc apply -f sxapi-apps.yaml