From 031efe25504764cb6ee745dfd9bd4c950fa520ad Mon Sep 17 00:00:00 2001 From: Aaron Luna Date: Sun, 7 Jan 2024 21:49:23 -0800 Subject: [PATCH] Update Unicode API deployment configuration --- .github/workflows/deploy_unicode_api.yml | 2 +- Dockerfile | 9 --------- app/data/scripts/get_prod_data.py | 2 +- docker-bake.hcl | 18 ++++++------------ 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/.github/workflows/deploy_unicode_api.yml b/.github/workflows/deploy_unicode_api.yml index 13b6939..23a9001 100644 --- a/.github/workflows/deploy_unicode_api.yml +++ b/.github/workflows/deploy_unicode_api.yml @@ -28,7 +28,7 @@ jobs: push: true set: | unicode-api.args.REDIS_PW=${{ secrets.REDIS_PW }} - unicode-api.args.TEST1=BAKE_SET1 + unicode-api.args.UNICODE_VERSION=${{ secrets.UNICODE_VERSION }} - name: Deploy unicode-api docker image to dokku uses: dokku/github-action@master with: diff --git a/Dockerfile b/Dockerfile index 8180df2..5b292c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,8 +10,6 @@ ARG RATE_LIMIT_PER_PERIOD ARG RATE_LIMIT_PERIOD_SECONDS ARG RATE_LIMIT_BURST ARG TEST_HEADER -ARG TEST1 -ARG TEST2 ENV ENV=${ENV} ENV UNICODE_VERSION=${UNICODE_VERSION} @@ -23,8 +21,6 @@ ENV RATE_LIMIT_PER_PERIOD=${RATE_LIMIT_PER_PERIOD} ENV RATE_LIMIT_PERIOD_SECONDS=${RATE_LIMIT_PERIOD_SECONDS} ENV RATE_LIMIT_BURST=${RATE_LIMIT_BURST} ENV TEST_HEADER=${TEST_HEADER} -ENV TEST1=${TEST1} -ENV TEST2=${TEST2} WORKDIR /code RUN pip install -U pip setuptools wheel @@ -32,10 +28,5 @@ COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt EXPOSE 80 COPY ./app /code/app - -RUN echo REDIS_PW: $REDIS_PW -RUN echo TEST1: $TEST1 -RUN echo TEST2: $TEST2 - RUN PYTHONPATH=/code/. python /code/./app/data/scripts/get_prod_data.py CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] diff --git a/app/data/scripts/get_prod_data.py b/app/data/scripts/get_prod_data.py index 7b0edb0..a62d1f8 100644 --- a/app/data/scripts/get_prod_data.py +++ b/app/data/scripts/get_prod_data.py @@ -11,7 +11,7 @@ def get_prod_data() -> Result[None]: result = bootstrap_unicode_data() if result.failure or not result.value: - return Result.Fail(result.error if result.error else "") + return Result.Fail(result.error or "") settings = result.value logger = logging.getLogger("app.api") diff --git a/docker-bake.hcl b/docker-bake.hcl index aa2b7e5..7c6ef30 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -6,12 +6,8 @@ variable "REDIS_PW" { default = "" } -variable "TEST1" { - default = "NOT_SECRET1" -} - -variable "TEST2" { - default = "NOT_SECRET2" +variable "UNICODE_VERSION" { + default = "" } target "unicode-api" { @@ -19,16 +15,14 @@ target "unicode-api" { tags = ["ghcr.io/a-luna/unicode-api:${GITHUB_SHA}"] args = { ENV="PROD" - UNICODE_VERSION="14.0.0" + UNICODE_VERSION="${UNICODE_VERSION}" REDIS_HOST="dokku-redis-vig-cache" REDIS_PORT="6379" REDIS_DB="1" REDIS_PW="${REDIS_PW}" - RATE_LIMIT_PER_PERIOD="45" - RATE_LIMIT_PERIOD_SECONDS="55" - RATE_LIMIT_BURST="5" + RATE_LIMIT_PER_PERIOD="50" + RATE_LIMIT_PERIOD_SECONDS="60" + RATE_LIMIT_BURST="10" TEST_HEADER="X-UnicodeAPI-Test" - TEST1="${TEST1}" - TEST2="${TEST2}" } }