Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions .github/workflows/create-and-publish-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ name: Create and publish web and proxy Docker images

# manually trigger while testing
on:
push:
branches:
- main
release:
types: [published]
workflow_dispatch:

# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and the tags on the web and proxy image.
env:
REGISTRY: ghcr.io
METADATA_TAGS: &metadata-tags |
type=sha
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=raw,latest

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works in wcbluepages. Keeping for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if Copilot cited sources to read up on:

  • Whether current syntax is supported
  • whether changes in accepted syntax is supported
  • confirm that this recommended (untested) change is preferred over the current (tested) syntax


jobs:
build-and-push-image:
Expand All @@ -36,11 +41,20 @@ jobs:
run: |
IMAGE_NAME=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV
- name: Extract metadata (tags, labels) for Docker
id: meta

- name: Extract metadata (tags, labels) for Docker Web Image
id: meta-web
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/web
tags: *metadata-tags

- name: Extract metadata (tags, labels) for Docker Proxy Image
id: meta-proxy
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/proxy
tags: *metadata-tags
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
Expand All @@ -55,8 +69,8 @@ jobs:
context: ./TEKDB
file: ./TEKDB/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/web:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/web:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta-web.outputs.tags }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much cleaner and (I hope) also reduces required user-configuration of local .env files.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for adding tags to docker images so that we have better observability of what versions folks are running. I'm hoping that this will be helpful as we have partners adopt docker deployment, we can debug with their exact docker image.

labels: ${{ steps.meta-web.outputs.labels }}
cache-from: type=gha,scope=ghcr-web
cache-to: type=gha,mode=max,scope=ghcr-web

Expand All @@ -67,8 +81,8 @@ jobs:
context: ./proxy
file: ./proxy/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/proxy:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/proxy:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta-proxy.outputs.tags }}
labels: ${{ steps.meta-proxy.outputs.labels }}
cache-from: type=gha,scope=ghcr-proxy
cache-to: type=gha,mode=max,scope=ghcr-proxy

Expand Down
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,50 @@
# TEKDB
# TEKDB ![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/paigewilliams/9ac2331c0af09d1f4fc3921a2c2cd142/raw/coverage-badge.json)

Traditional Ecological Knowledge Ethnographic Database Application

## [Development Installation](https://github.com/Ecotrust/TEKDB/wiki/Development-Installation)

## [Running Tests](https://github.com/Ecotrust/TEKDB/wiki/Running-tests)

![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/paigewilliams/9ac2331c0af09d1f4fc3921a2c2cd142/raw/coverage-badge.json)
## Development Cycle

This project aims to follow a specific development cycle to ease collaboration and keep the different environments in sync. Below is a diagram of what the development lifecycle should look like:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot of content for README. I think it's great for an audience of potential contributors. Perhaps this content could be it's own doc and linked from here (as the others are linked).

Separate from this, I'd love (when there's time) to think hard about what audience we want to reach with the README, and how to route that audience.

Still - this is cool. I love flowcharts and this helps make the complexity far more readable.


```mermaid
flowchart TB
subgraph Develop
CHECKOUT[checkout develop branch] --> FEAT[Create feature Branch]
FEAT --> PR[Submit Pull Request against develop branch]
PR --> APPROVE{Approval}
APPROVE -->|Approved| DEVMERGE[Merge into develop branch]
APPROVE -->|Rejected| REJECTED[Address feedback]
REJECTED --> APPROVE
end

subgraph Staging
DEVMERGE --> GHSTAGE[GitHub Action deploys to staging.itkdb.org]
GHSTAGE --> QA[QA on staging environment]
QA --> QAPASS{Passes QA}
end

subgraph Production
QAPASS -->|PASSES| PRVERSION[Create feature branch and open PR to update version in settings.py]
QAPASS -->|FAILS| FEAT
PRVERSION --> PRDEV[Merge into develop branch]
PRDEV --> PRMAIN[PR for develop into main]
PRMAIN --> PRMERGEMAIN[Merge into main branch]
PRMERGEMAIN --> RELEASE[Publish a new Release]
RELEASE --> GHPROD[GitHub Action builds and publishes images to GHCR]
GHPROD --> PRODDEPLOY[Manually deploy to demo.itkdb.org]
PRODDEPLOY --> QAPROD[Test in production]
QAPROD --> QAPASSPROD{Passes QA}
QAPASSPROD --> |PASSES| SUCCESS[Success!]
QAPASSPROD --> |Fails| HOTFIX[Create a hotfix branch off of main]
HOTFIX --> PRHOTFIX[PR for hotfix into main]
PRHOTFIX --> APPROVEHOTFIX{Approval}
APPROVEHOTFIX --> |Approval| MERGEHOTFIX[Merge into main branch]
APPROVEHOTFIX --> |Rejected| REJECTEDHOTFIX[Address feedback]
REJECTEDHOTFIX --> APPROVEHOTFIX
MERGEHOTFIX --> RELEASE
end
```