diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d41a762c..40f7ad7f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,10 +41,24 @@ ## 🚀 Getting Started ## 🧱 Local Development Setup -Either run `docker compose -f dev.docker-compose.yml up` or install & run everything Locally (described below). +Booklore has a simple all-in-one Docker development stack, or you can install & run everything manually. -### 1. Prerequisites +### Development using Docker stack + +Run `docker compose -f dev.docker-compose.yml up` + +- Dev web server is accessible at `http://localhost:4200/` +- Dev database is accessible at `http://localhost:3366/` +- Remote java debugging is accessible at `http://localhost:5005/` + +All ports are configurable using environment variables - see dev.docker-compose.yml + +--- + +### Development on local machine + +#### 1. Prerequisites - **Java 21+** - **Node.js 18+** @@ -53,7 +67,7 @@ ### 1. Prerequisites --- -### 2. Frontend Setup +#### 2. Frontend Setup To set up the Angular frontend: @@ -69,9 +83,9 @@ ### 2. Frontend Setup --- -### 3. Backend Setup +#### 3. Backend Setup -#### a. Configure `application-dev.yml` +##### a. Configure `application-dev.yml` Create or edit `booklore-api/src/main/resources/application-dev.yml`: @@ -90,7 +104,7 @@ #### a. Configure `application-dev.yml` > 🔧 Replace `/path/to/...` with actual local paths -#### b. Run the Backend +##### b. Run the Backend ```bash cd booklore-api diff --git a/booklore-api/build.gradle b/booklore-api/build.gradle index c229729f..ade8a418 100644 --- a/booklore-api/build.gradle +++ b/booklore-api/build.gradle @@ -94,3 +94,9 @@ test { jvmArgs("-XX:+EnableDynamicAgentLoading") } +bootRun { + def debug = System.getenv('REMOTE_DEBUG_ENABLED') + if (debug.equals("true")) { + jvmArgs("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005") + } +} \ No newline at end of file diff --git a/dev.docker-compose.yml b/dev.docker-compose.yml index 9ce435b3..841fdec0 100644 --- a/dev.docker-compose.yml +++ b/dev.docker-compose.yml @@ -4,10 +4,12 @@ services: command: sh -c "cd /booklore-api && ./gradlew bootRun" ports: - "${BACKEND_PORT:-8080}:8080" + - "${REMOTE_DEBUG_PORT:-5005}:5005" environment: - DATABASE_URL=jdbc:mariadb://backend_db:3306/booklore - DATABASE_USERNAME=booklore - DATABASE_PASSWORD=booklore + - REMOTE_DEBUG_ENABLED=true stdin_open: true tty: true restart: unless-stopped @@ -29,6 +31,8 @@ services: - MYSQL_DATABASE=booklore - MYSQL_USER=booklore - MYSQL_PASSWORD=booklore + ports: + - "${DB_PORT:-3366}:3306" healthcheck: test: [ "CMD", "mariadb-admin", "ping", "-h", "localhost", "-uroot", "-pbooklore" ] interval: 10s