Skip to content

Commit 094704c

Browse files
authored
Merge pull request #29 from OpenHistoricalMap/202507-upstream-catchup
202507 upstream catchup
2 parents a608571 + 2b2f693 commit 094704c

492 files changed

Lines changed: 52032 additions & 23972 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 0 additions & 510 deletions
This file was deleted.

.circleci/rdsid.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

.flaskenv

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/add-version-to-db.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ jobs:
66
add_release:
77
runs-on: ubuntu-latest
88
steps:
9-
- name: Add release version to db
10-
run: |
11-
curl -X POST "https://tasking-manager-tm4-production-api.hotosm.org/api/v2/system/release/"
9+
- name: Add release version to db
10+
run: |
11+
curl -X POST "https://tasking-manager-production-api.hotosm.org/api/v2/system/release/"
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build and Deploy Backend to ECS
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- staging
8+
- develop
9+
paths:
10+
- "backend/**"
11+
workflow_dispatch:
12+
13+
env:
14+
# NOTE: You can override these variables in the workflow file with GitHub Variables
15+
# vars.TEAM is team name here in case you want to deploy for different team. Default is hotosm
16+
# vars.INFRA_ENVIRONMENT is environment name here in case you have applied infrastructue with different environment name. Default is github.ref_name
17+
18+
AWS_REGION: ${{ vars.AWS_REGION || 'us-east-1' }}
19+
OIDC_ROLE_ARN: ${{ secrets.AWS_OIDC_ROLE_ARN }}
20+
ECS_CLUSTER: tasking-manager-${{ vars.INFRA_ENVIRONMENT || github.ref_name }}-cluster
21+
TASK_DEFINITION_PREFIX: tasking-manager-${{ vars.TEAM || 'hotosm' }}-${{ vars.INFRA_ENVIRONMENT || github.ref_name }}
22+
ECS_SERVICE_PREFIX: tasking-manager-${{ vars.TEAM || 'hotosm' }}-${{ vars.INFRA_ENVIRONMENT || github.ref_name }}
23+
CONTAINER_NAME_PREFIX: tasking-manager-${{ vars.TEAM || 'hotosm' }}-${{ vars.INFRA_ENVIRONMENT || github.ref_name }}
24+
25+
jobs:
26+
image-build-and-push:
27+
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.5.1
28+
with:
29+
image_name: ghcr.io/${{ github.repository }}/backend
30+
build_target: prod
31+
dockerfile: scripts/docker/Dockerfile
32+
image_tags: |
33+
ghcr.io/${{ vars.IMAGE_NAME || 'hotosm/tasking-manager/backend' }}:${{ github.ref_name }}
34+
ghcr.io/${{ vars.IMAGE_NAME || 'hotosm/tasking-manager/backend' }}:${{ github.sha }}
35+
36+
deploy-service:
37+
name: Deploy ${{ matrix.service }} to ECS
38+
runs-on: ubuntu-latest
39+
environment: ${{ github.ref_name }}
40+
needs: image-build-and-push
41+
permissions:
42+
contents: read
43+
id-token: write
44+
45+
strategy:
46+
matrix:
47+
service: [fastapi, cron]
48+
fail-fast: false
49+
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- name: Configure AWS credentials
54+
uses: aws-actions/configure-aws-credentials@v4
55+
with:
56+
aws-region: ${{ env.AWS_REGION }}
57+
role-to-assume: ${{ env.OIDC_ROLE_ARN }}
58+
role-session-name: gh-ci-ecs-deploy-${{ github.ref_name }}-${{ matrix.service }}
59+
60+
- name: Download task definition
61+
run: |
62+
aws ecs describe-task-definition --region ${{ env.AWS_REGION }} \
63+
--task-definition ${{ env.TASK_DEFINITION_PREFIX }}-${{ matrix.service }} \
64+
--query taskDefinition > task-definition.json
65+
66+
- name: Task definition rendition
67+
id: task-def
68+
uses: aws-actions/amazon-ecs-render-task-definition@v1
69+
with:
70+
task-definition: task-definition.json
71+
container-name: ${{ env.CONTAINER_NAME_PREFIX }}-${{ matrix.service }}
72+
image: ghcr.io/${{ vars.IMAGE_NAME || 'hotosm/tasking-manager/backend' }}:${{ github.sha }}
73+
74+
- name: Deploy task definition for ${{ matrix.service }}
75+
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
76+
with:
77+
task-definition: ${{ steps.task-def.outputs.task-definition }}
78+
service: ${{ env.ECS_SERVICE_PREFIX }}-${{ matrix.service }}
79+
cluster: ${{ env.ECS_CLUSTER }}
80+
wait-for-service-stability: true

.github/workflows/build_ci_img.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 🔧 Build CI Img
2+
3+
on:
4+
# Push includes PR merge
5+
push:
6+
branches:
7+
- main
8+
- staging
9+
- development
10+
paths:
11+
# Workflow is triggered only if deps change
12+
- "src/backend/pyproject.toml"
13+
- "src/backend/Dockerfile"
14+
# Allow manual trigger
15+
workflow_dispatch:
16+
17+
jobs:
18+
backend-ci-build:
19+
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@3.2.0
20+
with:
21+
context: .
22+
build_target: ci
23+
image_tags: |
24+
"ghcr.io/${{ github.repository }}/backend:ci-${{ github.ref_name }}"
25+
26+
invalidate-cache:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Delete CI Img Cache
30+
env:
31+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
gh extension install actions/gh-actions-cache
34+
gh actions-cache delete image-cache-${{ runner.os }} \
35+
-R ${{ github.repository }} \
36+
-B ${{ github.ref_name }} \
37+
--confirm || true

.github/workflows/container-image.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/docker-image-push.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 📖 Publish Docs
2+
3+
on:
4+
push:
5+
paths:
6+
- docs/**
7+
- src/**
8+
- mkdocs.yml
9+
branches:
10+
- develop
11+
workflow_dispatch:
12+
13+
jobs:
14+
# TODO need to also publish osm-fieldwork docs somewhere...
15+
16+
build_doxygen:
17+
uses: hotosm/gh-workflows/.github/workflows/doxygen_build.yml@3.2.0
18+
with:
19+
output_path: docs/apidocs
20+
21+
build_openapi_json:
22+
uses: hotosm/gh-workflows/.github/workflows/openapi_build.yml@3.2.1
23+
with:
24+
image: ghcr.io/${{ github.repository }}/backend:ci-${{ github.ref_name }}
25+
example_env_file_path: "example.env"
26+
output_path: docs/openapi.json
27+
py_backend_app_context: backend.main
28+
29+
publish_docs:
30+
uses: hotosm/gh-workflows/.github/workflows/mkdocs_build.yml@3.2.0
31+
needs:
32+
- build_doxygen
33+
- build_openapi_json
34+
with:
35+
doxygen: true
36+
openapi: true

.github/workflows/ecs-deploy.yml

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)