nirv-ai / IaC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cd - run dev_core locally via nomad as a prereq for CD to aws

noahehall opened this issue · comments

C

  • terraform should be setup to manage the infrastructure, now we need another pipeline for code deployments
  • before going to far with nomad integration, ensure the entire stack runs locally via nomad jobs consuming docker image artifacts output from the normal development cycle

T

  • nomad
    • create a server configuration for dev
    • continue to use compose to build images, and use those tagged images in nomad task configs
    • extract values needed for nomad out of the compose file and into an .env file for consumption by nomad as an input var file
      • you can use yq to convert docker compose convert into json and consume the json
        • save json: docker compose convert | yq -r -o=json > ./apps/nirvai-core-nomad/dev/.env.json
        • save yaml: docker compose convert > ./apps/nirvai-core-nomad/dev/compose.yaml
        • read the levant template docs
          /docs/templates.md)
      • read the nomad pack docs
      • you can use hcl2 for jobspecs
      • set up local registry for use by nomad to pull images from
      • nomad vault task
        • convert to build + dockerfile instead of image so we can tag it via compose
          • ${PROJECT_NAME}-${SERVICE_NAME}:${NODE_ENV:-development}
      • nomad postgres task in core-db group
      • nomad bff task in core-bff group
        • fix node bff sleep recursion waiting on vault to be ready
        • use esbuild define logic to inject env vars into build and remove dotenv (which requires a file)
      • nomad proxy task in core-proxy group
        • convert to build + dockerfile instead of image so we can tag it via compose
          • ${COMPOSE_PROJECT_NAME}-${SERVICE_NAME}:${NODE_ENV:-development}
        • might as well handle the server conf on this ticket

A

  • nomad successfuly runs all cotnainers (sans UI)

    • skipping UI as the architecture is completely different (lambda, no server)
    • while nomad runs each service, there not connected
      • the work to translate docker networks into compose architecture would be futile, as theres a different set of requirements of usecases
  • all that work on levant to only find this

  • check how hashicorp does their userdata scripts

  • new workflow

    • docker based: continue to run nirvai-core via docker compose;
      • anticipate 0 changes to this workflow, however preference should be for nomad to have closer parity with prod
    • nomad based
      • set NODE_ENV for tagging all images
      • docker compose build: build images, will auto tag based on current NODE_ENV value
      • start nomad: will find the images tagged with the current NODE_ENV and use them for each task group
      • accordsing to @danielabar there may be issues around caching with nomad
  • fixed bff sleep logic: now bff wont automatically throw (removed throw ZombieError()) and will just recursively sleep and try forever

Image