|
| 1 | +################ |
| 2 | +# build commands |
| 3 | +################ |
| 4 | + |
| 5 | +django-build: |
| 6 | + docker-compose -f local.yml build django |
| 7 | + |
| 8 | +django-run: |
| 9 | + docker-compose -f local.yml up --remove-orphans |
| 10 | + |
| 11 | +backend-build: |
| 12 | + docker-compose -f local.yml build --pull |
| 13 | + |
| 14 | +build: backend-build stop |
| 15 | + |
| 16 | +run: django-run |
| 17 | + |
| 18 | +stop: |
| 19 | + docker-compose -f local.yml stop |
| 20 | + |
| 21 | +destroy: |
| 22 | + docker-compose -f local.yml rm -svf postgres |
| 23 | + docker-compose -f local.yml rm -svf django |
| 24 | + docker-compose -f local.yml rm -svf celeryworker |
| 25 | + docker-compose -f local.yml rm -svf celerybeat |
| 26 | + docker volume prune -f |
| 27 | + rm -f localstack/data/recorded_api_calls.json localstack/data/startup_info.json |
| 28 | + |
| 29 | +destroy-save-data: |
| 30 | + docker-compose -f local.yml rm -svf django |
| 31 | + docker-compose -f local.yml rm -svf celeryworker |
| 32 | + docker-compose -f local.yml rm -svf celerybeat |
| 33 | + docker volume prune -f |
| 34 | + |
| 35 | +rebuild-save-data: destroy-save-data build |
| 36 | + |
| 37 | +destroy-hard: stop destroy |
| 38 | + docker-compose -f local.yml down -v --rmi all |
| 39 | + |
| 40 | +rebuild: destroy build |
| 41 | +r: rebuild |
| 42 | + |
| 43 | +rebuild-with-init-data: destroy build m core-data |
| 44 | +rbwid: rebuild-with-init-data |
| 45 | + |
| 46 | +armageddon: |
| 47 | + docker-compose -f local.yml stop |
| 48 | + docker-compose -f local.yml down -v --rmi all |
| 49 | + docker volume prune -f |
| 50 | + rm -f localstack/data/recorded_api_calls.json localstack/data/startup_info.json |
| 51 | + |
| 52 | +clean: destroy stop |
| 53 | + docker system prune -f |
| 54 | + |
| 55 | +cbr: clean build run |
| 56 | + |
| 57 | +destroy-postgres: |
| 58 | + docker-compose -f local.yml rm -svf postgres |
| 59 | + |
| 60 | + |
| 61 | +#################### |
| 62 | +# migration commands |
| 63 | +#################### |
| 64 | +python-makemigrations: |
| 65 | + docker-compose -f local.yml run --rm django python manage.py makemigrations |
| 66 | +mm: python-makemigrations |
| 67 | + |
| 68 | +python-makemigrations-empty: |
| 69 | + docker-compose -f local.yml run --rm django python manage.py makemigrations ${app_label} --empty --name data_migration_${migration_name} |
| 70 | +mme: python-makemigrations-empty |
| 71 | + |
| 72 | +python-makemigrations-merge: |
| 73 | + docker-compose -f local.yml run --rm django python manage.py makemigrations --merge |
| 74 | +merge: python-makemigrations-merge |
| 75 | + |
| 76 | +python-migrate: |
| 77 | + docker-compose -f local.yml run --rm django python manage.py migrate_schemas --executor=standard_soft_delete |
| 78 | +m: python-migrate |
| 79 | + |
| 80 | + |
| 81 | +########################### |
| 82 | +# bash, shell, cli commands |
| 83 | +########################### |
| 84 | +python-bash: |
| 85 | + docker-compose -f local.yml run --rm django bash |
| 86 | +b: python-bash |
| 87 | +bash: python-bash |
| 88 | + |
| 89 | +python-bash-root: |
| 90 | + docker-compose -f local.yml run --rm --user root django bash |
| 91 | +b-root: python-bash-root |
| 92 | + |
| 93 | +python-shell-plus: |
| 94 | + docker-compose -f local.yml run --rm django python manage.py shell_plus |
| 95 | +sp: python-shell-plus |
| 96 | + |
| 97 | +python-tenant-shell-plus: |
| 98 | + docker-compose -f local.yml run --rm django python manage.py tenant_command shell_plus |
| 99 | +tsp: python-tenant-shell-plus |
| 100 | + |
| 101 | +python-db-shell: |
| 102 | + docker-compose -f local.yml run --rm django python manage.py dbshell |
| 103 | +db: python-db-shell |
| 104 | + |
| 105 | +redis-cli: |
| 106 | + docker-compose -f local.yml run --rm redis redis-cli -h redis -p 6379 |
| 107 | + |
| 108 | +redis-cli-cacheops: |
| 109 | + docker-compose -f local.yml run --rm redis redis-cli -n 1 -h redis -p 6379 |
| 110 | +cacheops: redis-cli-cacheops |
| 111 | + |
| 112 | +################################# |
| 113 | +# scripts and management commands |
| 114 | +################################# |
| 115 | +python-pip-install: |
| 116 | + docker-compose -f local.yml run --rm --user root django pip install -r requirements/base.txt -r requirements/local.txt |
| 117 | + docker-compose -f local.yml run --rm --user root celeryworker pip install -r requirements/base.txt -r requirements/local.txt |
| 118 | + docker-compose -f local.yml run --rm --user root celerybeat pip install -r requirements/base.txt -r requirements/local.txt |
| 119 | +pip: python-pip-install |
| 120 | + |
| 121 | +postman-push: |
| 122 | + docker-compose -f local.yml run --rm django /bin/bash -c "cd scripts && chmod 755 postman-push.sh && ./postman-push.sh" |
| 123 | +pp: postman-push |
| 124 | + |
| 125 | +build-openapi-schema: |
| 126 | + docker-compose -f local.yml run --rm django python manage.py tenant_command spectacular --file openapi-schema.yml --urlconf config.urls |
| 127 | +bos: build-openapi-schema |
| 128 | + |
| 129 | +rules-engine-ecr: |
| 130 | + echo "Downloading Rules Engine from ECR. Make sure your AWS profile is called 'los'." |
| 131 | + aws ecr get-login-password --profile los | docker login --username AWS --password-stdin 813755454003.dkr.ecr.us-east-2.amazonaws.com |
| 132 | +re-ecr: rules-engine-ecr |
| 133 | + |
| 134 | +python-makemessages: |
| 135 | + docker-compose -f local.yml run --rm django python manage.py makemessages -a |
| 136 | +messages: python-makemessages |
| 137 | + |
| 138 | +python-compilemessages: |
| 139 | + docker-compose -f local.yml run --rm django python manage.py compilemessages |
| 140 | +cm: python-compilemessages |
| 141 | + |
| 142 | + |
| 143 | +############### |
| 144 | +# test commands |
| 145 | +############### |
| 146 | +DIR ?= tests/ |
| 147 | +python-test: |
| 148 | + docker-compose -f local.yml run --rm django python -m pytest ${DIR} |
| 149 | +t: python-test |
| 150 | +test: python-test |
| 151 | + |
| 152 | +#################### |
| 153 | +# reporting commands |
| 154 | +#################### |
| 155 | +pylint: |
| 156 | + docker-compose -f local.yml run --rm django bash ./run_pylint.sh |
| 157 | + |
| 158 | +coverage: |
| 159 | + docker-compose -f local.yml run --rm django bash -c "pytest --cov tests/" |
| 160 | +# docker-compose -f local.yml run --rm django bash -c "coverage run -m pytest && coverage report" |
| 161 | + |
| 162 | +# config in pyproject.toml |
| 163 | +vulture: |
| 164 | + docker-compose -f local.yml run --rm django vulture |
| 165 | + |
| 166 | +qc: pylint coverage vulture |
0 commit comments