MinaProtocol / mina

Mina is a cryptocurrency protocol with a constant size blockchain, improving scaling while maintaining decentralization and security.
https://minaprotocol.com
Apache License 2.0
1.99k stars 529 forks source link

Package ITN3 services into Helm chart #14296

Closed stevenplatt closed 1 year ago

stevenplatt commented 1 year ago

Summary

This task is to document packaging ITN backend services into a Helm chart that can be deployed to Kubernetes.

The current version of the ITN services were previously supported by Viable Systems and was packaged as a docker compose configuration. This configuration is harder to bundle with the ITN deployment written in terraform however, so it is being converted to a helm chart for final deployment.


Docker Compose Configuration

version: '2'
services:
  internal-log-fetcher:
    image: gcr.io/o1labs-192920/mina-internal-trace-consumer:1.1.0 # openmina/mina-internal-trace-consumer:2d3bc20
    # image: local/mina-internal-trace-consumer
    container_name: internal-log-fetcher
    restart: always
    command: "fetcher -k /keys/secret_key -o /output -n /names-data/node_names.json --db-uri 'postgresql://<postgresuser>:<postgressecret>@postgres:5432' discovery"
    ports:
      - 4000:4000
      - 11000-11700:11000-11700
    volumes:
      - ./credentials:/credentials
      - ./keys:/keys
      - ./output:/output
      - ./names-data:/names-data
    environment:
      GOOGLE_BUCKET: uptime-itn-pre-launch-sanity-check
      GOOGLE_SERVICE_ACCOUNT: /credentials/creds
      INTERNAL_TRACE_CONSUMER_EXE: /internal_trace_consumer
    networks:
      - internal-log-fetcher-network

  frontend:
    image: directcuteo/mina-frontend:663f692
    container_name: frontend
    restart: always
    ports:
      - 80:80
    command:
      - sh
      - -ce
      - |
        ENV=$(cat /fe-config.json | tr -d '\n' | tr -s ' ' | sed -e 's/ //g') envsubst < /usr/share/nginx/html/assets/env.template.js > /usr/share/nginx/html/assets/env.js
        exec nginx -g 'daemon off;'
    volumes:
      - ./fe-config.json:/fe-config.json
    networks:
      - internal-log-fetcher-network
​
  postgres:
    image: postgres
    shm_size: 1g
    container_name: postgres
    restart: always
    ports:
      - 5455:5432
    command: "-c max_connections=10000 -c shared_buffers=2048MB"
    volumes:
      - ./postgresql:/var/lib/postgresql/data
    environment:
      PGDATA: /var/lib/postgresql/data/pgdata
      POSTGRES_PASSWORD: <postgressecret>
    networks:
      - internal-log-fetcher-network
​
networks:
  internal-log-fetcher-network:
stevenplatt commented 1 year ago

Working branch: testworkd-v2-deployment Helm chart name: itn-services

stevenplatt commented 1 year ago

Work to package ITN3 backend logging into a helm chart has been retired without merging. After completing an initial version of the deployment, there is a limitation of deploying the system as a Helm chart within kubernetes, due to it requiring a large port range for external access. To my knowledge, there i not a way to enable this in Kubernetes, without configuring an ingress or load balancer for each port.

To address this, the deployment is instead being deployed using the existing Docke rcompose configuration documented here: https://app.zenhub.com/workspaces/velocity-62264fddc441a100183f7f86/issues/gh/minaprotocol/mina/14423