kind: Template apiVersion: v1 metadata: name: startx-mongo-build-template annotations: openshift.io/display-name: Startx MongoDB Server (ephemeral build & deploy workflow) description: Build and deployement workflow of a MongoDB NoSQL database using ephemeral storage for logs records. Use mongo with various underlying linux distribution. See https://hub.docker.com/r/startx/sv-mongo iconClass: icon-mongodb tags: startx,os,fedora,mongo,database openshift.io/provider-display-name: STARTX openshift.io/documentation-url: https://hub.docker.com/r/startx/sv-mongo openshift.io/support-url: https://gitlab.com/startx1/containers/issues/new message: |- Your database ${APP_NAME} is building and will be soon deployed. Monitor the deployement for application availability Source : ${SOURCE_BRANCH}@${SOURCE_GIT} Database : ${APP_NAME} Stage : ${APP_STAGE} Builder : ${BUILDER_TAG} Volumes : ${APP_NAME}-log (E), ${APP_NAME}-data (E) Username : ${MONGO_USER} Password : ${MONGO_PASSWORD} Store : ${MONGO_STORES} Connection : mongodb://${APP_NAME}:27017 labels: template: startx-mongo-build-template provider: startx objects: - kind: ImageStream apiVersion: v1 metadata: name: startx-mongo annotations: openshift.io/display-name: Startx MongoDB Database openshift.io/generated-by: STARTX labels: app: "${APP_NAME}" stage: "${APP_STAGE}" spec: tags: - name: fc26 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Fedora 26) description: MongoDB server for simple SQL database running under Fedora 26 iconClass: icon-mongodb tags: builder,startx,fedora,mongo,database supports: mongodb version: fc26 sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:fc26 - name: fc27 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Fedora 27) description: MongoDB server for simple SQL database running under Fedora 27 iconClass: icon-mongodb tags: builder,startx,fedora,mongo,database supports: mongodb version: fc27 sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:fc27 - name: fc28 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Fedora 28) description: MongoDB server for simple SQL database running under Fedora 28 iconClass: icon-mongodb tags: builder,startx,fedora,mongo,database supports: mongodb version: fc28 sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:fc28 - name: fc29 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Fedora 29) description: MongoDB server for simple SQL database running under Fedora 29 iconClass: icon-mongodb tags: builder,startx,fedora,mongo,database supports: mongodb version: fc29 sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:fc29 - name: fc30 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Fedora 30) description: MongoDB server for simple SQL database running under Fedora 30 iconClass: icon-mongodb tags: builder,startx,fedora,mongo,database supports: mongodb version: fc30 sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:fc30 - name: fc31 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Fedora 31) description: MongoDB server for simple SQL database running under Fedora 31 iconClass: icon-mongodb tags: builder,startx,fedora,mongo,database supports: mongodb version: fc31 sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:fc31 - name: fc32 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Fedora 32) description: MongoDB server builder for NoSQL database running under Fedora 32 iconClass: icon-mongodb tags: builder,startx,fedora,mongo,database supports: mongodb version: fc32 sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:fc32 - name: fc33 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Fedora 33) description: MongoDB server builder for NoSQL database running under Fedora 33 iconClass: icon-mongodb tags: builder,startx,fedora,mongo,database supports: mongodb version: fc33 sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:fc33 - name: fc34 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Fedora 34) description: MongoDB server builder for NoSQL database running under Fedora 34 iconClass: icon-mongodb tags: builder,startx,fedora,mongo,database supports: mongodb version: fc34 sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:fc34 - name: rawhide annotations: openshift.io/display-name: S2I Startx MongoDB Database (Fedora rawhide) description: MongoDB server for simple SQL database running under Fedora rawhide iconClass: icon-mongodb tags: builder,startx,fedora,mongo,database supports: mongodb version: rawhide sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:latest - name: ubi8 annotations: openshift.io/display-name: S2I Startx MongoDB Database (RedHat UBI 8) description: MongoDB server builder for NoSQL database running under RedHat UBI 8 iconClass: icon-mongodb tags: builder,startx,ubi,mongo,database supports: mongodb version: "8" sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:ubi8 - name: alma8 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Alma 8) description: MongoDB server builder for NoSQL database running under Alma 8 iconClass: icon-mongodb tags: builder,startx,alma,mongo,database supports: mongodb version: "8" sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:alma8 - name: rocky8 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Rocky 8) description: MongoDB server builder for NoSQL database running under Rocky 8 iconClass: icon-mongodb tags: builder,startx,rocky,mongo,database supports: mongodb version: "8" sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:rocky8 - name: centos8 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Centos 8) description: MongoDB server builder for NoSQL database running under Centos 8 iconClass: icon-mongodb tags: builder,startx,centos,mongo,database supports: mongodb version: "8" sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:centos8 - name: centos7 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Centos 7) description: MongoDB server for simple SQL database running under Centos 7 iconClass: icon-mongodb tags: builder,startx,centos,mongo,database supports: mongodb version: "7" sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:centos7 - name: centos6 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Centos 6) description: MongoDB server for simple SQL database running under Centos 6 iconClass: icon-mongodb tags: builder,startx,centos,mongo,database supports: mongodb version: "6" sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:centos6 - name: alpine3 annotations: openshift.io/display-name: S2I Startx MongoDB Database (Alpine 3) description: MongoDB server for simple SQL database running under Alpine 3 iconClass: icon-mongodb tags: builder,startx,alpine,mongo,database supports: mongodb version: "3" sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: DockerImage name: startx/sv-mongo:alpine3 - name: latest annotations: openshift.io/display-name: S2I Startx MongoDB Database (latest) description: MongoDB server for simple SQL database running under Fedora latest iconClass: icon-mongodb tags: builder,startx,alpine,mongo,database supports: mongodb sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: ImageStreamTag name: rawhide - name: dev annotations: openshift.io/display-name: S2I Startx MongoDB Database (dev) description: MariaDB server builder for simple SQL database (developpement) iconClass: icon-mongodb tags: builder,startx,alpine,mongo,database supports: mongodb version: "dev" sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: ImageStreamTag name: rawhide - name: test annotations: openshift.io/display-name: S2I Startx MongoDB Database (test) description: MariaDB server builder for simple SQL database (testing) iconClass: icon-mongodb tags: builder,startx,alpine,mongo,database supports: mongodb version: "test" sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: ImageStreamTag name: centos8 - name: preprod annotations: openshift.io/display-name: S2I Startx MongoDB Database (preprod) description: MariaDB server builder for simple SQL database (pre-production) iconClass: icon-mongodb tags: builder,startx,alpine,mongo,database supports: mongodb version: "pre-prod" sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: ImageStreamTag name: alpine3 - name: prod annotations: openshift.io/display-name: S2I Startx MongoDB Database (prod) description: MariaDB server builder for simple SQL database (production) iconClass: icon-mongodb tags: builder,startx,alpine,mongo,database supports: mongodb version: "prod" sampleRepo: https://gitlab.com/startx1/containers-example-mongo.git from: kind: ImageStreamTag name: alpine3 - kind: ImageStream apiVersion: v1 metadata: name: "${APP_NAME}" annotations: openshift.io/display-name: Database ${APP_NAME} openshift.io/generated-by: STARTX labels: app: "${APP_NAME}" stage: "${APP_STAGE}" spec: tags: - name: latest annotations: openshift.io/display-name: Database ${APP_NAME} description: Base image for the database ${APP_NAME} iconClass: icon-mongodb tags: startx,fedora,mongo,database,${APP_NAME} supports: mongodb version: latest - kind: ConfigMap apiVersion: v1 metadata: name: "${APP_NAME}-config" annotations: openshift.io/display-name: Database ${APP_NAME} configuration openshift.io/generated-by: STARTX labels: app: "${APP_NAME}" stage: "${APP_STAGE}" data: SX_ID: ${APP_NAME}/${APP_STAGE} SX_TYPE: ${APP_STAGE} SX_SERVICE: ${APP_NAME} SX_NAME: SQL database ${APP_NAME} SX_SUMMARY: SQL database ${APP_NAME} based on ${BUILDER_TAG} container SX_VERSION: 0.0.1 MONGO_STORES: "${MONGO_STORES}" - kind: Secret apiVersion: v1 metadata: name: "${APP_NAME}-auth" labels: app: "${APP_NAME}" stage: "${APP_STAGE}" annotations: template.openshift.io/expose-username: "{.data['MONGO_USER']}" template.openshift.io/expose-password: "{.data['MONGO_PASSWORD']}" template.openshift.io/expose-root_password: "{.data['MONGO_PASSWORD']}" stringData: MONGO_ROOT_PASSWORD: "${MONGO_ROOT_PASSWORD}" MONGO_USER: "${MONGO_USER}" MONGO_PASSWORD: "${MONGO_PASSWORD}" - kind: BuildConfig apiVersion: v1 metadata: name: "${APP_NAME}" labels: app: "${APP_NAME}" stage: "${APP_STAGE}" annotations: openshift.io/generated-by: STARTX spec: triggers: - type: GitHub github: secret: "${WEBHOOK_TOKEN}_${APP_NAME}" - type: Generic generic: secret: "${WEBHOOK_TOKEN}_${APP_NAME}" - type: ImageChange imageChange: {} - type: ConfigChange runPolicy: SerialLatestOnly source: type: Git git: uri: "${SOURCE_GIT}" ref: "${SOURCE_BRANCH}" strategy: type: Source sourceStrategy: from: kind: ImageStreamTag name: startx-mongo:${BUILDER_TAG} env: - name: SX_VERBOSE value: "true" - name: SX_DEBUG value: "true" - name: MONGO_ROOT_PASSWORD valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_ROOT_PASSWORD - name: MONGO_USER valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_USER - name: MONGO_PASSWORD valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_PASSWORD envFrom: - configMapRef: name: ${APP_NAME}-config output: to: kind: ImageStreamTag name: "${APP_NAME}:latest" postCommit: command: - "/bin/sx-mongo" - post-build env: - name: SX_VERBOSE value: "true" - name: SX_DEBUG value: "true" - name: MONGO_ROOT_PASSWORD valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_ROOT_PASSWORD - name: MONGO_USER valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_USER - name: MONGO_PASSWORD valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_PASSWORD envFrom: - configMapRef: name: ${APP_NAME}-config - kind: DeploymentConfig apiVersion: v1 metadata: name: "${APP_NAME}" labels: app: "${APP_NAME}" stage: "${APP_STAGE}" annotations: openshift.io/generated-by: STARTX spec: strategy: type: Recreate recreateParams: timeoutSeconds: 60 pre: failurePolicy: Abort execNewPod: containerName: "${APP_NAME}" command: - "/bin/sx-mongo" - pre-deploy env: - name: SX_VERBOSE value: "true" - name: SX_DEBUG value: "true" - name: MONGO_USER valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_USER - name: MONGO_PASSWORD valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_PASSWORD envFrom: - configMapRef: name: ${APP_NAME}-config post: failurePolicy: Abort execNewPod: containerName: "${APP_NAME}" command: - "/bin/sx-mongo" - post-deploy env: - name: SX_VERBOSE value: "true" - name: SX_DEBUG value: "true" - name: MONGO_USER valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_USER - name: MONGO_PASSWORD valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_PASSWORD envFrom: - configMapRef: name: ${APP_NAME}-config triggers: - type: ImageChange imageChangeParams: automatic: true containerNames: - "${APP_NAME}" from: kind: ImageStreamTag name: "${APP_NAME}:latest" - type: ConfigChange postCommit: script: "/bin/sx-mongo info" replicas: 1 test: false selector: app: "${APP_NAME}" deploymentconfig: "${APP_NAME}" template: metadata: labels: app: "${APP_NAME}" deploymentconfig: "${APP_NAME}" annotations: openshift.io/generated-by: STARTX spec: containers: - name: "${APP_NAME}" image: " " env: - name: SX_VERBOSE value: "true" - name: SX_DEBUG value: "true" - name: MONGO_USER valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_USER - name: MONGO_PASSWORD valueFrom: secretKeyRef: name: "${APP_NAME}-auth" key: MONGO_PASSWORD envFrom: - configMapRef: name: ${APP_NAME}-config command: - "/bin/sx-mongo" args: - run ports: - containerPort: 27017 protocol: TCP resources: limits: cpu: 8000m memory: "${MEMORY_LIMIT}" requests: cpu: 200m memory: "${MEMORY_LIMIT}" livenessProbe: exec: command: - "/bin/sx-mongo" - isLive initialDelaySeconds: 5 timeoutSeconds: 2 periodSeconds: 10 successThreshold: 1 failureThreshold: 3 readinessProbe: exec: command: - "/bin/sx-mongo" - isReady initialDelaySeconds: 5 timeoutSeconds: 2 periodSeconds: 10 successThreshold: 1 failureThreshold: 3 terminationMessagePath: "/dev/termination-log" imagePullPolicy: Always volumeMounts: - name: "${APP_NAME}-log" mountPath: "/var/log/mongodb" - name: "${APP_NAME}-data" mountPath: "/data" volumes: - name: "${APP_NAME}-log" emptyDir: medium: "" - name: "${APP_NAME}-data" emptyDir: medium: "" restartPolicy: Always terminationGracePeriodSeconds: 30 securityContext: {} dnsPolicy: ClusterFirst - kind: Service apiVersion: v1 metadata: name: "${APP_NAME}" labels: app: "${APP_NAME}" stage: "${APP_STAGE}" annotations: openshift.io/generated-by: STARTX spec: ports: - protocol: TCP port: 27017 targetPort: 27017 selector: app: "${APP_NAME}" deploymentconfig: "${APP_NAME}" type: ClusterIP sessionAffinity: None parameters: - name: APP_NAME displayName: Database name description: The name of the created database value: mongo required: true - name: APP_STAGE displayName: Database stage description: "Stage of the database deployed (ex: dev, test, prod, example, demo, poc, ...)" value: example required: true - name: BUILDER_TAG displayName: Builder image stage description: "Image tag of the startx mongo builder image used. Could be : latest, dev, test, preprod, prod - rawhide, fc31, fc30, fc29, fc28 - alpine3 - ubi8 - centos8, centos7, centos6, alma8, rocky8)" value: latest required: true - name: SOURCE_GIT displayName: Source repository description: URL to the source code to use during build process value: https://gitlab.com/startx1/containers-example-mongo.git required: true - name: SOURCE_BRANCH displayName: Source branch description: Name of the default branch value: master required: true - name: WEBHOOK_TOKEN displayName: Webhook token description: Secret token to use for webhook to github or generic generate: expression from: "[a-zA-Z0-9]{24}" required: true - name: MONGO_ROOT_PASSWORD displayName: Mongodb root password description: The mongodb root password to use. Generated if not provided from: "[A-Z0-9]{16}" generate: expression - name: MONGO_USER displayName: Mongodb user description: Default user to create value: demo from: "[A-Z0-9]{8}" generate: expression - name: MONGO_PASSWORD displayName: Mongodb password description: Password of the default user value: demo from: "[A-Z0-9]{16}" generate: expression - name: MONGO_STORES displayName: MongoDB store description: list of the default's store to create value: example - name: MEMORY_LIMIT displayName: Memory Limit description: Maximum amount of memory the container can use. e.g. 512Mi, 2Gi. value: 1024Mi required: true