-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CU-86bze09vt Move vectorizing to new clusters (#53)
* Update Dockerfile and remove AWS AK/SAK * Update deployment workflow * Minor modification to the deploy workflow * Add region_name to the client * Upgrade boto3 * Update port * Undo temp changes
- Loading branch information
Showing
15 changed files
with
583 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
### Python template | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# poetry | ||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. | ||
# This is especially recommended for binary packages to ensure reproducibility, and is more | ||
# commonly ignored for libraries. | ||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control | ||
#poetry.lock | ||
|
||
# pdm | ||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. | ||
#pdm.lock | ||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it | ||
# in version control. | ||
# https://pdm.fming.dev/#use-with-ide | ||
.pdm.toml | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# PyCharm | ||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can | ||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore | ||
# and can be added to the global gitignore or merged into this file. For a more nuclear | ||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. | ||
.idea/ | ||
|
||
# Other files | ||
heroku.yml | ||
docker-compose.yml | ||
.pre-commit-config.yaml | ||
.vscode/ | ||
.gitignore | ||
.github/ | ||
.devcontainer/ | ||
.env.example | ||
LICENSE | ||
README.md | ||
Dockerfile | ||
.dockerignore | ||
.git/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,15 @@ | ||
name: deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- production | ||
- main | ||
- | ||
jobs: | ||
publish-docker-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-central-1 | ||
- name: Publish the Docker image | ||
run: | | ||
docker build . --tag ghcr.io/kittl/vectorizing:${{ github.ref_name }} | ||
docker push ghcr.io/kittl/vectorizing:${{ github.ref_name }} | ||
- name: Deploy vectorizing in staging cluster | ||
uses: kodermax/kubectl-aws-eks@main | ||
env: | ||
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG }} | ||
if: github.ref_name == 'main' | ||
with: | ||
args: rollout restart deployment/vectorizing --context staging | ||
- name: Deploy vectorizing in production cluster | ||
uses: kodermax/kubectl-aws-eks@main | ||
env: | ||
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG }} | ||
if: github.ref_name == 'production' | ||
with: | ||
args: rollout restart deployment/vectorizing --context production | ||
deploy-py-server-argo: | ||
name: Deploy PY server Argo | ||
uses: ./.github/workflows/helpers-deploy-argo.yaml | ||
secrets: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
ECR_ROLE_ARN: ${{ github.ref == 'refs/heads/production' && secrets.PRODUCTION_ECR_ROLE_ARN || secrets.STAGING_ECR_ROLE_ARN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# This callable workflow builds and publish a package docker image | ||
|
||
name: helpers-build-docker-image | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
aws-region: | ||
default: eu-central-1 | ||
description: The AWS region to use for ECR | ||
required: false | ||
type: string | ||
docker_file_path: | ||
description: > | ||
"The path to the Dockerfile to use for building the image. For example: | ||
`path/to/project/Dockerfile`" | ||
type: string | ||
required: true | ||
extra-image-tags: | ||
default: '' | ||
description: Extra tags to use for the image (one per line) | ||
required: false | ||
type: string | ||
platforms: | ||
default: linux/amd64 | ||
description: The platforms to build for | ||
required: false | ||
type: string | ||
secrets: | ||
ECR_ROLE_ARN: | ||
description: The ECR role ARN | ||
required: true | ||
outputs: | ||
image-tag: | ||
description: The docker image tag | ||
value: ${{ jobs.build.outputs.image-tag }} | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
packages: read | ||
|
||
jobs: | ||
build: | ||
name: Build docker image and push to ECR | ||
runs-on: ubuntu-latest | ||
outputs: | ||
image-tag: ${{ steps.get-image-tag.outputs.image-tag }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: ${{ inputs.aws-region }} | ||
role-to-assume: ${{ secrets.ECR_ROLE_ARN }} | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
- name: Get image tag output | ||
shell: bash | ||
id: get-image-tag | ||
run: echo "image-tag=sha-${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT | ||
- name: Docker meta tags | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
flavor: | | ||
latest=false | ||
images: | | ||
${{ format('{0}/{1}', steps.login-ecr.outputs.registry, github.event.repository.name) }} | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=sha | ||
${{ inputs.extra-image-tags }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
context: . | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: ${{ inputs.platforms }} | ||
provenance: false | ||
push: true | ||
file: ${{ inputs.docker_file_path }} |
Oops, something went wrong.