Migration from docker-compose installation to Kubernetes

How to migrate from docker-compose installation to Kubernetes

This manual will help you with the migration of your installation type via docker-compose to the installation type using Kubernetes.

How to deploy Allure TestOps using docker-compose

General description on how to deploy using docker-compose

How to deploy Allure TestOps using kubernetes

General description on how to deploy using Kubernetes

Inputs

Allure TestOps is a set of microservices

  1. Allure TestOps gateway
    1. Uses Redis
  2. Allure TestOps uaa
    1. Uses Postgres DB for uaa
  3. Allure TestOps report
    1. Uses Postgres DB for report
    2. Uses S3 Storage
    3. Uses RabbitMQ

Prerequisites for the migration

Before you move Allure TestOps from docker-compose deployment type to kubernetes please make sure you are using external Postgres DB and S3 as storage.

External DB means it must be running outside a container, i.e. must not be started under docker-compose.

Environment variables

To integrate Allure TestOps with external Postgres DB and S3 you need to set up the environment variables in the configuration file as follows

S3

ALLURE_BLOBSTORAGE_TYPE: S3
ALLURE_BLOBSTORAGE_S3_ENDPOINT: s3.amazonaws.com
ALLURE_BLOBSTORAGE_S3_BUCKET: <bucket>
ALLURE_BLOBSTORAGE_S3_REGION: <region>
ALLURE_BLOBSTORAGE_S3_ACCESSKEY: <access key>
ALLURE_BLOBSTORAGE_S3_SECRETKEY: <secret key>

Postgres DB

# database
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/<database>
SPRING_DATASOURCE_USERNAME: <username>
SPRING_DATASOURCE_PASSWORD: <password>

Transfer of the environment variables from docker-compose to k8s

All the data you need to transfer reside in .env file in the same directory as docker-compose.yaml

Here are the data from our example .env file

VERSION=<3.175.0>
LICENSE=<your license string>

# security
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin

JWT_SECRET=secret-text
REGISTRATION_AUTOAPPROVE=true

# gateway
GATEWAY_REDIS_HOST=redis
GATEWAY_REDIS_PORT=6379

# uaa database
UAA_POSTGRES_URL=jdbc:postgresql://uaa-db:5432/uaa?assumeMinServerVersion=12&ApplicationName=allure_uaa_service
UAA_POSTGRES_USERNAME=uaa
UAA_POSTGRES_PASSWORD=[email protected]

# report database
REPORT_POSTGRES_URL=jdbc:postgresql://report-db:5432/report?assumeMinServerVersion=12&ApplicationName=allure_report_service
REPORT_POSTGRES_USERNAME=report
REPORT_POSTGRES_PASSWORD=[email protected]

To transfer the environment data from docker-compose settings to k8s you need to create a file values.yaml and add the following data:

version: ${VERSION}

licenseKey: ${LICENSE}
jwtSecret: <random string>
imagePullSecret: allure-server-docker

username: ${ADMIN_USERNAME}
password: ${ADMIN_PASSWORD}

postgresql:
  enabled: false

ingress:
  host: <host>
  tls:
    - hosts:
        - <host>
      secretName: <secret-name>

uaa:
  env:
    open:
      # database
      SPRING_DATASOURCE_URL: ${UAA_POSTGRES_URL}
    secret:
      SPRING_DATASOURCE_USERNAME: ${UAA_POSTGRES_USERNAME}
      SPRING_DATASOURCE_PASSWORD: ${UAA_POSTGRES_PASSWORD}

report:
  replicaCount: 3
  persistence: 
    enabled: false
  env:
    open:
      # database
      SPRING_DATASOURCE_URL: ${REPORT_POSTGRES_URL}
      # storage
      ALLURE_BLOBSTORAGE_TYPE: S3
      ALLURE_BLOBSTORAGE_S3_ENDPOINT: s3.amazonaws.com
      ALLURE_BLOBSTORAGE_S3_BUCKET: ${REPORT_S3_BUCKET}
      ALLURE_BLOBSTORAGE_S3_REGION: ${REPORT_S3_REGION}
    secret:
      ALLURE_BLOBSTORAGE_S3_ACCESSKEY: ${REPORT_S3_ACCESSKEY}
      ALLURE_BLOBSTORAGE_S3_SECRETKEY: ${REPORT_S3_SECRETKEY}
      SPRING_DATASOURCE_USERNAME: ${REPORT_POSTGRES_USERNAME}
      SPRING_DATASOURCE_PASSWORD: ${REPORT_POSTGRES_PASSWORD}

Deployment in Kubernetes

Next steps are described here: https://docs.qameta.io/allure-testops/getstarted/kubernetes/

Input data for the helm installation will be the values.yaml file you created in the previous step.

Helm will deploy 3 services related directly to Allure TestOps (allure-ee-gateway, allure-ee-uaa, allure-ee-report) and 2 supporting services (redis and rabbitmq)