Skip to content

Commit

Permalink
feat(makefile): load mock data
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamad-liyaghi committed Jul 26, 2024
1 parent 2cd011e commit 8e0b756
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help build run stop test admin
.PHONY: help build run stop test admin local_confmap prod_confmap

help:
@echo "Available targets:"
Expand All @@ -10,7 +10,8 @@ help:
@echo " test - Run the tests."
@echo " migrations - Create migrations."
@echo " migrate - Migrate"

@echo " local_confmap - Make Kubernetes config maps for local stage"
@echo " prod_confmap - Make Kubernetes config maps for production stage"

build:
docker compose build
Expand Down Expand Up @@ -41,4 +42,7 @@ local_confmap:
kubectl create configmap academy-master-env --from-env-file=./backend/.env.local && kubectl create configmap academy-master-env-file --from-file=.env=./backend/.env.local && kubectl create configmap postgres-initdb --from-file=./backend/docker/commands/pg-entrypoint.sh

prod_confmap:
kubectl create configmap academy-master-env --from-env-file=./backend/.env.prod && kubectl create configmap academy-master-env-file --from-file=.env=./backend/.env.prod && kubectl create configmap postgres-initdb --from-file=./backend/docker/commands/pg-entrypoint.sh
kubectl create configmap academy-master-env --from-env-file=./backend/.env.prod && kubectl create configmap academy-master-env-file --from-file=.env=./backend/.env.prod && kubectl create configmap postgres-initdb --from-file=./backend/docker/commands/pg-entrypoint.sh

load_mock_data:
docker exec academy-master-backend python manage.py loaddata sample-db.json
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ Follow these simple steps to run the AcademyMaster backend:
cd AcademyMaster/
```

3. Create a ConfigMap from .env file(use .env.prod for production).
3. Create ConfigMap
```bash
kubectl create configmap academy-master-env --from-env-file=./backend/.env.local
kubectl create configmap academy-master-env-file --from-file=.env=./backend/.env.local
make local_confmap
```
or
```bash
make prod_confmap
```

4. Creating Deployments
```bash
Expand All @@ -65,7 +68,7 @@ use `http://backend:8000/` on nodes

You can also load sample data by running the following command:
```bash
docker exec -it academy-master-backend python manage.py loaddata db.json
make load_mock_data
```


Expand Down
File renamed without changes.

0 comments on commit 8e0b756

Please sign in to comment.