From 525f98a05480d7e2839819be55445e63a2b60617 Mon Sep 17 00:00:00 2001 From: Pierre Tellier Date: Wed, 12 Feb 2025 12:23:53 +0100 Subject: [PATCH] feat: new makefile option --- Makefile | 16 +++++++++-- config/dev.docker-compose.yaml | 52 ++++++++++++++++++++++++++++++++++ config/dev.env | 22 ++++++++++++++ 3 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 config/dev.docker-compose.yaml create mode 100644 config/dev.env diff --git a/Makefile b/Makefile index 1e3a808..617387b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ help: - @echo "make [clean dev-front prod dev-back]" + @echo "make [clean dev-front prod dev-back dev]" clean: + @cp config/frontdev.env front/MyINPulse-front/.env + @cp config/frontdev.env .env + @cp config/frontdev.env MyINPulse-back/.env @cp config/prod.docker-compose.yaml docker-compose.yaml @docker compose down @rm -f docker-compose.yaml @@ -42,4 +45,13 @@ dev-back: @docker compose up -d --build @echo "cd MyINPulse-back" && echo 'export $$(cat .env | xargs)' @echo "./gradlew bootRun --args='--server.port=8081'" - \ No newline at end of file + +dev: clean vite + @cp config/dev.env front/MyINPulse-front/.env + @cp config/dev.env .env + @cp config/dev.env MyINPulse-back/.env + @cp config/dev.docker-compose.yaml docker-compose.yaml + @docker compose up -d --build + @echo "cd MyINPulse-back" && echo 'export $$(cat .env | xargs)' + @echo "./gradlew bootRun --args='--server.port=8081'" + @cd ./front/MyINPulse-front/ && npm run dev & diff --git a/config/dev.docker-compose.yaml b/config/dev.docker-compose.yaml new file mode 100644 index 0000000..d66d92a --- /dev/null +++ b/config/dev.docker-compose.yaml @@ -0,0 +1,52 @@ +services: + postgres: + env_file: .env + build: + context: postgres/ + dockerfile: Dockerfile + container_name: MyINPulse-DB + ports: + - 5433:5432 + volumes: + - ./postgres/data:/var/lib/postgresql/data + + + keycloak: + container_name: MyINPulse-keycloak + build: + context: ./keycloak + dockerfile: Dockerfile + args: + KC_DB: postgres + KC_DB_URL: jdbc:postgresql://postgres/${POSTGRES_DB} + KC_DB_USERNAME: ${POSTGRES_USER} + KC_DB_PASSWORD: ${POSTGRES_PASSWORD} + environment: + KC_HOSTNAME_PORT: 7080 + KC_HOSTNAME_STRICT_BACKCHANNEL: "true" + KC_BOOTSTRAP_ADMIN_USERNAME: ${KEYCLOAK_ADMIN} + KC_BOOTSTRAP_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD} + KC_LOG_LEVEL: info + command: ["start-dev", "--http-port", "7080", "--https-port", "7443", "--hostname", "${KEYCLOAK_HOSTNAME}"] + ports: + - "7080:7080" + - "7443:7443" + depends_on: + - postgres + + #front: + # build: + # context: ./front/ + # dockerfile: Dockerfile + # container_name: MyINPulse-front + # ports: + # - "8080:80" + + #back: + # build: + # context: ./MyINPulse-back/ + # dockerfile: Dockerfile + # container_name: MyINPulse-back + # ports: + # - "8081:8080" + \ No newline at end of file diff --git a/config/dev.env b/config/dev.env new file mode 100644 index 0000000..bcd45f3 --- /dev/null +++ b/config/dev.env @@ -0,0 +1,22 @@ +POSTGRES_DB=postgres_db +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres_db_user_password + +KEYCLOAK_ADMIN=admin +KEYCLOAK_ADMIN_PASSWORD=admin +KEYCLOAK_HOSTNAME=localhost +KEYCLOAK_DB=keycloak_db +KEYCLOAK_USER=keycloak_db_user +KEYCLOAK_PASSWORD=keycloak_db_user_password + +BACKEND_DB=backend_db +BACKEND_USER=backend_db_user +BACKEND_PASSWORD=backend_db_user_password + +DATABASE_URL=localhost:5433 + +VITE_KEYCLOAK_URL=http://localhost:7080 +VITE_KEYCLOAK_CLIENT_ID=myinpulse-dev +VITE_KEYCLOAK_REALM=test +VITE_APP_URL=http://localhost:5173 +VITE_BACKEND_URL=http://localhost:8081/