Skip to content

UC-ITSC/CPDBv2_backend

This branch is 282 commits behind invinst/CPDBv2_backend:master.

Folders and files

NameName
Last commit message
Last commit date
Jul 1, 2020
Apr 19, 2016
Dec 9, 2019
Nov 2, 2018
Jul 6, 2020
Apr 1, 2020
Jul 8, 2020
Dec 12, 2019
Apr 24, 2020
Jun 9, 2020
Jul 3, 2019
May 6, 2020
Aug 1, 2018
Jan 31, 2019
Sep 11, 2018
Dec 9, 2019
Dec 24, 2018
Jan 15, 2020
Sep 28, 2018
Apr 24, 2020
Apr 4, 2017
Jul 6, 2020
Mar 2, 2020
Jan 31, 2019
Nov 26, 2018
Oct 17, 2019
Mar 2, 2020
Jul 3, 2019
Dec 28, 2018
Mar 2, 2020

Repository files navigation

CPDP API

Table of contents

Development

Getting Started

  • docker-compose build - build everything needed for local development.
  • docker-compose up web - start Django development container. It should automatically reload when code change.
  • bin/manage.sh - run any and all of your Django command in production, beta, staging or local environment. See bin/manage.sh -h for detail usage.

Tests

  • bin/test.sh - run all tests in Django development container.
  • bin/coverage.sh - run all tests and print code coverage in Django development container.

CircleCi

Environment Variables

  • SKIP_COVERALLS: set to true to skip sending coverage report to Coveralls. Only do this if Coveralls is down.
  • $SKIP_REBUILD_INDEX: set to true to skip rebuild index. This will significantly reduce deployment time. Please make sure that no changes in database was made.
  • $SKIP_REBUILD_SEARCH_INDEX: set to true to skip rebuild search index. This will significantly reduce deployment time. Please make sure that no changes in database was made.

Deployment

Deployment should be almost automatic depending on which branch you pushed.

  • master branch push will trigger production deploy
  • beta branch push will trigger beta deploy
  • staging branch push will trigger staging deploy

Staging deployment is completely automated but production deployment require your approval (to proceed) between django_migrate step and rebuild_index step so that you have the chance to run a command that alter data such as cache_data.

If you want to see each step, look at .circleci/config.yml.

Kubernetes

Setup production/beta/staging

  1. git secret reveal
  2. bin/initialize_kubernetes_cluster.sh - again only run this when cluster is newly created.
  3. bin/initialize_kubernetes_namespace.sh.

Setup cronjob on staging, beta or production

  • Run bin/run_cronjob.sh to run individual cronjobs e.g. bin/run_cronjob.sh --staging update_documents 0 5 * * * latest. Check bin/run_cronjob.sh -h for usage.
  • Kubernetes uses UTC so we have to +5 to match with Chicago time zone.
  • Do not use @daily as it will makes the cronjobs run at 19:00 CDT.

Run Django command on staging, beta or production

  • Use bin/run_job.sh e.g. bin/run_job.sh --staging latest cache_data. Check bin/run_job.sh -h for usage.

API Docs

  • Install hercule
  • Run bin/build_apiary.sh to update apiary file.

Development guides

Packages

No packages published

Languages

  • Python 94.8%
  • API Blueprint 4.2%
  • Other 1.0%