-
Notifications
You must be signed in to change notification settings - Fork 3
Add local development setup for RACM debugging #93
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /lib/ | ||
| /WebContent/WEB-INF/classes/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # RACM Component | ||
|
|
||
| ## Code Style | ||
| - Java 17 project | ||
| - ALWAYS use Gradle for package dependencies and managing the environment | ||
| - Always use SIMPLEST code and structure, don't over-engineer | ||
| - Don't create unnecessary files. When creating new version of a file, archive or delete the legacy file | ||
| - DO NOT ADD UNNECESSARY FEATURES! Keep code simple | ||
|
|
||
| ## Building | ||
| - Gradle root is at `components/java/` (where `settings.gradle` lives) | ||
| - Build racm and deps: `cd components/java && ./gradlew :racm:modelJar && ./gradlew :racm:build` | ||
| - RACM's `build.gradle` excludes `spring-boot-starter-logging` to avoid log4j bridge conflicts | ||
|
|
||
| ## Eclipse Setup | ||
| - Import as Gradle project from `components/java/` — creates separate projects per subproject | ||
| - Buildship prefs `connection.project.dir` must point to the Gradle root (`..` for depth-1, `../..` for depth-2 subprojects) | ||
| - Do NOT use the legacy flat `.classpath` at root (renamed to `.classpath.bak`) | ||
|
|
||
| ## Debugging in Eclipse | ||
| - Run/debug `org.sciserver.springapp.RACMApplication` as Java Application | ||
| - Requires two `-javaagent` VM arguments in Debug Configuration: | ||
| - `-javaagent:<path>/aspectjweaver-1.9.22.1.jar` (AspectJ load-time weaving, found in Gradle cache) | ||
| - `-javaagent:<path>/spring-instrument-<version>.jar` (Spring classloader instrumentation, stored in `racm/lib/`; version should match Spring Framework) | ||
| - The `lib/` folder is gitignored and holds JARs needed only for local Eclipse debugging | ||
| - Without these agents, `@EnableLoadTimeWeaving` and EclipseLink entity enhancement will fail | ||
|
|
||
| ## Configuration | ||
| - `application.properties` consolidates all config for local development (server, login, admin, DB, URLs, etc.) | ||
| - `jpa-config.properties` is loaded separately by EclipseLink via `RACMDatabaseConfiguration` | ||
| - `persistence.xml` lists all JPA entity classes | ||
| - In production, Helm generates `racm-application.yaml` with all config (see `helm/sciserver/files/racm-application.yaml`) | ||
|
|
||
| ## Key Architecture | ||
| - Spring Boot with EclipseLink JPA (not Hibernate) | ||
| - AspectJ for `@Transactional` support (`AdviceMode.ASPECTJ`) | ||
| - SQL Server database | ||
| - Auth: header, cookie, and query param filters via Spring Security | ||
| - Depends on: `springutils:logging-interceptor`, `springutils:authenticator`, `clients:auth` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # RACM - Resource Access Control Manager | ||
|
|
||
| RACM is the central authorization and resource management service for SciServer. | ||
| It manages users, groups, resources, access control, compute jobs, and storage. | ||
|
|
||
| ## Building | ||
|
|
||
| ```sh | ||
| cd components/java | ||
| ./gradlew :racm:modelJar && ./gradlew :racm:build | ||
| ``` | ||
|
|
||
| ## Running Locally | ||
|
|
||
| RACM can be run locally via the Spring Boot main class | ||
| `org.sciserver.springapp.RACMApplication`. This starts an embedded Tomcat server | ||
| without needing an external servlet container. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Java 17 JDK | ||
| - SQL Server with a `racm` database | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could supply more information on this (e.g. version requirements, how to start one in docker), or we can add a reference to the relevant place in the helm chart to look
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the database could also be named differently as long as it is properly set in the config file(s) |
||
| - Two Java agent JARs (required by AspectJ load-time weaving and EclipseLink): | ||
| - `aspectjweaver-1.9.22.1.jar` (available in Gradle cache after building) | ||
| - `spring-instrument.jar` (download from Maven Central, store in `racm/lib/` which is gitignored; version should match the Spring Framework version used by the project) | ||
|
|
||
| ### Configuration | ||
|
|
||
| Create `src/main/resources/application.properties` (gitignored) with your local | ||
| configuration. Use `helm/sciserver/files/racm-application.yaml` as a reference | ||
| for all available properties. At minimum you need: | ||
|
|
||
| ```properties | ||
| spring.application.name=racm | ||
| server.servlet.context-path=/racm | ||
| spring.mvc.pathmatch.matching-strategy=ant-path-matcher | ||
|
|
||
| spring.datasource.url=jdbc:sqlserver://localhost;DatabaseName=RACM | ||
| spring.datasource.username=racm_user | ||
| spring.datasource.password=<your-password> | ||
|
|
||
| spring.mvc.view.prefix=/WEB-INF/jsp/ | ||
| spring.mvc.view.suffix=.jsp | ||
| spring.main.allow-circular-references=true | ||
| spring.flyway.enabled=false | ||
|
|
||
| eclipselink.logging.level=WARNING | ||
|
|
||
| org.sciserver.racm.login.loginPortalUrl=http://localhost:8080/login-portal/ | ||
| org.sciserver.racm.login.login-admin.username=admin | ||
| org.sciserver.racm.login.login-admin.password=<password> | ||
|
|
||
| org.sciserver.racm.admin.username=__racm__ | ||
| org.sciserver.racm.admin.password=<password> | ||
| org.sciserver.racm.admin.email=racm@do.not.send | ||
| ``` | ||
|
|
||
| ### JVM Arguments | ||
|
|
||
| Both Java agents must be passed as VM arguments when launching: | ||
|
|
||
| ``` | ||
| -javaagent:<path-to>/aspectjweaver-1.9.22.1.jar | ||
| -javaagent:<path-to>/racm/lib/spring-instrument-<version>.jar | ||
| ``` | ||
|
|
||
| Without these, `@EnableLoadTimeWeaving` and EclipseLink entity enhancement will | ||
| fail on startup. | ||
|
|
||
| ### Verifying | ||
|
|
||
| The app starts on `http://localhost:8080/racm/`. Example endpoints: | ||
| - `GET /racm/ugm/rest/publicgroups` — list public groups | ||
| - `GET /racm/actuator/health` — health check | ||
|
|
||
| ### Eclipse Setup | ||
|
|
||
| To debug in Eclipse: | ||
|
|
||
| 1. **File > Import > Gradle > Existing Gradle Project**, browse to `components/java/` | ||
| 2. Right-click `RACMApplication.java` in the `sciserver-java-racm` project > **Debug As > Java Application** | ||
| 3. In **Run > Debug Configurations > Arguments > VM arguments**, add both `-javaagent` entries above | ||
|
|
||
| ## Notes | ||
|
|
||
| - `jpa-config.properties` is loaded separately by EclipseLink via `RACMDatabaseConfiguration` | ||
| - External services (Login Portal, File Service, Logging) may not be available | ||
| locally — the app will start but those features won't work | ||
| - The `aop.xml` excludes `org.springframework.boot.jdbc` from AspectJ weaving | ||
| to avoid Oracle DataSource class errors | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,9 @@ subprojects { | |
| } | ||
|
|
||
| dependencies { | ||
| api 'org.springframework.boot:spring-boot-starter-web:2.6.6' | ||
| api('org.springframework.boot:spring-boot-starter-web:2.6.6') { | ||
| exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' | ||
| } | ||
|
Comment on lines
+13
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this better belongs in the racm gradle file, similar to that of fileservice. However if there is another reason to do it here due to eclipse, we probably want to create an issue to track a resolution
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we want to homogenize how logging is done anyway I think? so an issue is in order.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'd like to take the current solution, issue an issue and move towards updating the logging of racm. |
||
| implementation 'org.springdoc:springdoc-openapi-ui:1.6.6' | ||
| api project(':logging') | ||
| testImplementation 'org.testng:testng:6.14.3' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much of this file is generic either the repo as a whole or the java projects within. Perhaps it is prudent to place much of it at a higher level in the repo sooner rather than later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, but let's discuss our GenAI usage and how it is reflected in the code base in general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is probably best for this PR to leave the CLAUDE.md file here and later when working in the larger context to add a file there and maybe move some of the current content up.