Дерево страниц
Перейти к концу метаданных
Переход к началу метаданных

Представленный шаблон позволяет развернуть сервис eltex-wids в кластере OpenShift.

Подготовка к установке:

  • должен быть развёрнут и запущен кластер OpenShift версии не ниже 3.11
  • должен быть доступ по ssh к ноде кластера с ролью master

Порядок установки:

  • в случае использования Atomic Registry предварительно настроить соответствующий ImageStream
  • сохранить приложенный шаблон в файл eltex-wids-template.yaml на ноде кластера с ролью master
  • применить шаблон командой 

    oc apply -f eltex-wids-template.yaml
  • находясь в Application Console, развернуть приложение из шаблона, указав следующие параметры:
    • Name of service - имя приложения в Openshift
    • Image name - имя docker-образа или путь к нему
    • Database connection string - адрес сервера mongodb в формате mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[database][?options]]
    • Database schema - схема, по умолчанию wids

  • проверить работу сервиса в соответствии с его документацией


template-eltex-wids.yaml
kind: Template
apiVersion: v1
metadata:
  name: eltex-wids-template
  annotations:
    description: "Eltex-wids application template"
    openshift.io/display-name: "The Eltex WIDS"
    openshift.io/provider-display-name: "Eltex"
    iconClass: "icon-go-gopher"
objects:
  - apiVersion: v1
    kind: ConfigMap
    metadata:
      name: ${INSTANCE_NAME}-config
    data:
      config.hocon: |
        server = {
          ServicePort = 9095
          Environment = "k8s"  // logs writes into stdout
          SleepDaemonQueueTime = 5 // time for sleep (unit: milliseconds)
          FoulTime = 60 // time of raw event, they disappear (unit: seconds)
        }
        logs = {
          LogLevel = "error" 
          FileLog = "/var/log/eltex-wids/eltex-wids.log" // name of log file
          MaxSize = 5 // maximal size of log file (unit: megabyte)
          MaxAge = 30 // maximum log lifetime (unit: days)
          MaxBackups = 10 // maximum number of backups (unit: amount of log files)
          Compress = true // the need of compression
          GelfEnabled = false // inclusion of sending logs to graylog
          GelfHostWithPort = "lab3-test.eltex.loc:12201" // address of graylog server
        }
        db = {
          Database = "${DB_SCHEMA}" // database name
          MongoConnectionString = "${DB_URL}" // database connection string
        }
  - apiVersion: apps.openshift.io/v1
    kind: DeploymentConfig
    metadata:
      labels:
        app: ${INSTANCE_NAME}
      name: ${INSTANCE_NAME}
    spec:
      replicas: 1
      selector:
        app: ${INSTANCE_NAME}
      strategy:
        type: Rolling
      template:
        metadata:
          labels:
            app: ${INSTANCE_NAME}
        spec:
          containers:
            - name: ${INSTANCE_NAME}-container
              image: ${IMAGE_NAME}
              imagePullPolicy: Always
              livenessProbe:
                httpGet:
                  path: /getVersion
                  port: 9095
                  scheme: HTTP
                initialDelaySeconds: 30
              readinessProbe:
                httpGet:
                  path: /mac/names
                  port: 9095
                  scheme: HTTP
                initialDelaySeconds: 30
              volumeMounts:
                - mountPath: /etc/eltex-wids-service
                  name: config-volume
          volumes:
            - configMap:
                name: ${INSTANCE_NAME}-config
              name: config-volume
      triggers:
        - type: ConfigChange
  - apiVersion: v1
    kind: Service
    metadata:
      name: ${INSTANCE_NAME}-service
    spec:
      ports:
        - port: 9095
          protocol: TCP
      selector:
        app: ${INSTANCE_NAME}
  - apiVersion: v1
    kind: Route
    metadata:
      name: ${INSTANCE_NAME}-route
    spec:
      to:
        kind: Service
        name: ${INSTANCE_NAME}-service
parameters:
  - name: INSTANCE_NAME
    displayName: Name of service
    description: Name of service in openshift
    required: true
    value: eltex-wids
  - name: IMAGE_NAME
    displayName: Image name
    description: Image name or pull spec
    required: true
    value: hub.eltex-co.ru/softwlc/eltex-wids:latest
  - name: DB_URL
    displayName: Database connection string
    description: Database for eltex-wids
    required: true
    value: mongodb://eltex:eltex@mongodb.softwlc.svc:27017/wids
  - name: DB_SCHEMA
    displayName: Database schema
    description: Database schema
    required: true
    value: wids
message: "... The Eltex WIDS with name ${INSTANCE_NAME} is starting ..." 


  • Нет меток