application-component

by joaquinito2051

Helm chartv1.2.25App 0.0.0

Deployment of single application component

About this chart

application-component Helm chart

This chart is designed to deploy single component of the application like webserver or sidekiq and configure all additional resources: service account, service, ingress, autoscaling

When deploying full application - this chart should be used several times for every component, as well we should use other charts to handle migration and additional configs and secrets

Usage

Add this chart as dependency to your application chart:

dependencies:
  - name: application-component
    version: 0.0.0
    repository: "https://matic-insurance.github.io/helm-charts"
    alias: "webserver"
  - name: application-component
    version: 0.0.0
    repository: "https://matic-insurance.github.io/helm-charts"
    alias: "sidekiq"
  - name: application-component
    version: 0.0.0
    repository: "https://matic-insurance.github.io/helm-charts"
    alias: "kafka"

Chart using common global values that control application deployment:

global:
  application:
    product: olb
    environment: "staging"
    version: "1.2.3"

  applicationImage:
    repository: "maticinsurance/olb"

Additional deployment components:

  • application-config - allows to define environment variables and config files for all components
  • application-migration - allows to define job that runs before deployment (aka migration)

Define components that should be run:

webserver:
  command: "puma -p 9292"
  deployment:
    replicas: 2
    port: 9292

  # Enable service for the app
  service:
    enabled: true

  # Define ingress configuration for webserver
  ingress:
    enabled: true
    list:
      - host: olb.matic.com
        type: external
        tls: matic.com-tls

  # Create service account in one of the components
  serviceAccount:
    create: true

sidekiq:
  command: "sidekiq -q default"

kafka:
  command: "karafka server"

Application monitoring

Chart support configuration of additional monitoring information for Datadog and Sentry:

global:
  applicationMonitoring:
    datadog: true
    sentry: true

Additional documentation can be found in Confluence:

Full application example

Below is example configuration for regular app at matic

global:
  application:
    product: olb
    environment: production
    version: release-1.2.3

  applicationImage:
    repository: company/olb

  applicationMonitoring:
    datadog: true
    sentry: true

migrations:
  command: "bundle exec rails db:migrate"

webserver:
  component: "webserver"
  command: "bundle exec puma -t 8:8"

  deployment:
    replicas: 2
    port: 9292
    resources:
      requests:
        memory: 500Mi
        cpu: 200m
      limits:
        memory: 1500Mi
        cpu: 600m
    startupProbe:
      enabled: true
    readinessProbe:
      enabled: true
    livenessProbe:
      enabled: true

  ingress:
    enabled: true
    list:
      - host: olb.matic.link
        type: internal
        tls: matic.link-tls

      - host: olb.matic.com
        type: external
        deny_locations:
          - /admin
        tls: matic.com-tls


  service:
    enabled: true

  serviceAccount:
    create: true

  autoscaling:
    enabled: true
    minReplicas: 2
    maxReplicas: 4
    metrics:
      - name: olb-requests-per-second
        type: Datadog
        query: ewma_10(avg:nginx_ingress.controller.requests{service:olb-webserver}.as_count().rollup(avg, 60))
        target:
          type: AverageValue
          averageValue: 12

sidekiq:
  component: "sidekiq"
  command: "bundle exec sidekiq --concurrency 10"
  deployment:
    resources:
      requests:
        memory: 200Mi
        cpu: 100m
      limits:
        memory: 700Mi
        cpu: 300m
    startupProbe:
      enabled: true
      command: /app/ops/scripts/check_sidekiq.sh
    readinessProbe:
      enabled: true
      command: /app/ops/scripts/check_sidekiq.sh

  autoscaling:
    enabled: true
    minReplicas: 1
    maxReplicas: 3
    metrics:
      - name: olb-sidekiq-utilization
        type: Datadog
        query: ewma_10(avg:sidekiq.process.utilization{product:olb}.rollup(avg, 60))
        target:
          type: Value
          value: 75

karakfka:
  component: "karafka"
  command: "bundle exec karafka server"
  deployment:
    replicas: 1
    resources:
      requests:
        memory: 200Mi
        cpu: 100m
      limits:
        memory: 700Mi
        cpu: 300m

Deploy application-component with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has application-component on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartapplication-component is pinned at v1.2.25 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply