Skip to content

Commit

Permalink
Redesign Build Deployment Process (External) (#113)
Browse files Browse the repository at this point in the history
* Create image_build_push.yml

* Corrected Dockerfile path

* Added Dockerfile in repo root.

Need to make it available outside the docker folder as the build context was specified in the docker compose as the repo root directory and corresponding paths in the Dockerfile were relative to the root directory.

Additionally, added Environment variables defined in docker compose file.

The image wasn't running directly after building because these things were missing:
- needed to add db container as well
- ports needed to be exposed for both db and dashboard container
- common network needed to be added under which both the containers had to be linked
- all environment variables had to be added, especially important ones like DB_HOST

* Replaced config.py with config-fake.py in external Dockerfile.

Encountered error while building and pushing docker image as a part of the CI.
Due to config.py mentioned in COPY command in Dockerfile not being there in the repo online.
Added config-fake.py in its place for now, so image is pushed to Dockerhub.
But eventually, will need to handle as per decision to consolidate differences in external and internal repos.

* Copy config-fake.py as config.py

In the external public Docker image, make the config-fake.py available as config.py by copying it over into the container as config.py

Internally, if custom config.py is needed, can copy it over in the internal Dockerfile.

But might not even need the config.py

* Removed expose port duplication

Found usage of two variables referring to same port.
Had exposed using both variable names.
But since same port exposed, should be fine to expose just once.

* Multiple changes for external repo differences

1. Changes in related files including Dockerfile for loading OpenPATH logo from local image rather than URL link.

2. Changed sed to jq in start.sh.

3. Changed dash version to latest v 2.16.1

4. Added new Dockerfile for image_build_push yml.

Removed assets/ from COPY command as only contents of assets/ were being copied to root app directory.

In COPY assets command, copy entire directory instead of just css file.

* Added TODO to change image push branch

Currently the branch specified - "image-push-merge" is available locally on my system.
I use it to test the automated docker image push mechanism whenever any changes are merged to this branch.
Once, everything looks good, need to change this to master or main as per the repo.

* Removed printing Docker username

Had added it initially for testing purposes.
Can remove now so it doesn't expose any sensitive info.

* Replacing CognitoConfig class with ENV variables

- Option 1: Can we read in these values directly from environment variables instead of reading from a class?

- Option 2: Create a class that makes all environment variables available as python variables

For now, I’m going ahead with reading in these variables directly.
So, will need to replace all uses of CognitoConfig class with variable name directly in files that use it.

Shankari mentioned in a commit whether we even need config.py?
927817a

Also, removed references to both config-fake.py and config.py in the Dockerfiles.

* Replaced dictionary in config.py

Added actual template value directly where the variable was being used through the config.py file.

* Removing ENV variables from Dockerfile

The other ENV vars that were added in Docker-compose files are currently present in the Dockerfile in the external repo root.

Removing them from there and can add them as per requirement.

For local testing, add them when “docker run” is used using the -e flag.

For usage in stage / production, can be set by cloud team in AWS Codebuild as they currently do.

* Update requirements.txt

Changed pillow version to 10.3.0
Editing online manually to test if Github action still works after re-adding image_build_push.yml file.

* Removed sed / jq usage from start scripts

Can directly set DB_HOST since we can now use environment variables.
No need to use jq or sed to replace file contents and copy over files.

* Changing base image to build from redesign server image

Created a new branch image-push-merge for e-mission-server in my forked repo.
Also modified image push workflow to build and push docker image to docker hub on push to image-push-merge branch.

Doing this since admin-dash was failing when was building from internal repo since this was still referring to old server code.
Changed Dockerfile and docker/Dockerfile.dev in public-dash and admin-dash to build from this new image
mukuflash03/e-mission-server:image-push-merge_2024-04-12--01-01

Redesigned server image is built from the image-push-merge branch on my personal forked repository.
This branch has a workflow run set up to build the docker image and push it to Dockerhub whenever a push or merge happens to image-push-merge branch.
Currently, I've been pushing to image-push and then creating a PR to merge into image-push-merge.

Doing this, so admin-dash and public-dash can build from the latest redesigned server code.
This is not the latest server code but the latest changes from my redesign PR.

* Bumped up base server image tag

Changing to build from base server image from my personal Dockerhub repository with redesigned server code.
Will need to change to build from Shankari's Dockerhub repository, once all changes are final.

* Bump up base server image tag

* Artifact download test - 1

Added working code from join repo to fetch docker image tags using artifact download.

* Bumped up server image tag

Bumped up after fixing "url" KeyError bug in this commit in server repo:
MukuFlash03/e-mission-server@e778b3f

* Artifact + Matrix - 1

Combining both artifact and matrix methods since both workflow is triggered by both push event and workflow_dispatch event.

Workflow dispatch event receives tag via input parameter sent via server workflow.
Push event does not receive any tag and the DOCKER_IMAGE_TAG_2 would have empty value since workflow triggering event and hence input parameter would be empty.
So, was facing the issue of having empty timestamp being suffixed to the docker image tag in the Dockerfiles.

Hence, using the logic of fetching the latest run id and then downloading the artifact uploaded by server workflow to ensure that a non-empty value is also retrieved for the timestamp.
This value is stored in DOCKER_IMAGE_TAG_1 and can be used for building docker image.

Now, depending on the trigger event, the appropriate docker image tag can be used in the docker build command for the --build-arg flag.

Additionally, Dockerfiles now use ARG to use the tags passed from the docker build command, hence using environment variables.

Docker-compose files similarly have the args config parameter set.

Developers would have to set the correct server image tags manually here for the docker-compose command to pass the value to the ARG in the Dockerfile and correctly set the image tag to point to the appropriate server image.
Need to mention somewhere in the ReadME.md to refer to the server image list in Dockerhub to choose the latest image tag. While pushing the image in the GitHub actions, it'll be done manually.

Todo: Change branch name to tags-combo-approach in fetch_runID.py

* Artifact + Matrix - 2

Was unable to see docker_image_tag in echo statement in logs.
Added docker_image_tag print statement to see retrieved image tag.
Ah! Was using run_id instead of docker_image_tag as the output value in outputs section in fetch_tag job.

* Artifact + Matrix - 3

Still not seeing the env vars echo-ed.
Debugging by printing various log statements.

* Artifact + Matrix - 4

Still not seeing the env vars echo-ed.
Debugging by printing various log statements.

* Artifact + Matrix - 5

Working finally!
Changed the deprecated set-output command to use {key}={value} format with echo command.

Also, adding commented out build and push commands to see if build, push is successful.
For this commit, not changing branch = tags-artifact in fetch_runID.py
Once, server code has latest working yml file, then will come back and push another commit to change branch to tags-combo-approach.

* Artifact + Matrix - 6

Removed an extra echo statement.

* Artifact + Matrix - 7

Updating Dockerfiles to use ARG environment variable with latest timestamp that will be passed through:
- `docker build --build-arg` command in Github actions in the workflow for automated pushing to Docker hub.
- `args: ` config field in docker-compose which will need to be set manually by developers locally.

Also, changing branch in fetch_runID and Dockerfiles to tags-combo-approach.

* Artifact + Matrix - 8

For public-dash, admin-dash where ARGS are now being used, need to add the args under build command in the docker compose files.
Gives error if arg is at the same hierarchical level as build.

Also, public-dash docker-compose.yml (non-dev) version changed to have build: context, dockerfile ; unlike only build: frontend.
This allows adding args under build. Similar to how currently being built in docker-compose.dev.yml.

Also, args to be added under notebook-server and not dashboard since viz_scripts builds off of server image and not frontend, which is a node image.

* Artifact + Matrix - 9

Adding .env file which stores only docker image timestamp for the latest dockerhub e-mission-server image already pushed.

.env file overwritten in both types of trigger events - push and workflow_dispatch.

Added commit and push github actions as well for pushing latest changes to the .env file made via the workflow.

Lastly, docker-compose now also mentions the ENV variable name to be read from the .env file for the ARG value in the Dockerfile.

No changes required in the Dockerfiles.

* Updated docker image tag in .env to the latest timestamp:

* Updated docker image tag in .env to the latest timestamp: 2024-05-03--14-37

* Added TODOs in github actions workflow YAML file.

Reminder for things to change as per master branch of e-mission-server once changes are finalized.

* Artifact + Matrix - 10

Added another TODO.

evious Push event triggers run failed

Error occurred in GitHub actions git add, commit, push step.
If file with no changes operated upon, it leaves an error:
“nothing to commit, working tree clean
Error: Process completed with exit code 1.”

Need to fix.

——

Quick fix is to make changes to .env file only if workflow_dispatch event is the trigger.
Don’t do anything for push event.
So, in case anyone modifies .env file on their own by using their own timestamp during testing, and pushes it as a part of their PR, then Shankari will have to ask them to revert the changes.
Else, their custom timestamp will make it to the repo code base.

Found something:
https://www.reddit.com/r/github/comments/ju3ipr/commit_from_github_action_only_when_changes_exist/

It should work but there’s a drawback of using “exit 0” - it will mask all errors generated during “git commit”.
This is bad and we won’t be able to see the reason why something wrong happened as the workflow would be shown as successful with a green tick.

Found a solution with git diff:
https://github.com/simonw/til/blob/main/github-actions/commit-if-file-changed.md

$ git diff --quiet || (git add README.md && git commit -m "Updated README")

However, I won’t be able to log any message saying that no changes to commit, tag not modified.
Hence, will possibly use just “git diff —quiet” with an if-else block.

Expected results:
- Push event triggers workflow.
- It writes DOCKER_IMAGE_TAG_1 fetched from last successful completed run to .env file.
- It sees that there is a difference in the latest committed .env file in the dashboard repo which includes older timestamp.
- Hence it runs git commit part of the script to reset to latest server timestamp.

* Updated docker image tag in .env file to the latest timestamp

* Updated docker image tag in .env file to the latest timestamp

* Updated docker image tag in .env file to the latest timestamp

* Update Dockerfile

Reverting the Dockerfile tag for testing so that checks can run properly

* Syntax

Removing a space.

* Updated docker image tag in .env file to the latest timestamp

* Update Dockerfile again

Also editing this file so that checks pass for now

* Finalize Dockerfiile

Changing this to build from actual e-mission server in hopes of merging!

* Update Dockerfile in docker folder

Potentially finalizing the dockerfile in the docker repo.

* Update fetch_runID.py

Removing prints/comments, updating head_branch and download_ url.

* Cleanup image_build_push.yml

Removing comments and changing branches so it's ready for merge.

* Removing docker build, updating DOCKER_IMAGE_TAG --> SERVER IMAGE TAG, removing redundant db setting

* Reverting for testing

Need to test some changes to the workflows, so temporarily reverting these changes to work with mukul's branches.

* Trying to trigger run without matrix

Changing branches to try to trigger run and see if I can test docker compose

* Changing repo name

* Updated docker image tag in .env file to the latest timestamp

* So close to trying docker compose with actions

Runner couldn't find the file (because I used the wrong filename)

* Build context change

* dockerhub repos are case sensitive.

* Updating tag

* Rename docker tag

Docker image created locally is not taking the name that I passed in for it. Hopefully, every new image created in an individual runner is named the same thing, so that this workaround is successful.

* Add artifact

Adding artifact upload for internal repo to be able to pull image tag.

* Trying to use admin dash tag

Trying to do this the way I originally planned.

* Reverting changes

Reverting the changes I made to test docker compose

* Remove extra dockerfile

* server image tag update

* Update .env

Adding other env vars as a template

* Update image_build_push.yml

Adding other env vars to .env. Otherwise, the file will get overwritten with the server tag only every time.

* Update start.sh

Remove extraneous fi

* Switching to build prod compose

Because that makes sense.

* Updated username to clarify that env file is being updated

* Modified tag variable names to be more relevant

These store tags differently depending on the trigger event - Push OR Workflow dispatch

* Removing redundant pip install

* Certificates added in Dockerfile

Similarly done with public-dashboard.
See comment:
e-mission/em-public-dashboard#125 (comment)

* Fixed indentation

* Added .env.cognito.template + Removed cognito variables from .env and workflow file

The .env file is meant to be used only for the docker image tag to store the latest server image tag.
If other variables are stored there, the workflow will overwrite the .env file to store only the image tag whenever the CI/CD runs.

Hence, separating out the Cognito variables in a separate template file.
I am expecting the users would either set them directly in the system or use the docker compose prod yml file.

* Removing artifact method

This was mainly needed for Push event but since Workflow dispatch event would be setting the latest server image tag in .env file, the push event can read from this file directly.

* Updating latest server image tag

This is probably the first and only time we'll need to manually change the image tag.
Hence forth, the CI/CD should automatically update the .env file with the latest tag whenever the workflow dispatch is triggered on new merges to server.

* Moving .env file update and git commit to the end

This will ensure that if the CI/CD pipeline fails in any prior steps such as the docker related ones, the .env file isn't updated.
This is because the the docker failures can include errors image not found which can occur due to incorrect tags.

---------

Co-authored-by: Mahadik, Mukul Chandrakant <[email protected]>
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: Natalie Schultz <[email protected]>
  • Loading branch information
4 people authored Aug 15, 2024
1 parent c6d1507 commit 00e3d0d
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 49 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SERVER_IMAGE_TAG=2024-08-12--15-15
7 changes: 7 additions & 0 deletions .env.cognito.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
COGNITO_CLIENT_ID=''
COGNITO_CLIENT_SECRET=''
COGNITO_REDIRECT_URL=''
COGNITO_TOKEN_ENDPOINT=''
COGNITO_USER_POOL_ID=''
COGNITO_REGION=''
COGNITO_AUTH_URL=''
98 changes: 98 additions & 0 deletions .github/workflows/image_build_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: docker-image-push-admin

on:
push:
branches: [ master ]

workflow_dispatch:
inputs:
docker_image_tag:
description: "Latest Docker image tags passed from e-mission-server repository on image build and push"
required: true

env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}

jobs:
build:
runs-on: ubuntu-latest

env:
DOCKER_TAG_FROM_WORKFLOW_DISPATCH: ${{ github.event.inputs.docker_image_tag }}

steps:
- uses: actions/checkout@v4

- name: Set docker image tag from .env file
run: |
set -a; source .env; set +a
echo "DOCKER_TAG_FROM_PUSH=${SERVER_IMAGE_TAG}" >> $GITHUB_ENV
- name: Print input docker image tag
run: |
echo "Event name: ${{ github.event_name }}"
echo "Latest docker image tag (push): ${{ env.DOCKER_TAG_FROM_PUSH }}"
echo "Latest docker image tag (workflow_dispatch): ${{ env.DOCKER_TAG_FROM_WORKFLOW_DISPATCH }}"
- name: docker login
run: | # log into docker hub account
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Get current date # get the date of the build
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d--%M-%S')"

- name: Run a one-line script
run: echo running in repo ${GITHUB_REPOSITORY#*/} branch ${GITHUB_REF##*/} on ${{ steps.date.outputs.date }}

- name: build docker image
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
SERVER_IMAGE_TAG=$DOCKER_TAG_FROM_WORKFLOW_DISPATCH docker compose -f docker-compose-prod.yml build
else
SERVER_IMAGE_TAG=$DOCKER_TAG_FROM_PUSH docker compose -f docker-compose-prod.yml build
fi
docker images
- name: rename docker image
run: |
docker image tag e-mission/opdash:0.0.1 $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }}
- name: push docker image
run: |
docker push $DOCKER_USER/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/}_${{ steps.date.outputs.date }}
- name: Update .env file
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "Workflow_dispatch: New server image built and pushed, Updating image tag in .env"
echo "SERVER_IMAGE_TAG=$DOCKER_TAG_FROM_WORKFLOW_DISPATCH" > .env
else
echo "Push event: Restoring latest server image tag from .env"
fi
- name: Add, Commit, Push changes to .env file
run: |
git config --local user.email "[email protected]"
git config --local user.name "Github Actions bot to update .env with latest tags"
if git diff --quiet; then
echo "Latest timestamp already present in .env file, no changes to commit"
else
git add .env
git commit -m "Updated docker image tag in .env file to the latest timestamp"
git push origin
fi
- name: Create artifact text file
run: |
echo ${{ steps.date.outputs.date }} > admin_dash_tag_file.txt
echo "Created tag text file"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: admin-dash-image-tag
path: admin_dash_tag_file.txt
overwrite: true

