Skip to content

Commit

Permalink
Merge pull request #6570 from hotosm/develop
Browse files Browse the repository at this point in the history
v4.8.1 Latest changes to staging
  • Loading branch information
ramyaragupathy authored Sep 23, 2024
2 parents 05877fb + cae8fb4 commit 4eedc20
Show file tree
Hide file tree
Showing 90 changed files with 5,305 additions and 2,318 deletions.
18 changes: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- run: sudo apt-get update
- run: sudo apt-get -y install libgeos-dev # Required for shapely
- run: sudo apt-get -y install proj-bin libproj-dev
- run: pip install --upgrade pip pdm==2.7.4
- run: pip install --upgrade pip pdm==2.18.1
- run: pdm export --dev --without-hashes > requirements.txt
- run: pip install -r requirements.txt
- run: mkdir --mode 766 -p /tmp/logs
Expand Down Expand Up @@ -294,7 +294,7 @@ workflows:
name: Deploy backend production
gitsha: $CIRCLE_SHA1
stack_name: "tm4-production"
host_ami: "ami-01e5ff16fd6e8c542"
host_ami: "/aws/service/canonical/ubuntu/server/20.04/stable/current/amd64/hvm/ebs-gp2/ami-id"
backend_instance_type: c6a.large
pg_version: "13.10"
pg_param_group: "default.postgres13"
Expand Down Expand Up @@ -357,7 +357,7 @@ workflows:
name: Deploy backend production
gitsha: $CIRCLE_SHA1
stack_name: "tm4-production"
host_ami: "ami-01e5ff16fd6e8c542"
host_ami: "/aws/service/canonical/ubuntu/server/20.04/stable/current/amd64/hvm/ebs-gp2/ami-id"
backend_instance_type: c6a.large
pg_version: "13.10"
pg_param_group: "default.postgres13"
Expand All @@ -384,7 +384,7 @@ workflows:
name: Deploy TeachOSM Backend
gitsha: $CIRCLECI_SHA1
stack_name: "teachosm"
host_ami: "ami-01e5ff16fd6e8c542"
host_ami: "/aws/service/canonical/ubuntu/server/20.04/stable/current/amd64/hvm/ebs-gp2/ami-id"
requires:
- backend-functional-tests
context: tasking-manager-teachosm
Expand Down Expand Up @@ -422,7 +422,7 @@ workflows:
name: Deploy staging backend
gitsha: $CIRCLE_SHA1
stack_name: "staging"
host_ami: "ami-01e5ff16fd6e8c542"
host_ami: "/aws/service/canonical/ubuntu/server/20.04/stable/current/amd64/hvm/ebs-gp2/ami-id"
pg_version: "14.8"
pg_param_group: "default.postgres14"
db_instance_type: "db.t4g.small"
Expand Down Expand Up @@ -452,8 +452,8 @@ workflows:
pattern: "^deployment/.*"
value: << pipeline.git.branch >>
- or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ fix/febdeployment, << pipeline.git.branch >> ] # change this to the branch you wish to test
## - equal: [ develop, << pipeline.git.branch >> ] # Disabled while we use dev setup for e2e testing
- equal: [ dev-switch-to-sandbox, << pipeline.git.branch >> ]
jobs:
- database-backup:
name: Backup development database
Expand All @@ -473,8 +473,8 @@ workflows:
name: Deploy development backend
gitsha: $CIRCLE_SHA1
stack_name: "dev"
host_ami: "ami-01e5ff16fd6e8c542"
pg_version: "14.8"
host_ami: "/aws/service/canonical/ubuntu/server/20.04/stable/current/amd64/hvm/ebs-gp2/ami-id"
pg_version: "14.10"
pg_param_group: "default.postgres14"
db_instance_type: "db.t4g.small"
backend_instance_type: "t3.medium"
Expand Down
58 changes: 11 additions & 47 deletions .github/workflows/docker-image-push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#
name: Build & publish TM backend container image

on:
Expand All @@ -18,50 +17,15 @@ on:
- deployment/container-tasking-manager


env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}


jobs:
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

tags: |
type=ref,event=pr
type=ref,event=tag
type=ref,event=branch
type=semver,pattern=raw
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v5.1.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
backend-build:
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.5.1
with:
image_name: ghcr.io/${{ github.repository }}/backend
build_target: prod

# frontend-build:
# uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.5.1
# with:
# image_name: ghcr.io/${{ github.repository }}/backend
# dockerfile: scripts/docker/Dockerfile.frontend
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ repos:

# Versioning: Commit messages & changelog
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.13.0
rev: v3.29.0
hooks:
- id: commitizen
stages: [commit-msg]

# Lint / autoformat: Python code
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: "v0.4.2"
rev: "v0.6.4"
hooks:
# Run the linter
- id: ruff
Expand Down
26 changes: 15 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
ARG DEBIAN_IMG_TAG=slim-bookworm
ARG PYTHON_IMG_TAG=3.10



FROM docker.io/python:${PYTHON_IMG_TAG}-${DEBIAN_IMG_TAG} as base
ARG APP_VERSION=0.1.0
ARG DOCKERFILE_VERSION=0.5.0
ARG ALPINE_IMG_TAG
ARG DEBIAN_IMG_TAG
ARG PYTHON_IMG_TAG
ARG MAINTAINER=sysadmin@hotosm.org
LABEL org.hotosm.tasks.app-version="${APP_VERSION}" \
Expand All @@ -25,7 +28,7 @@ FROM base as extract-deps
RUN pip install --no-cache-dir --upgrade pip
WORKDIR /opt/python
COPY pyproject.toml pdm.lock README.md /opt/python/
RUN pip install --no-cache-dir pdm==2.7.4
RUN pip install --no-cache-dir pdm==2.18.1
RUN pdm export --prod --without-hashes > requirements.txt


Expand All @@ -34,13 +37,13 @@ FROM base as build
RUN pip install --no-cache-dir --upgrade pip
WORKDIR /opt/python
# Setup backend build-time dependencies
RUN apt-get update
RUN apt-get install --no-install-recommends -y build-essential
RUN apt-get install --no-install-recommends -y \
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
libffi-dev \
libgeos-dev \
postgresql-server-dev-15 \
python3-dev \
libffi-dev \
libgeos-dev
&& rm -rf /var/lib/apt/lists/*
# Setup backend Python dependencies
COPY --from=extract-deps \
/opt/python/requirements.txt /opt/python/
Expand All @@ -63,8 +66,8 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
# Setup backend runtime dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y \
postgresql-client libgeos3.11.1 proj-bin && \
apt-get clean && rm -rf /var/lib/apt/lists/*
libgeos3.11.1 postgresql-client proj-bin && \
rm -rf /var/lib/apt/lists/*
COPY --from=build \
/home/appuser/.local \
/home/appuser/.local
Expand All @@ -79,7 +82,7 @@ COPY manage.py .

FROM runtime as debug
RUN pip install --user --no-warn-script-location \
--no-cache-dir debugpy==1.6.7
--no-cache-dir debugpy==1.8.5
EXPOSE 5678/tcp
CMD ["python", "-m", "debugpy", "--wait-for-client", "--listen", "0.0.0.0:5678", \
"-m", "gunicorn", "-c", "python:backend.gunicorn", "manage:application", \
Expand All @@ -91,12 +94,13 @@ FROM runtime as prod
USER root
RUN apt-get update && \
apt-get install -y curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Pre-compile packages to .pyc (init speed gains)
RUN python -c "import compileall; compileall.compile_path(maxlevels=10, quiet=1)"
RUN python -m compileall .
EXPOSE 5000/tcp
USER appuser:appuser
# Default gunicorn worker count is 1
# For prod the WEB_CONCURRENCY env var can be used to set this
CMD ["gunicorn", "-c", "python:backend.gunicorn", "manage:application", \
"--workers", "1", "--log-level", "error"]
"--log-level", "error"]
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,27 @@ This is Free and Open Source Software. You are welcome to use the code and set u
* Read the monthly update blogs on [OSM Discourse](https://community.openstreetmap.org/c/general/38/all).

## Product Roadmap
We have included below a [high level roadmap/plan](https://github.com/orgs/hotosm/projects/28/) [subject to change] that can be used as an overview.



Status | Feature
-------|---------
✅ | Up-to-date OSM Statistics: Integrated with [ohsome Now](https://stats.now.ohsome.org/) for real-time data insights. Released in [v4.6.2](https://github.com/hotosm/tasking-manager/releases/tag/v4.6.2).
✅ | Downloadable OSM Exports: Export data directly from each project. Available in[ v4.7.0](https://github.com/hotosm/tasking-manager/releases/tag/v4.7.0).
✅ | Live Data Quality Monitoring: Monitor project data quality in real-time. Introduced in [v4.7.2](https://github.com/hotosm/tasking-manager/releases/tag/v4.7.2).
✅ | Rapid Editor Upgrade: Enhanced mapping experience with the latest rapid editor updates.
✅ | Public-Facing Partner Pages: Create and display dedicated pages for partners running remote mapathons.
⚙️| Downloadable Project List View: Allow users to explore projects via a downloadable list. [View issue](https://github.com/hotosm/tasking-manager/issues/3394).
⚙️| MapSwipe Stats Integration: Display MapSwipe statistics on Partner Pages.
⚙️| iD Editor Latest Features: Integrate the newest features of the iD editor.
⚙️| FastAPI Migration: Improve performance and scalability of Tasking Manager to handle large scale validation and mapping efforts.
| | Latest Translations Update: Keep all content current with the latest translations.
| | OSM Practice Projects: Enable users to engage in OSM practice projects within Tasking Manager workflow.
| | Improved Project Sorting & Filtering: Enhance the user experience with better sorting and filtering options.
| | UI/UX Enhancements: Continuous improvements to the user interface and experience.





## Developers
Expand Down
23 changes: 23 additions & 0 deletions backend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ def add_api_endpoints(app):
)

from backend.api.projects.favorites import ProjectsFavoritesAPI
from backend.api.projects.partnerships import (
ProjectPartnershipsRestApi,
PartnersByProjectAPI,
)

# Tasks API import
from backend.api.tasks.resources import (
Expand Down Expand Up @@ -470,6 +474,25 @@ def add_api_endpoints(app):
ProjectsStatisticsQueriesPopularAPI, format_url("projects/queries/popular/")
)

api.add_resource(
ProjectPartnershipsRestApi,
format_url("projects/partnerships/<int:partnership_id>/"),
methods=["GET", "PATCH", "DELETE"],
)

api.add_resource(
ProjectPartnershipsRestApi,
format_url("projects/partnerships/"),
endpoint="create_partnership",
methods=["POST"],
)

api.add_resource(
PartnersByProjectAPI,
format_url("/projects/<int:project_id>/partners"),
methods=["GET"],
)

api.add_resource(
ProjectsTeamsAPI,
format_url("projects/<int:project_id>/teams/"),
Expand Down
Loading

0 comments on commit 4eedc20

Please sign in to comment.