Skip to content

Commit

Permalink
Merge pull request #65 from unicef/staging
Browse files Browse the repository at this point in the history
master
  • Loading branch information
domdinicola authored Nov 4, 2024
2 parents 62a65e1 + 1510a9e commit b3db406
Show file tree
Hide file tree
Showing 54 changed files with 1,120 additions and 825 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run Trivy vulnerability scanner
continue-on-error: true # due to getting TOOMANYREQUESTS
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ vars.DOCKERHUB_ORGANIZATION }}/hope-support-images:country-report-${{ github.sha }}'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ pdm.toml
.envrc
.pdm-python
.tox/
.idea/
2 changes: 1 addition & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.11
python_version = 3.12
files = src/hope_country_report
;exclude = ~OLD
; ~management
Expand Down
36 changes: 18 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,54 +38,54 @@ repos:
entry: mypy
language: python
types: [ python ]
stages: [ commit ]
stages: [ pre-commit ]
additional_dependencies: [mypy]

- repo: https://github.com/Yelp/detect-secrets
rev: 0.9.1
rev: v1.5.0
hooks:
- id: detect-secrets
args: [ '--baseline', '.secrets.baseline' ]
exclude: (tests/.*|.*/tenant\.sql|Pipfile\.lock|.*\.js|.gitlab-ci.yml|poetry.lock)
stages: [ push ]
stages: [ pre-push ]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
rev: v5.0.0
hooks:
# - id: double-quote-string-fixer
# stages: [commit]

- id: debug-statements
stages: [ commit ]
stages: [ pre-commit ]

- id: end-of-file-fixer
exclude: .bumpversion.cfg
stages: [ commit ]
stages: [ pre-commit ]

- id: check-merge-conflict
stages: [ commit ]
stages: [ pre-commit ]

- id: check-case-conflict
stages: [ commit ]
stages: [ pre-commit ]

- repo: https://github.com/saxix/pch
rev: fc387f4
rev: '0.1'
hooks:
- id: check-missed-migrations
args:
- src
stages: [ commit ]
stages: [ pre-commit ]

- id: check-untracked
args:
- src
- tests
stages: [ push ]
stages: [ pre-push ]

- id: check-forbidden
args:
- -p
- /\.showbrowser\(/
- -p
- /print\(111/
stages: [ commit ]
# - id: check-forbidden
# args:
# - -p
# - /\.showbrowser\(/
# - -p
# - /print\(111/
# stages: [ pre-commit ]
#
21 changes: 4 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
Copyright (c) 2014 - 2024 UNICEF. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License below for more details.

------------------------------------------------------------------------
GNU AFFERO GENERAL PUBLIC LICENSE
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -656,7 +643,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -671,4 +658,4 @@ specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ABOUT HOPE Country Report

### System Requirements

- python 3.11
- python 3.12
- [direnv](https://direnv.net/) - not mandatory but strongly recommended
- [pdm](https://pdm.fming.dev/2.9/)

Expand All @@ -23,7 +23,7 @@ ABOUT HOPE Country Report

### 1. Clone repo and install requirements
git clone https://github.com/unicef/hope-country-report
pdm venv create 3.11
pdm venv create 3.12
pdm install
pdm venv activate in-project
pre-commit install
Expand Down
1 change: 1 addition & 0 deletions compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ services:
- CACHE_URL=redis://redis:6379/1
- AZURE_TENANT_ID=
- AZURE_CLIENT_KEY=
- FLOWER_URL=http://flower:5555
depends_on:
db:
condition: service_healthy
Expand Down
23 changes: 23 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,23 @@ x-django-env: &django-env
- REDIS_URL=redis://redis:6379/0
- ALLOWED_HOSTS=backend,localhost
- STATIC_ROOT=/
- CACHE_URL=redis://redis:6379/1
- STATIC_URL=/static/
- EMAIL_BACKEND=
- EMAIL_HOST=
- EMAIL_PORT=
- EMAIL_USE_TLS=
- EMAIL_USE_SSL=
- SENTRY_ENVIRONMENT=local
- CELERY_BROKER_URL=redis://redis:6379/0
- MAILJET_API_KEY=
- MAILJET_SECRET_KEY=
- WP_PRIVATE_KEY=
- SECURE_SSL_REDIRECT=False
- AZURE_TENANT_ID=
- AZURE_CLIENT_KEY=
- FLOWER_URL=http://flower:5555
- FILE_STORAGE_DEFAULT=django.core.files.storage.FileSystemStorage

services:
backend:
Expand Down Expand Up @@ -125,3 +129,22 @@ services:
condition: service_healthy
redis:
condition: service_healthy

flower:
build:
context: .
dockerfile: docker/Dockerfile
target: dev
command: celery_flower
environment: *django-env
restart: unless-stopped
ports:
- 5555:5555
depends_on:
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://flower:5555/"]
interval: 10s
timeout: 5s
retries: 5
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-slim-bookworm as base
FROM python:3.12-slim-bookworm as base

RUN apt update \
&& apt install --no-install-recommends -y \
Expand All @@ -13,7 +13,7 @@ RUN apt update \
&& chown -R hcr:hcr /code /tmp /data /static

ENV PACKAGES_DIR=/packages
ENV PYPACKAGES=$PACKAGES_DIR/__pypackages__/3.11
ENV PYPACKAGES=$PACKAGES_DIR/__pypackages__/3.12
ENV LIB_DIR=$PYPACKAGES/lib
ENV PYTHONPATH=$PYTHONPATH:$LIB_DIR:/code/src
ENV PATH=$PATH:$PYPACKAGES/bin
Expand All @@ -23,7 +23,7 @@ WORKDIR /code
FROM base as builder

WORKDIR $PACKAGES_DIR
RUN pip install pdm
RUN pip install pdm setuptools
COPY ../pyproject.toml ./
COPY ../pdm.lock ./
RUN pdm config python.use_venv false
Expand Down
3 changes: 3 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ case "$1" in
celery_beat)
celery -A hope_country_report.config.celery beat -l info
;;
celery_flower)
celery -A hope_country_report.config.celery flower
;;
*)
exec "$@"
;;
Expand Down
Loading

0 comments on commit b3db406

Please sign in to comment.