Installation

Install Pulzen Gateway in your environment

To install Pulzen Gateway in your environment, follow these steps:

Requeriments

  • Docker
  • Mongo DB

Docker specifications

  • Operating System: Linux
  • Memory: 2 GB
  • Cpu: 2

Step 1: Docker Run

Run the following command

docker run -d -p 8080:8080 --name pulzen-gateway-api pulzen/gateway:latest

Install on Azure as Azure Web App

To install Pulzen Gateway in your Azure environment, follow these steps:

Requeriments

  • Azure Account
  • Azure Web App
  • MongoDB Atlas Database instance

Web App specifications:

  • Operating System: Linux
  • Region: East US
  • SKU: Premium V2
  • Size: Small
  • ACU: 210 total ACU
  • Memory: 3.5 GB memory

Step 1: Create a new Web App

  1. Go to the Azure Portal.
  2. Click on the "Create a resource" button.
  3. Search for "Web App" and click on "Create".
  4. Fill in the required information and click on "Create".

Step 2: Configure the Web App

  1. Go to the "Configuration" section of the Web App.

Step 3: Deploy the Pulzen Gateway

  1. Go to the "Deployment Center" section of the Web App.
  2. Select the "Docker hub" option.
  3. Fill image with pulzen/gateway.

Step 4: Configure the environment variables

  1. Go to the "Configuration" section of the Web App.
  2. Add the following environment variables:
    • AUTH_BASIC_USERNAME: admin
    • AUTH_BASIC_PASSWORD: admin
    • MONGODB: mongodb+srv://username:password@cluster/database
    • PROFILES_DEFAULT: bitbucket
    • LICENSE_API_APP_KEY: LICENSE_API_APP_KEY
    • LICENSE_API_URL: https://performance-license.ndrz.io/
  3. Add the variables depending on your VCS system (GitHub, Bitbucket, GitLab, Azure DevOps). Quick start

Install on K8s

To install Performance in your Kubernetes environment, follow these steps:

Requeriments

  • Kubernetes Cluster
  • MongoDB Atlas Database instance

Step 1: Deploy the Pulzen Gateway

  1. Create a new deployment with the following configuration:
apiVersion: v1
kind: Secret
metadata:
  name: performance-api-secrets
  namespace: default
type: Opaque
data:
  DOCKER_REGISTRY_SERVER_PASSWORD: secret-in-base64-?????
  AUTH_BASIC_PASSWORD: secret-in-base64-?????
  MONGODB: secret-in-base64-?????
  LICENSE_API_APP_KEY: secret-in-base64-?????
  BITBUCKET_CLIENT_ID: secret-in-base64-?????
  BITBUCKET_CLIENT_SECRET: secret-in-base64-?????
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: performance-api-config
  namespace: default
