Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧑‍💻(dashboard) add bootstrap and reset commands for dashboard setup #317

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading