00afd05abb
- add collectstatic job to docker-compose.yaml - remove old dev script - add a recipe for building the frontend distributable - fix nginx location for react-router endpoints - fix bug in tasks.py
84 lines
2.4 KiB
Makefile
84 lines
2.4 KiB
Makefile
#!/usr/bin/env make
|
|
|
|
SHELL = /bin/bash
|
|
UID := $(shell id -u)
|
|
GID := $(shell id -g)
|
|
|
|
export UID
|
|
export GID
|
|
|
|
frontend/node_modules:
|
|
docker run --rm -v ${PWD}/frontend:/app -w /app -u ${UID}:${GID} node:16-bullseye npm i
|
|
|
|
frontend/build: frontend/node_modules
|
|
docker run --rm -v ${PWD}/frontend:/app -w /app -u ${UID}:${GID} node:16-bullsye npm build
|
|
|
|
ingest:
|
|
docker-compose up -d backend postgres
|
|
docker-compose exec backend python manage.py loaddata \
|
|
/app/right_tree/api/data/fixtures/001_eco_regions.json \
|
|
/app/right_tree/api/data/fixtures/002_tolerance_levels.json \
|
|
/app/right_tree/api/data/fixtures/003_soil_variants.json \
|
|
/app/right_tree/api/data/fixtures/004_soil_order_mappings.json \
|
|
/app/right_tree/api/data/fixtures/005_habitats.json \
|
|
/app/right_tree/api/data/fixtures/006_zones.json \
|
|
/app/right_tree/api/data/fixtures/007_habitat_images.json
|
|
docker-compose exec backend python manage.py loadshapefiles
|
|
docker-compose exec backend python manage.py createplantfixtures
|
|
docker-compose exec backend python manage.py loaddata \
|
|
/app/right_tree/api/data/fixtures/plants.json
|
|
|
|
ingest_linz:
|
|
docker-compose up -d postgres
|
|
docker-compose exec -T postgres pg_restore -U righttree -d righttree -n linz -Fc < linz.dump
|
|
docker-compose exec -T postgres psql -U righttree -d righttree -f - < create_indices.sql
|
|
|
|
migrate:
|
|
docker-compose up -d backend postgres
|
|
docker-compose exec backend python manage.py makemigrations --noinput
|
|
docker-compose exec backend python manage.py migrate --noinput
|
|
|
|
createsuperuser:
|
|
docker-compose up -d backend
|
|
docker-compose exec backend python manage.py createsuperuser
|
|
|
|
shell:
|
|
docker-compose up -d backend
|
|
docker-compose exec backend python manage.py shell
|
|
|
|
psql:
|
|
docker-compose up -d postgres
|
|
docker-compose exec postgres psql -U righttree -d righttree
|
|
|
|
build:
|
|
docker build --no-cache -t right-tree backend
|
|
|
|
start: frontend/node_modules backend/right_tree/staticfiles
|
|
docker-compose up -d
|
|
docker-compose logs -f
|
|
|
|
logs:
|
|
docker-compose logs -f
|
|
|
|
stop:
|
|
docker-compose down
|
|
|
|
cert:
|
|
docker run --rm \
|
|
--name certbot \
|
|
-p 443:443 \
|
|
-p 80:80 \
|
|
-v /etc/letsencrypt:/etc/letsencrypt \
|
|
certbot/certbot \
|
|
certonly \
|
|
--standalone \
|
|
--non-interactive \
|
|
--preferred-challenges http \
|
|
--logs-dir /etc/letsencrypt/logs \
|
|
-d rightplant.biospherecapital.com
|
|
|
|
clean: stop
|
|
git clean -dxf
|
|
|
|
reset: clean
|
|
docker-compose down --volumes --remove-orphans
|