12 changes: 8 additions & 4 deletions app_sidebar_collapsible.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from dash import Input, Output, dcc, html, Dash
import dash_auth
import logging
import base64
# Set the logging right at the top to make sure that debug
# logs are displayed in dev mode
# until https://github.com/plotly/dash/issues/532 is fixed
Expand All @@ -29,15 +30,17 @@
import flask_talisman as flt



OPENPATH_LOGO = "https://www.nrel.gov/transportation/assets/images/openpath-logo.jpg"
OPENPATH_LOGO = os.path.join(os.getcwd(), "assets/openpath-logo.jpg")
encoded_image = base64.b64encode(open(OPENPATH_LOGO, 'rb').read()).decode("utf-8")
auth_type = os.getenv('AUTH_TYPE')


if auth_type == 'cognito':
from utils.cognito_utils import authenticate_user, get_cognito_login_page
elif auth_type == 'basic':
from config import VALID_USERNAME_PASSWORD_PAIRS
VALID_USERNAME_PASSWORD_PAIRS = {
'hello': 'world'
}

app = Dash(
external_stylesheets=[dbc.themes.BOOTSTRAP, dbc.icons.FONT_AWESOME],
Expand All @@ -59,7 +62,8 @@
[
# width: 3rem ensures the logo is the exact width of the
# collapsed sidebar (accounting for padding)
html.Img(src=OPENPATH_LOGO, style={"width": "3rem"}),
# html.Img(src=OPENPATH_LOGO, style={"width": "3rem"}),
html.Img(src=f"data:image/png;base64,{encoded_image}", style={"width": "3rem"}), # Working
html.H2("OpenPATH"),
],
className="sidebar-header",
Expand Down
Binary file added assets/openpath-logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 0 additions & 21 deletions config-fake.py

This file was deleted.

2 changes: 2 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ services:
build:
context: .
dockerfile: docker/Dockerfile
args:
SERVER_IMAGE_TAG: ${SERVER_IMAGE_TAG}
image: e-mission/opdash:0.0.1
ports:
- "8050:8050"
Expand Down
2 changes: 2 additions & 0 deletions docker-compose-prod-nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ services:
build:
context: .
dockerfile: docker/Dockerfile
args:
SERVER_IMAGE_TAG: ${SERVER_IMAGE_TAG}
image: e-mission/opdash:0.0.1
environment:
DASH_DEBUG_MODE: "True"
Expand Down
2 changes: 2 additions & 0 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ services:
build:
context: .
dockerfile: docker/Dockerfile
args:
SERVER_IMAGE_TAG: ${SERVER_IMAGE_TAG}
image: e-mission/opdash:0.0.1
ports:
- "8050:8050"
Expand Down
10 changes: 7 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM shankari/e-mission-server:master_2024-07-19--34-43
ARG SERVER_IMAGE_TAG

FROM shankari/e-mission-server:master_${SERVER_IMAGE_TAG}

ADD https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem /etc/ssl/certs/

ENV DASH_DEBUG_MODE True
ENV SERVER_PORT 8050
Expand All @@ -17,10 +21,10 @@ COPY ./pages ./
WORKDIR /usr/src/app/utils
COPY ./utils ./
WORKDIR /usr/src/app
COPY app.py config.py app_sidebar_collapsible.py assets globals.py globalsUpdater.py Procfile ./
COPY app.py app_sidebar_collapsible.py globals.py globalsUpdater.py Procfile ./

WORKDIR /usr/src/app/assets
COPY assets/style.css ./
COPY assets/ ./
RUN mkdir qrcodes

# copy over test data
Expand Down
8 changes: 1 addition & 7 deletions docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@
source setup/activate.sh

# change the db host
echo "DB host = "${DB_HOST}
if [ -z ${DB_HOST} ] ; then
local_host=`hostname -i`
sed "s_localhost_${local_host}_" conf/storage/db.conf.sample > conf/storage/db.conf
else
sed "s_localhost_${DB_HOST}_" conf/storage/db.conf.sample > conf/storage/db.conf
fi
echo ${DB_HOST}

# run the app
# python app.py
Expand Down
12 changes: 6 additions & 6 deletions utils/cognito_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
import flask
import requests
import dash
import os

from config import CognitoConfig
from utils import decode_jwt


def get_tokens(code):
client_id = CognitoConfig.CLIENT_ID
client_secret = CognitoConfig.CLIENT_SECRET
redirect_uri = CognitoConfig.REDIRECT_URL
token_endpoint = CognitoConfig.TOKEN_ENDPOINT
client_id = os.getenv("COGNITO_CLIENT_ID", '')
client_secret = os.getenv("COGNITO_CLIENT_SECRET", '')
redirect_uri = os.getenv("COGNITO_REDIRECT_URL", '')
token_endpoint = os.getenv("COGNITO_TOKEN_ENDPOINT", '')

encoded_data = base64.b64encode(f'{client_id}:{client_secret}'.encode('ascii')).decode('ascii')
headers = {
Expand Down Expand Up @@ -59,7 +59,7 @@ def get_cognito_login_page(text='Welcome to the dashboard', color='black'):
dash.html.Label(text, style={
'font-size': '15px', 'display': 'block', 'verticalAlign': 'top', 'padding': '15px', 'color': color
}),
dbc.Button('Login with AWS Cognito', id='login-button', href=CognitoConfig.AUTH_URL, style={
dbc.Button('Login with AWS Cognito', id='login-button', href=os.getenv("COGNITO_AUTH_URL", ''), style={
'font-size': '14px', 'display': 'block', 'padding': '15px', 'verticalAlign': 'top',
'background-color': 'green', 'color': 'white'
}),
Expand Down
15 changes: 7 additions & 8 deletions utils/decode_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
import urllib.request
from jose import jwk, jwt
from jose.utils import base64url_decode
import os

from config import CognitoConfig

client_id = CognitoConfig.CLIENT_ID
client_secret = CognitoConfig.CLIENT_SECRET
redirect_uri = CognitoConfig.REDIRECT_URL
token_endpoint = CognitoConfig.TOKEN_ENDPOINT
user_pool_id = CognitoConfig.USER_POOL_ID
region = CognitoConfig.REGION
client_id = os.getenv("COGNITO_CLIENT_ID", '')
client_secret = os.getenv("COGNITO_CLIENT_SECRET", '')
redirect_uri = os.getenv("COGNITO_REDIRECT_URL", '')
token_endpoint = os.getenv("COGNITO_TOKEN_ENDPOINT", '')
user_pool_id = os.getenv("COGNITO_USER_POOL_ID", '')
region = os.getenv("COGNITO_REGION", '')

keys_url = f'https://cognito-idp.{region}.amazonaws.com/{user_pool_id}/.well-known/jwks.json'
# instead of re-downloading the public keys every time
Expand Down

0 comments on commit 00e3d0d

Please sign in to comment.