Skip to content

Commit

Permalink
🧑‍💻(dashboard) add bootstrap and reset commands for dashboard setup
Browse files Browse the repository at this point in the history
Introduce `bootstrap-dashboard` and `reset-dashboard-db` commands in the Makefile to streamline project setup and database resetting.
Update the dashboard README with corresponding instructions for better developer onboarding.
  • Loading branch information
ssorin committed Jan 6, 2025
1 parent dd18a54 commit ddf70e3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ bootstrap: \
seed-api
.PHONY: bootstrap

bootstrap-dashboard: ## bootstrap the dashboard project for development
bootstrap-dashboard: \
build-dashboard \
reset-dashboard-db
.PHONY: bootstrap-dashboard

build: ## build services image
$(COMPOSE) build
.PHONY: build
Expand Down Expand Up @@ -221,6 +227,8 @@ create-prefect-db: ## create prefect database
.PHONY: create-prefect-db

create-dashboard-db: ## create dashboard database
@echo "Running dashboard service database engine…"
@$(COMPOSE_UP) --wait postgresql
@echo "Creating dashboard service database…"
@$(COMPOSE) exec postgresql bash -c 'psql "postgresql://$${POSTGRES_USER}:$${POSTGRES_PASSWORD}@$${QUALICHARGE_DB_HOST}:$${QUALICHARGE_DB_PORT}/postgres" -c "create database \"$${DASHBOARD_DB_NAME}\";"' || echo "Duly noted, skipping database creation."
.PHONY: create-dashboard-db
Expand Down Expand Up @@ -329,6 +337,13 @@ reset-db: ## Reset the PostgreSQL database
$(MAKE) seed-dashboard
.PHONY: reset-db

reset-dashboard-db: ## Reset the PostgreSQL dashboard database
$(MAKE) create-dashboard-db
$(MAKE) migrate-dashboard
$(MAKE) create-dashboard-superuser
$(MAKE) seed-dashboard
.PHONY: reset-dashboard-db

seed-api: ## seed the API database (static data)
seed-api: run
zcat data/irve-statique.json.gz | \
Expand Down
20 changes: 17 additions & 3 deletions src/dashboard/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@ The qualicharge dashboard is available from the url:

## Useful commands

Perform a Django migration *(manage.py migrate)* :
Bootstrap dashboard project:

```
make bootstrap-dashboard
make run-dashboard
```

Perform a Django migration *(manage.py migrate)*:

```
make migrate-dashboard-db
```

Create superuser.
Create superuser:

You can connect with **username: admin** / **password: admin**.
*(The credentials are defined in env.d/dashboard.)*
Expand All @@ -30,12 +37,19 @@ You can connect with **username: admin** / **password: admin**.
make create-dashboard-superuser
```

Display dashboard logs
Display dashboard logs:

```
make logs-dashboard
```

Reset dashboard db:

```
make drop-dashboard-db
make reset-dashboard-db
```

## Project specific naming convention

For each Django application, the application config label
Expand Down

0 comments on commit ddf70e3

Please sign in to comment.