data:
  AUTH_BASIC_USERNAME: "admin"
  DOCKER_REGISTRY_SERVER_URL: "https://hub.docker.com"
  DOCKER_REGISTRY_SERVER_USERNAME: "myusername"
  WORKSPACE: "my-super-workspace"
  PROFILES_DEFAULT: "bitbucket"
  WEBSITES_ENABLE_APP_SERVICE_STORAGE: "false"
  LICENSE_API_URL: "https://performance-license.ndrz.io/"
  BITBUCKET_RETRY_LOAD: "4"
  BITBUCKET_MINUTES_LOAD: "10"
  BITBUCKET_RETRY_ERROR: "3"
  BITBUCKET_MINUTES_ERROR: "5"
  BITBUCKET_RETRY_MANY_REQUESTS: "3"
  BITBUCKET_SECONDS_MANY_REQUESTS: "60"
  BITBUCKET_SCHEDULED_TEAMS_CRON: "0 0 0 * * *"
  BITBUCKET_SCHEDULED_TOKEN_REFRESH: "2400000"
  BITBUCKET_SCHEDULED_CLIENT_REFRESH: "1200000"
  BITBUCKET_RETRY_TOKEN_REFRESH: "8"
  BITBUCKET_MINUTES_TOKEN_REFRESH: "6"
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: performance-reporter-api-deploy
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: performance-reporter-api
  template:
      labels:
        app: performance-reporter-api
    spec:
      containers:
        - name: performance-reporter-api
          image: myregistry.azurecr.io/pulzen/gateway:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
          env:
            - name: DOCKER_REGISTRY_SERVER_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: performance-api-secrets
                  key: DOCKER_REGISTRY_SERVER_PASSWORD
            - name: AUTH_BASIC_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: performance-api-secrets
                  key: AUTH_BASIC_PASSWORD
            - name: MONGODB
              valueFrom:
                secretKeyRef:
                  name: performance-api-secrets
                  key: MONGODB
            - name: LICENSE_API_APP_KEY
              valueFrom:
                secretKeyRef:
                  name: performance-api-secrets
                  key: LICENSE_API_APP_KEY
            - name: BITBUCKET_CLIENT_ID
              valueFrom:
                secretKeyRef:
                  name: performance-api-secrets
                  key: BITBUCKET_CLIENT_ID
            - name: BITBUCKET_CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  name: performance-api-secrets
                  key: BITBUCKET_CLIENT_SECRET
            - name: AUTH_BASIC_USERNAME
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: AUTH_BASIC_USERNAME
            - name: DOCKER_REGISTRY_SERVER_URL
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: DOCKER_REGISTRY_SERVER_URL
            - name: DOCKER_REGISTRY_SERVER_USERNAME
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: DOCKER_REGISTRY_SERVER_USERNAME
            - name: WORKSPACE
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: WORKSPACE
            - name: PROFILES_DEFAULT
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: PROFILES_DEFAULT
            - name: WEBSITES_ENABLE_APP_SERVICE_STORAGE
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: WEBSITES_ENABLE_APP_SERVICE_STORAGE
            - name: LICENSE_API_URL
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: LICENSE_API_URL
            - name: BITBUCKET_RETRY_LOAD
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: BITBUCKET_RETRY_LOAD
            - name: BITBUCKET_MINUTES_LOAD
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: BITBUCKET_MINUTES_LOAD
            - name: BITBUCKET_RETRY_ERROR
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: BITBUCKET_RETRY_ERROR
            - name: BITBUCKET_MINUTES_ERROR
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: BITBUCKET_MINUTES_ERROR
            - name: BITBUCKET_RETRY_MANY_REQUESTS
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: BITBUCKET_RETRY_MANY_REQUESTS
            - name: BITBUCKET_SECONDS_MANY_REQUESTS
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: BITBUCKET_SECONDS_MANY_REQUESTS
            - name: BITBUCKET_SCHEDULED_TEAMS_CRON
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: BITBUCKET_SCHEDULED_TEAMS_CRON
            - name: BITBUCKET_SCHEDULED_TOKEN_REFRESH
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: BITBUCKET_SCHEDULED_TOKEN_REFRESH
            - name: BITBUCKET_SCHEDULED_CLIENT_REFRESH
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: BITBUCKET_SCHEDULED_CLIENT_REFRESH
            - name: BITBUCKET_RETRY_TOKEN_REFRESH
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: BITBUCKET_RETRY_TOKEN_REFRESH
            - name: BITBUCKET_MINUTES_TOKEN_REFRESH
              valueFrom:
                configMapKeyRef:
                  name: performance-api-config
                  key: BITBUCKET_MINUTES_TOKEN_REFRESH
          resources:
            requests:
              memory: "256Mi"
              cpu: "250m"
            limits:
              memory: "512Mi"
              cpu: "500m"
      imagePullSecrets:
        - name: secrets-with-container-registry-credentials-?????
---
kind: Service
apiVersion: v1
metadata:
  name: performance-reporter-api-svc
  namespace: default
  labels:
    app: performance-reporter-api
spec:
  selector:
    app: performance-reporter-api
  type: LoadBalancer
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: performance-reporter-api-ingress
  namespace: default
  annotations:
    cert-manager.io/cluster-issuer: "my-cert-issuer-?????"
spec:
  tls:
    - hosts:
        - team-performance-api.mybusiness.com
      secretName: lets-encrypt-private-key
  rules:
    - host: team-performance-api.mybusiness.com
      http:
        paths:
          - pathType: Prefix
            path: /
            backend:
              service:
                name: performance-reporter-api-svc
                port:
                  number: 80

Apply

This yaml contains the deployment, service, secrets and ingress for the Pulzen Gateway API. To apply it, run the following command:

kubectl apply -f deployment.yaml

Mongo DB

Clever Perfromance uses MongoDB as a database. To create your MongoDB Atlas instance, follow these steps:

Create a new MongoDB Atlas instance

  1. Go to the MongoDB Atlas website.
  2. Click on the "Create a new cluster" button.
  3. Fill in the required information and click on "Create".
  4. We recomend to use the free tier cluster and then scale it as needed.

Create a Azure Cosmos for MongoDB API

  1. Go to the Azure Portal.
  2. Click on the "Create a resource" button.
  3. Search for "Azure Cosmos DB" and click on "Create".
  4. Fill in the required information and click on "Create".

Azure & Costs

The aplication can be deployed in Azure, using the Azure Web App service or Azure Kubernetes Service (AKS).

Azure Web App

This is the easiest way to deploy the application, but it has some limitations. The costs are based on the plan you choose, we recommend the Premium V3 plan.

Commits by Hours and Day of Week
  • The application connect to vcs via API and webhooks to get the data, all the data will be stored in the MongoDB database.
  • To deploy this application you can use our deploy on Azure Button.

Deploy to Azure

Persistence

The application uses MongoDB as a database. You can use the Azure Cosmos for MongoDB API service or a MongoDB Atlas instance, either way, you will have to pay for the service.

  • Azure Cosmos for MongoDB API: Use RU (Request Units) to pay for the service.

OpenAPI Specifications

API specifications can be viewed at the url: [URL]/swagger-ui/index.html