Provision JDK 21 (full JDK + JAVA_HOME) in site.yml #31

Open
opened 2026-09-12 03:19:02 -07:00 by westfarn · 0 comments
Owner

Summary

./scripts/provision.sh / playbooks/site.yml should install a full JDK 21 (with javac) and export JAVA_HOME so the self-hosted Gitea Act runner can compile Capacitor Android (AGP 8.7.2, JavaVersion.VERSION_21).

Today provision installs Node (roles/nodejs) but not Java. Android Gradle on the runner/control node fails because the OS Java is a JRE only.

Related: #9 (Android CI toolchain — JDK was listed as 17+; Capacitor 7 needs 21). This ticket is the provision-step slice: apt JDK + JAVA_HOME. SDK/keystore stay on #9.

Triggered by dta_webapp#65 store AAB work (ditch-the-agent/android).


Current state (ai-server-4080 / runner host)

What Status
Apt packages openjdk-21-jre + openjdk-21-jre-headless only — no javac
JAVA_HOME unset
which javac missing from PATH
Unpackaged JDK /home/westfarn/.local/jdk/jdk-21.0.12+8/bin/javac exists but is not what Act/Gradle use
Android SDK ~/Android/Sdk has platform 35 (and 36.1); build-tools 34.0.0 + 36.0.0
Ansible roles/common base packages have no JDK; site.yml has no jdk role

Capacitor writes sourceCompatibility JavaVersion.VERSION_21 in android/app/capacitor.build.gradle. JRE 21 is not enough; Gradle cannot compile.


Work

1. Ansible role (provision)

Add a small role modeled on roles/nodejs, applied from playbooks/site.yml (at least on ai-server-4080 / act_runner_enabled; installing on all webservers is fine and cheap).

Install JDK, not JRE:

- name: Install OpenJDK 21 JDK
  ansible.builtin.apt:
    name: openjdk-21-jdk
    state: present
    update_cache: true

Do not treat openjdk-21-jre as sufficient.

Optional: openjdk-21-jdk-headless if you want no GUI bits; still must include javac.

2. JAVA_HOME for Act jobs

Point the runner user and non-interactive CI shells at the distro JDK, e.g.:

JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
PATH=$JAVA_HOME/bin:$PATH

Use /etc/profile.d/java.sh and/or /etc/environment so Gitea Act (non-login) sees it. Do not rely on ~/.local/jdk/jdk-21.0.12+8.

3. Verify in the role

java -version    # OpenJDK 21
javac -version   # 21 (must exist)
echo "$JAVA_HOME"

4. Docs

  • scripts/provision.sh usage text: mention JDK 21
  • README.md / IMPLEMENTATION.md: JDK 21 next to Node 22 as a provisioned runtime
  • Cross-link #9 for SDK / keystore (out of scope here)

Out of scope


Acceptance criteria

  • ./scripts/provision.sh ai-server-4080 installs openjdk-21-jdk (or documented equivalent) with javac on PATH
  • JAVA_HOME is /usr/lib/jvm/java-21-openjdk-amd64 (or the distro JDK path) for the Act runner user
  • javac -version reports 21 without using ~/.local/jdk/...
  • JRE-only packages are not the only Java install
  • Provision docs list JDK 21 beside Node
## Summary `./scripts/provision.sh` / `playbooks/site.yml` should install a **full JDK 21** (with `javac`) and export `JAVA_HOME` so the self-hosted Gitea Act runner can compile Capacitor Android (AGP 8.7.2, `JavaVersion.VERSION_21`). Today provision installs Node (`roles/nodejs`) but **not Java**. Android Gradle on the runner/control node fails because the OS Java is a **JRE only**. Related: #9 (Android CI toolchain — JDK was listed as 17+; Capacitor 7 needs **21**). This ticket is the **provision-step** slice: apt JDK + `JAVA_HOME`. SDK/keystore stay on #9. Triggered by [dta_webapp#65](https://git.aimloperations.com/Ditch_The_Agent/dta_webapp/pulls/65) store AAB work (`ditch-the-agent/android`). --- ## Current state (ai-server-4080 / runner host) | What | Status | |------|--------| | Apt packages | `openjdk-21-jre` + `openjdk-21-jre-headless` only — **no `javac`** | | `JAVA_HOME` | unset | | `which javac` | missing from `PATH` | | Unpackaged JDK | `/home/westfarn/.local/jdk/jdk-21.0.12+8/bin/javac` exists but is **not** what Act/Gradle use | | Android SDK | `~/Android/Sdk` has platform **35** (and 36.1); build-tools 34.0.0 + 36.0.0 | | Ansible | `roles/common` base packages have no JDK; `site.yml` has no jdk role | Capacitor writes `sourceCompatibility JavaVersion.VERSION_21` in `android/app/capacitor.build.gradle`. JRE 21 is not enough; Gradle cannot compile. --- ## Work ### 1. Ansible role (provision) Add a small role modeled on `roles/nodejs`, applied from `playbooks/site.yml` (at least on **ai-server-4080** / `act_runner_enabled`; installing on all `webservers` is fine and cheap). Install **JDK**, not JRE: ```yaml - name: Install OpenJDK 21 JDK ansible.builtin.apt: name: openjdk-21-jdk state: present update_cache: true ``` Do **not** treat `openjdk-21-jre` as sufficient. Optional: `openjdk-21-jdk-headless` if you want no GUI bits; still must include `javac`. ### 2. JAVA_HOME for Act jobs Point the runner user and non-interactive CI shells at the distro JDK, e.g.: ```text JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 PATH=$JAVA_HOME/bin:$PATH ``` Use `/etc/profile.d/java.sh` and/or `/etc/environment` so **Gitea Act** (non-login) sees it. Do not rely on `~/.local/jdk/jdk-21.0.12+8`. ### 3. Verify in the role ```bash java -version # OpenJDK 21 javac -version # 21 (must exist) echo "$JAVA_HOME" ``` ### 4. Docs - `scripts/provision.sh` usage text: mention JDK 21 - `README.md` / `IMPLEMENTATION.md`: JDK 21 next to Node 22 as a provisioned runtime - Cross-link #9 for SDK / keystore (out of scope here) --- ## Out of scope - Android SDK / `ANDROID_HOME` / build-tools 35 — #9 - Keystore / `keystore.properties` layout — #9 - Wiring `dta_webapp` / `chat_web_app` Gradle workflows --- ## Acceptance criteria - [ ] `./scripts/provision.sh ai-server-4080` installs `openjdk-21-jdk` (or documented equivalent) with `javac` on `PATH` - [ ] `JAVA_HOME` is `/usr/lib/jvm/java-21-openjdk-amd64` (or the distro JDK path) for the Act runner user - [ ] `javac -version` reports 21 without using `~/.local/jdk/...` - [ ] JRE-only packages are not the only Java install - [ ] Provision docs list JDK 21 beside Node
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/server-infra#31