Skip to content

operational notes

Stephen D. Spencer edited this page Jan 6, 2023 · 15 revisions
stateDiagram-v2

    onPush: onPush events
    state onPush {
      [*] --> changeDetected
    }

    changeDetected: does last commit to dumps/*latest.sql* == HEAD?
    state changeDetected {
      state newData <<choice>>
      newData --> checkCurrentSolrExists: False
      newData --> regenSolr: True

      state checkCurrentSolrExists <<choice>>
      checkCurrentSolrExists: does solr image exist?
      checkCurrentSolrExists --> pullSolrImage: True
      checkCurrentSolrExists --> regenSolr: False
     
      note left of checkCurrentSolrExists
        docker manifest inspect $( just tag )-solr
      end note 
      
      regenSolr: just regen-solr-image
      regenSolr --> untagSolrImage

      pullSolrImage: docker pull $( just tag )-solr
      pullSolrImage --> untagSolrImage

      untagSolrImage: docker tag $( just tag )-solr solr
      untagSolrImage --> postCheck
      note left of untagSolrImage
        untag image
      end note
      
    }

   postCheck: build and test
   state postCheck {
     [*] --> bumpVersion
     bumpVersion --> retagSolrImage
     retagSolrImage: docker tag solr $( just tag )-solr
     retagSolrImage --> buildTestRunner
     buildTestRunner: just build tester
     buildTestRunner --> runTests
     runTests: just test
     runTests --> [*]
  

 bumpVersion: update build version metadata
    note left of bumpVersion
      only fires on main
    end note
    state bumpVersion {
      [*] --> bvPatch: on PR merge
      [*] --> bvMerge: on direct push
      bvPatch: just bump patch
      bvPatch --> [*]
      bvMerge: just bump build
      bvMerge --> [*]
    }
 }
Loading

deployment tags

A fluxcd receiver is configured for each deployable environment to receive webhooks on create events. Each receiver monitors its own variation of the git tag, [environment]/deploy.

A similar tag, last/[environment]/deploy is maintained as a human-friendly reference in the case of needing to rollback a deployment quickly.

justfile targets

The scripted components for building and deploying a container-image are contained in the project root's justfile. The primary target is CI; however, running these commands locally works assuming access to the upstream registry.


primary

  • build
  • push
  • test
  • regen-solr-image
...

target args summary
build step
action
verbosity
corresponds to image layer id
(--load or --push)
'' for quiet
push step ibid.
test none test-run as seen in CI
deploy env execute deployment to env environment
regen-solr-image none sequence for generating the django-haystack solr index and loading it to a container image

utility

  • regen-requirements
  • bump
  • solr-dc
  • ci-dc
...

target args summary
regen-requirements none use pip-compile to regenerate web/requirements.txt and web/requirements.prod.txt
bump part
args
one of: major, minor, patch, build
additional bump2version CLI flags (e.g.: --dry-run --verbose)
solr-dc none wrapper for regen-solr-image docker-compose environment
ci-dc none wrapper for CI docker-compose environment

convenience

  • layers
  • registry
  • tag
  • version
...

target summary
layers list layer ids from ./Dockerfile
registry display registry string
tag registry + image version
version image version

Clone this wiki locally