Enable java remote debug on dev docker stack (#1808)

* Enable java remote debug on dev stack

* Enable java remote debug on dev stack

* Update docs with info on docker development stack

* Update dev docs
This commit is contained in:
Muppetteer
2025-12-11 06:49:58 +11:00
committed by GitHub
parent 9ba06eae7b
commit cc38079c40
3 changed files with 30 additions and 6 deletions

View File

@@ -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

View File

@@ -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")
}
}

View File

@@ -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