/covidX

covidX. Rapid Pandemic Task Mgmt Portal

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

covidX

TL;DR Dive into coding right away by clicking here:

Open in Gitpod

Codacy Badge

DeepSource

CI

Open Source Helpers

We are an open community of volunteers without a commercial purpose. We believe that through a utilitarian approach, we can do the most good in the quickest time. Applying unused engineering we can help the world cope with the threat of COVID-19.

Python Version

covidX will be run on python 3.7.6 and 3.8.5

Required Services for Self-Hosting

The following steps are necessary in order to ensure that you are able to self-host your own instance of the project smoothly:

How to Run Locally Using Docker

docker run --rm -it -e SECRET_KEY=<YOUR_DJANGO_SECRET_KEY> -e DEBUG_ENV=1 -e CPPFLAGS="$(pg_config --cppflags)" -e LDFLAGS="$(pg_config --ldflags)" -e SECRET_ID="SECRET_KEY" -e BUCKET_NAME="gae-bizlead" -e DJANGO_SETTINGS_MODULE="covidX.settings" -e WSGI_APPLICATION="covidX.wsgi.application" --security-opt apparmor=unconfined codecakes/covidx_manage:bazel runserver_plus

For local development YOUR_DJANGO_SECRET_KEY can be an alphanumeric string of your choosing.

How to Setup for Development

Setup a virtualenv and run:

CPPFLAGS="$(pg_config --cppflags)" LDFLAGS="$(pg_config --ldflags)" python3 -m pip install -r requirements.txt 

How to Build

No Docker: Local Machine Developer Setup

FIRST SEE HERE: https://forum.mycovidconnect.com/d/14-how-to-contribute-backenddjangopython-devs

Then,

  • Clone this git repo. SECRET_KEY and DEBUG env vars are in settings.py.
  • Pre-requisites:
export DEBUG_ENV=1
export SECRET_KEY=<YOUR_SECRET>
CPPFLAGS="$(pg_config --cppflags)"
LDFLAGS="$(pg_config --ldflags)"
  • and then build like:
bazel build :manage --watchfs --spawn_strategy=standalone --copt --aspects=@bazel_tools//tools/python:srcs_version.bzl%find_requirements --verbose_failures=true --show_timestamps=true --python_version=PY3 --build_python_zip --sandbox_debug --color=yes --curses=yes --jobs=20 --loading_phase_threads=HOST_CPUS --action_env=LDFLAGS --action_env=CPPFLAGS --action_env=DEBUG_ENV --action_env=SECRET_KEY
  • Collectstatic
bazel run -s :manage --watchfs --spawn_strategy=standalone --copt --aspects=@bazel_tools//tools/python:srcs_version.bzl%find_requirements --verbose_failures=true --show_timestamps=true --python_version=PY3 --build_python_zip --sandbox_debug --color=yes --curses=yes --jobs=200 --loading_phase_threads=HOST_CPUS --action_env=LDFLAGS --action_env=CPPFLAGS --action_env=DEBUG_ENV --action_env=SECRET_KEY -- collectstatic
  • Then Run it like:

With Debug Mode:

DEBUG_ENV=1 SECRET_KEY=dskaj343 CPPFLAGS="$(pg_config --cppflags)" LDFLAGS="$(pg_config --ldflags)" bazel run :manage --watchfs --spawn_strategy=standalone --copt --aspects=@bazel_tools//tools/python:srcs_version.bzl%find_requirements --verbose_failures=true --show_timestamps=true --python_version=PY3 --build_python_zip --sandbox_debug --color=yes --curses=yes --jobs=2000 --loading_phase_threads=HOST_CPUS --action_env=LDFLAGS --action_env=CPPFLAGS --action_env=DEBUG_ENV --action_env=SECRET_KEY -- runserver_plus 0.0.0.0:8000

Without Debug Mode:

bazel run :manage --watchfs --spawn_strategy=standalone --copt --aspects=@bazel_tools//tools/python:srcs_version.bzl%find_requirements --verbose_failures=true --show_timestamps=true --python_version=PY3 --build_python_zip --sandbox_debug --color=yes --curses=yes --jobs=20 --loading_phase_threads=HOST_CPUS --action_env=LDFLAGS --action_env=CPPFLAGS --action_env=DEBUG_ENV --action_env=SECRET_KEY -- runserver_plus

Create Docker Image: Local Machine Developer Setup

Make sure to follow the steps above. Then follow these steps:

  • Create a local docker bazel image
PULLER_TIMEOUT=3600 DOCKER_REPO_CACHE=$(pwd)/docker_repo_cache DEBUG_ENV=1 CPPFLAGS="$(pg_config --cppflags)" LDFLAGS="$(pg_config --ldflags)" SECRET_ID="SECRET_KEY" BUCKET_NAME="gae-bizlead" DJANGO_SETTINGS_MODULE="covidX.settings" WSGI_APPLICATION="covidX.wsgi.application" bazel run --watchfs --spawn_strategy=standalone --copt --aspects=@bazel_tools//tools/python:srcs_version.bzl%find_requirements --verbose_failures=true --show_timestamps=true --python_version=PY3 --build_python_zip --sandbox_debug --color=yes --curses=yes --jobs=2000 --loading_phase_threads=HOST_CPUS --action_env=LDFLAGS="$(pg_config --ldflags)" --action_env=CPPFLAGS="$(pg_config --cppflags)" --force_python=py3 --incompatible_use_python_toolchains=false  --loading_phase_threads=1 --http_timeout_scaling=2 :covidx_manage
  • Run bazel image using docker
docker run --rm -it -e SECRET_KEY=<YOUR_SECRET_KEY> -e DEBUG_ENV=1 -e CPPFLAGS="$(pg_config --cppflags)" -e LDFLAGS="$(pg_config --ldflags)" -e SECRET_ID="SECRET_KEY" -e DJANGO_SETTINGS_MODULE="covidX.settings" -e WSGI_APPLICATION="covidX.wsgi.application" --security-opt apparmor=unconfined bazel:covidx_manage runserver_plus

This should set you up for local development.

Installing Developer Packages

Setup a virtualenv and run:

python3 -m pip install -r requirements_dev.txt 

Google Cloud Deployment

DEPLOY like:

Enable following options on GAE:

gcloud app deploy app.yaml --verbosity=debug --stop-previous-version

Common Issues:

TODO/TBA:

How to contribute. Coming soon.
Project Roadmap

Credits

@codecakes