Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy Batch Aggregation to Production #789

Merged
merged 3 commits into from
Jul 2, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Deploy to Production

on:
push:
branches:
- master
tags:
- production-release
workflow_dispatch:

jobs:
Expand All @@ -21,7 +21,7 @@ jobs:
uses: zooniverse/ci-cd/.github/workflows/deploy_app.yaml@main
needs: build_and_push_image
with:
app_name: aggregation-caesar
app_name: aggregation
repo_name: aggregation-for-caesar
commit_id: ${{ github.sha }}
environment: production
Expand All @@ -38,7 +38,7 @@ jobs:
commit_id: ${{ github.sha }}
job_name: Deploy to Production / deploy_app
status: ${{ needs.deploy_production.result }}
title: "Aggregation deploy complete"
title: "Aggregation Production deploy complete"
title_link: "https://aggregation-caesar.zooniverse.org"
secrets:
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
44 changes: 44 additions & 0 deletions .github/workflows/deploy_staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy to Staging

on:
push:
branches:
- master
workflow_dispatch:

jobs:
build_and_push_image:
name: Build and Push Image
uses: zooniverse/ci-cd/.github/workflows/build_and_push_image.yaml@main
with:
repo_name: aggregation-for-caesar
commit_id: ${{ github.sha }}
latest: true
build_args: "REVISION=${{ github.sha }}"

deploy_staging:
name: Deploy to Staging
uses: zooniverse/ci-cd/.github/workflows/deploy_app.yaml@main
needs: build_and_push_image
with:
app_name: aggregation
repo_name: aggregation-for-caesar
commit_id: ${{ github.sha }}
environment: staging
deploy_check: false
secrets:
creds: ${{ secrets.AZURE_AKS }}

slack_notification:
name: Slack notification
uses: zooniverse/ci-cd/.github/workflows/slack_notification.yaml@main
needs: deploy_staging
if: always()
with:
commit_id: ${{ github.sha }}
job_name: Deploy to Staging / deploy_app
status: ${{ needs.deploy_staging.result }}
title: "Aggregation Staging deploy complete"
title_link: "https://aggregation-staging.zooniverse.org"
secrets:
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
15 changes: 14 additions & 1 deletion .github/workflows/python-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ on:
jobs:
build:
runs-on: ubuntu-latest
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
Expand All @@ -30,11 +40,14 @@ jobs:
- name: Run tests
env:
TRAVIS: true # one test is skipped on CI and looks for this env value
REDIS_HOST: redis
CELERY_BROKER_URL: redis://localhost:6379/0
CELERY_RESULT_BACKEND: redis://localhost:6379/0
run: |
coverage run
coverage report
- name: Coveralls
if: ${{ matrix.python-version == 3.10 }}
env:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --service=github
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,5 @@ endpoints.yml

.vscode/
.noseids
tmp/*
.DS_Store
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ COPY . .
RUN pip install -U .[online,test,doc]

# make documentation
RUN /bin/bash -lc ./make_docs.sh
RUN /bin/bash -lc ./scripts/make_docs.sh

ADD ./ /usr/src/aggregation

ARG REVISION=''
ENV REVISION=$REVISION

# load configs and start flask app
CMD ["bash", "./start-flask.sh"]
CMD ["bash", "./scripts/start-flask.sh"]
51 changes: 47 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,62 @@
version: '2'
version: '3'
services:
aggregation:
build:
context: ./
args:
REVISION: fake-git-sha-id
image: aggregation-for-caesar:local
volumes:
- ./panoptes_aggregation:/usr/src/aggregation/panoptes_aggregation
- ./:/usr/src/aggregation
- ~/.aws:/root/.aws
environment:
- AWS_REGION=${AWS_REGION}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN}
- AWS_SECURITY_TOKEN=${AWS_SECURITY_TOKEN}
- LISTEN_PORT=5000
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- FLASK_DEBUG=1
- FLASK_ENV=development
- LISTEN_PORT=4000
ports:
- "5000:5000"
- "4000:4000"
links:
- redis:redis

worker:
image: aggregation-for-caesar:local
command: celery --app panoptes_aggregation.batch_aggregation.celery worker --loglevel=info
volumes:
- ./:/usr/src/aggregation
environment:
- FLASK_DEBUG=1
- APP_SETTINGS=project.server.config.DevelopmentConfig
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- FLASK_ENV=development
links:
- redis:redis
depends_on:
- redis

dashboard:
image: aggregation-for-caesar:local
command: celery --app panoptes_aggregation.batch_aggregation.celery flower --port=5555 --broker=redis://redis:6379/0
ports:
- 5556:5555
environment:
- FLASK_DEBUG=1
- APP_SETTINGS=project.server.config.DevelopmentConfig
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
links:
- redis:redis
depends_on:
- redis
- worker

redis:
image: redis
command: redis-server --appendonly yes
Loading