From d26dddd82267de16b107a3c3540aed58b5dd0908 Mon Sep 17 00:00:00 2001 From: Fabio Scotto di Santolo Date: Tue, 10 Nov 2026 16:26:06 +0100 Subject: [PATCH] Remove mise from WSL and tidy devcontainer tooling - Drop mise installation, COPR repository, pinned tool checks and dotfiles from the Fedora WSL profile; keep the Maven pin for the devcontainers as workstation_maven_version. - Remove the Claude Code and Cline VS Code extensions from the devcontainer definitions; the CLIs and their mounts remain. - Add the cdp and ecaas devcontainer definitions and their docs. Co-Authored-By: Claude Code --- AGENTS.md | 1 - README.it.md | 1 - README.md | 2 +- .../group_vars/workstation_dev_wsl.yml | 15 +-- ansible/inventory/host_vars/deadalus.yml | 1 + ansible/roles/dotfiles_common/tasks/main.yml | 14 +++ ansible/roles/packages_fedora/tasks/main.yml | 14 --- .../files/cdp-devcontainer.Dockerfile | 66 +++++++++++ .../files/ecaas-devcontainer.Dockerfile | 14 +++ .../tasks/cdp_devcontainer.yml | 98 ++++++++++++++++ .../tasks/ecaas_devcontainer.yml | 106 ++++++++++-------- .../tasks/main.yml | 50 +-------- .../templates/cdp-devcontainer.json.j2 | 60 ++++++++++ .../templates/ecaas-devcontainer.json.j2 | 22 +++- docs/deadalus-cdp-devcontainer.md | 43 +++++++ docs/deadalus-ecaas-devcontainer.md | 65 ++++++++--- .../workstation_dev_wsl/.bashrc.d/30-mise.sh | 4 - .../.config/mise/config.toml | 6 - 18 files changed, 429 insertions(+), 153 deletions(-) create mode 100644 ansible/roles/profile_workstation_dev_wsl/files/cdp-devcontainer.Dockerfile create mode 100644 ansible/roles/profile_workstation_dev_wsl/tasks/cdp_devcontainer.yml create mode 100644 ansible/roles/profile_workstation_dev_wsl/templates/cdp-devcontainer.json.j2 create mode 100644 docs/deadalus-cdp-devcontainer.md delete mode 100644 dotfiles/workstation_dev_wsl/.bashrc.d/30-mise.sh delete mode 100644 dotfiles/workstation_dev_wsl/.config/mise/config.toml diff --git a/AGENTS.md b/AGENTS.md index b775bba..710cd6e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -138,7 +138,6 @@ The dotfile vars follow the same split: `desktop_common_dotfiles` carries mode-i ## Workstation Notes - `deadalus` is modeled as Windows + Fedora WSL and is the sole workstation target. - Fedora WSL belongs to `platform_fedora`, `workstation_dev_fedora`, and the shared WSL layer. It must not receive Flatpak or Snap runtimes. -- Fedora WSL installs Mise from the official `jdxcode/mise` COPR and uses its pinned Temurin Java 11 JDK; update the declared Mise version deliberately. - Windows applications are installed manually and are not managed from the WSL profile. ## Rocky Server Notes diff --git a/README.it.md b/README.it.md index 975d860..485bf9b 100644 --- a/README.it.md +++ b/README.it.md @@ -164,7 +164,6 @@ Lo stato attuale del profilo workstation include: - installazione pacchetti base Fedora via dnf - installazione e configurazione di Docker dal repository ufficiale -- installazione di Mise dal COPR ufficiale con JDK Eclipse Temurin Java 11 fissato - gestione dei dotfiles workstation e rendering dei template dev condivisi - preparazione di Fedora WSL con `systemd` per il toolchain di sviluppo - attivazione del firewall `firewalld` sui target Fedora che dichiarano regole host-specifiche diff --git a/README.md b/README.md index 260aa6a..52f2d2a 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ The workstation receives two layers: - Fedora development setup through `workstation_dev_fedora`. - WSL setup with `systemd` through `workstation_dev_wsl`. -That gives it Fedora packages through DNF, Docker from the official repository, Mise from its official COPR repository with a pinned Eclipse Temurin Java 11 JDK, shared workstation dotfiles and templates, tmux helpers, and WSL systemd configuration. Windows applications are installed manually; the WSL profile does not manage Python remoting components for them. +That gives it Fedora packages through DNF, Docker from the official repository, shared workstation dotfiles and templates, tmux helpers, and WSL systemd configuration. Windows applications are installed manually; the WSL profile does not manage Python remoting components for them. ### WSL workflow diff --git a/ansible/inventory/group_vars/workstation_dev_wsl.yml b/ansible/inventory/group_vars/workstation_dev_wsl.yml index 846b49c..c9d7937 100644 --- a/ansible/inventory/group_vars/workstation_dev_wsl.yml +++ b/ansible/inventory/group_vars/workstation_dev_wsl.yml @@ -11,26 +11,17 @@ workstation_dev_wsl_packages: - helm # Fedora ships the kubectl client binary in the kubernetes-client package. - kubernetes-client - - mise - pinentry-curses - python3-pip - tmux -# Java 11, Java 25 and Maven are managed by Mise on this Fedora WSL profile. -# Keep their versions pinned; update them deliberately. -workstation_mise_java_version: temurin-11.0.31+11 -workstation_mise_java_25_version: 25.0.2 -workstation_mise_maven_version: 3.9.16 +# Maven version pinned in the devcontainer images; update it deliberately. +workstation_maven_version: 3.9.16 +workstation_cdp_node_version: 20.18.3 workstation_is_wsl: true workstation_wsl_systemd_enabled: true workstation_dev_wsl_dotfiles: - - src: .bashrc.d/30-mise.sh - dest: .bashrc.d/30-mise.sh - mode: "0644" - - src: .config/mise/ - dest: .config/mise/ - mode: preserve - src: .gnupg/gpg-agent.conf dest: .gnupg/gpg-agent.conf mode: "0600" diff --git a/ansible/inventory/host_vars/deadalus.yml b/ansible/inventory/host_vars/deadalus.yml index 17cd19a..d5859b5 100644 --- a/ansible/inventory/host_vars/deadalus.yml +++ b/ansible/inventory/host_vars/deadalus.yml @@ -2,6 +2,7 @@ hostname: deadalus workstation_wsl_windows_user_home: /mnt/c/Users/FABIOSCOTTODISANTOLO workstation_ecaas_workspace: "{{ user_home }}/Work/sipo/ecaas" +workstation_cdp_workspace: "{{ user_home }}/Work/sipo/cdp" workstation_ecaas_git_required_ca: ecaas.datacenter.comune.roma.crt # Codex is not installed or configured on WSL; remove the managed npm package. diff --git a/ansible/roles/dotfiles_common/tasks/main.yml b/ansible/roles/dotfiles_common/tasks/main.yml index 20edcd0..be638b5 100644 --- a/ansible/roles/dotfiles_common/tasks/main.yml +++ b/ansible/roles/dotfiles_common/tasks/main.yml @@ -91,6 +91,20 @@ loop_control: label: "{{ item.dest }}" +- name: Ensure AI coding-agent dotfile parent directories exist + tags: [dotfiles, dotfiles:common, ai_agents] + ansible.builtin.file: + path: "{{ (effective_user_home ~ '/' ~ item.dest) | dirname }}" + state: directory + owner: "{{ effective_username }}" + group: "{{ effective_user_group }}" + mode: "0755" + loop: "{{ ai_agents_dotfiles | default([]) }}" + loop_control: + label: "{{ item.dest }}" + when: + - (item.agents | intersect(ai_agents_deploy_enabled_names)) | length > 0 + - name: Deploy AI coding-agent dotfiles tags: [dotfiles, dotfiles:common, ai_agents] ansible.builtin.copy: diff --git a/ansible/roles/packages_fedora/tasks/main.yml b/ansible/roles/packages_fedora/tasks/main.yml index 065d030..48cc4a2 100644 --- a/ansible/roles/packages_fedora/tasks/main.yml +++ b/ansible/roles/packages_fedora/tasks/main.yml @@ -25,20 +25,6 @@ - "'workstation_dev_fedora' in group_names" - fedora_manage_docker_repo | default(false) -- name: Install COPR support on Fedora WSL - tags: [packages, mise] - ansible.builtin.dnf: - name: dnf-plugins-core - state: present - when: "'workstation_dev_wsl' in group_names" - -- name: Configure Mise COPR repository on Fedora WSL - tags: [packages, mise] - community.general.copr: - name: jdxcode/mise - state: enabled - when: "'workstation_dev_wsl' in group_names" - - name: Install distribution signing keys for Fedora desktop codecs tags: [packages, heic] ansible.builtin.dnf: diff --git a/ansible/roles/profile_workstation_dev_wsl/files/cdp-devcontainer.Dockerfile b/ansible/roles/profile_workstation_dev_wsl/files/cdp-devcontainer.Dockerfile new file mode 100644 index 0000000..ce0668e --- /dev/null +++ b/ansible/roles/profile_workstation_dev_wsl/files/cdp-devcontainer.Dockerfile @@ -0,0 +1,66 @@ +ARG MAVEN_VERSION=3.9.16 +ARG NODE_VERSION=20.18.3 +FROM docker.io/library/maven:${MAVEN_VERSION}-eclipse-temurin-25 AS maven +FROM docker.io/library/node:${NODE_VERSION}-bookworm-slim AS node +# Java 25 runs both the application and the language servers. +FROM mcr.microsoft.com/devcontainers/java:25-bookworm +USER root +COPY --from=maven /usr/share/maven/ /usr/share/maven/ +COPY --from=node /usr/local/bin/node /usr/local/bin/node +COPY --from=node /usr/local/lib/node_modules/npm/ /usr/local/lib/node_modules/npm/ +RUN ln -s /usr/share/maven/bin/mvn /usr/local/bin/mvn \ + && ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \ + && ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \ + && java -version \ + && mvn -v \ + && node --version \ + && npm install --global --no-audit --no-fund @anthropic-ai/claude-code@2.1.312 cline@3.0.74 \ + && npm cache clean --force +RUN apt-get update \ + && apt-get install -y --no-install-recommends bash-completion ca-certificates curl fzf git git-lfs gnupg openssh-client zoxide \ + && arch="$(dpkg --print-architecture)" \ + && case "$arch" in \ + amd64) sha256=ea4f0222950ee750a3d38dd80d03bce4cee07a3f63928fc47548383bcaf23093 ;; \ + arm64) sha256=0edc36cf514f1bd84becac3e94ee8ae9f8818c6a1f99f7b2ee67b362afa253d3 ;; \ + *) echo "Unsupported architecture for delta: $arch" >&2; exit 1 ;; \ + esac \ + && curl -fsSL --retry 3 "https://github.com/dandavison/delta/releases/download/0.19.2/git-delta_0.19.2_${arch}.deb" -o /tmp/git-delta.deb \ + && echo "$sha256 /tmp/git-delta.deb" | sha256sum -c - \ + && apt-get install -y --no-install-recommends /tmp/git-delta.deb \ + && rm -rf /var/lib/apt/lists/* /tmp/git-delta.deb +ARG KUBECTL_VERSION=1.37.1 +ARG HELM_VERSION=4.2.2 +RUN arch="$(dpkg --print-architecture)" \ + && case "$arch" in \ + amd64) kubectl_sha=65691ff77eb6fa44c908b77a1082c9f092c3b9733b5cefabec0d1104890e21a8; helm_sha=9adafecab4d406853bba163a70e9f104f47dbbf65ce24b7653bae7e36150bcb6 ;; \ + arm64) kubectl_sha=ff749f4b78d9c4f1ec87307df9b50119ed819e2094aa9810cb9acffc3286c8c7; helm_sha=78803142087a0069fa4b50d3f32a84d3ef25c14d1ee8a40fbccf86a6216d2f36 ;; \ + *) echo "Unsupported architecture for kubectl/helm: $arch" >&2; exit 1 ;; \ + esac \ + && curl -fsSL --retry 3 "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${arch}/kubectl" -o /tmp/kubectl \ + && echo "$kubectl_sha /tmp/kubectl" | sha256sum -c - \ + && install -m 0755 /tmp/kubectl /usr/local/bin/kubectl \ + && curl -fsSL --retry 3 "https://get.helm.sh/helm-v${HELM_VERSION}-linux-${arch}.tar.gz" -o /tmp/helm.tgz \ + && echo "$helm_sha /tmp/helm.tgz" | sha256sum -c - \ + && tar -xzf /tmp/helm.tgz -C /tmp "linux-${arch}/helm" \ + && install -m 0755 "/tmp/linux-${arch}/helm" /usr/local/bin/helm \ + && rm -rf /tmp/kubectl /tmp/helm.tgz "/tmp/linux-${arch}" \ + && kubectl version --client \ + && helm version --short +ARG GLAB_VERSION=1.114.0 +RUN arch="$(dpkg --print-architecture)" \ + && case "$arch" in \ + amd64) sha256=6df680f88a2a45700d1dd6a08a44a74838473ef3dcc5cb1ad243f4d1fd704ad0 ;; \ + arm64) sha256=c2bcb44cc10d849cccb879e687f3b9e102a3415c3d02f0cecfd9ce1442519350 ;; \ + *) echo "Unsupported architecture for glab: $arch" >&2; exit 1 ;; \ + esac \ + && curl -fsSL --retry 3 "https://gitlab.com/gitlab-org/cli/-/releases/v${GLAB_VERSION}/downloads/glab_${GLAB_VERSION}_linux_${arch}.deb" -o /tmp/glab.deb \ + && echo "$sha256 /tmp/glab.deb" | sha256sum -c - \ + && apt-get update \ + && apt-get install -y --no-install-recommends /tmp/glab.deb \ + && rm -rf /var/lib/apt/lists/* /tmp/glab.deb \ + && glab --version +COPY --chown=vscode:vscode bashrc /home/vscode/.bashrc +COPY --chown=vscode:vscode bashrc.aliases /home/vscode/.bashrc.aliases +USER vscode +# Keep this file writable so VS Code can register its Git credential helper. +RUN git config --file /home/vscode/.gitconfig include.path /run/ecaas-git/gitconfig diff --git a/ansible/roles/profile_workstation_dev_wsl/files/ecaas-devcontainer.Dockerfile b/ansible/roles/profile_workstation_dev_wsl/files/ecaas-devcontainer.Dockerfile index ea80abc..09b4dce 100644 --- a/ansible/roles/profile_workstation_dev_wsl/files/ecaas-devcontainer.Dockerfile +++ b/ansible/roles/profile_workstation_dev_wsl/files/ecaas-devcontainer.Dockerfile @@ -29,7 +29,21 @@ RUN apt-get update \ && echo "$sha256 /tmp/git-delta.deb" | sha256sum -c - \ && apt-get install -y --no-install-recommends /tmp/git-delta.deb \ && rm -rf /var/lib/apt/lists/* /tmp/git-delta.deb +ARG GLAB_VERSION=1.114.0 +RUN arch="$(dpkg --print-architecture)" \ + && case "$arch" in \ + amd64) sha256=6df680f88a2a45700d1dd6a08a44a74838473ef3dcc5cb1ad243f4d1fd704ad0 ;; \ + arm64) sha256=c2bcb44cc10d849cccb879e687f3b9e102a3415c3d02f0cecfd9ce1442519350 ;; \ + *) echo "Unsupported architecture for glab: $arch" >&2; exit 1 ;; \ + esac \ + && curl -fsSL --retry 3 "https://gitlab.com/gitlab-org/cli/-/releases/v${GLAB_VERSION}/downloads/glab_${GLAB_VERSION}_linux_${arch}.deb" -o /tmp/glab.deb \ + && echo "$sha256 /tmp/glab.deb" | sha256sum -c - \ + && apt-get update \ + && apt-get install -y --no-install-recommends /tmp/glab.deb \ + && rm -rf /var/lib/apt/lists/* /tmp/glab.deb \ + && glab --version COPY --chown=vscode:vscode bashrc /home/vscode/.bashrc +COPY --chown=vscode:vscode bashrc.aliases /home/vscode/.bashrc.aliases USER vscode # Keep this file writable so VS Code can register its Git credential helper. RUN git config --file /home/vscode/.gitconfig include.path /run/ecaas-git/gitconfig diff --git a/ansible/roles/profile_workstation_dev_wsl/tasks/cdp_devcontainer.yml b/ansible/roles/profile_workstation_dev_wsl/tasks/cdp_devcontainer.yml new file mode 100644 index 0000000..18c79fb --- /dev/null +++ b/ansible/roles/profile_workstation_dev_wsl/tasks/cdp_devcontainer.yml @@ -0,0 +1,98 @@ +--- +- name: Refuse to deploy the cdp workspace outside WSL + ansible.builtin.assert: + that: + - "'wsl2' in (ansible_facts.kernel | default('') | lower)" + - ansible_facts.distribution | default('') == 'Fedora' + fail_msg: Run this deployment from the Fedora WSL 2 distribution on deadalus. + +- name: Prepare the cdp workspace and private configuration + vars: + ecaas_agent_state: "{{ user_home }}/.local/state/ecaas-devcontainer" + ecaas_git_available_cas: >- + {{ ecaas_git_ca_probe.results | selectattr('stat.isreg', 'defined') | + selectattr('stat.isreg') | map(attribute='item') | list }} + block: + - name: Prepare the shared Git configuration + ansible.builtin.import_tasks: ecaas_git.yml + + - name: Ensure the cdp dev container directory exists + ansible.builtin.file: + path: "{{ workstation_cdp_workspace }}/.devcontainer" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0755" + + - name: Ensure the local Maven directory mounted into the container exists + ansible.builtin.file: + path: "{{ user_home }}/.m2" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0755" + + - name: Ensure the local Kubernetes directory mounted into the container exists + ansible.builtin.file: + path: "{{ user_home }}/.kube" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0700" + + - name: Ensure the private ecaas Git state directory exists + ansible.builtin.file: + path: "{{ ecaas_agent_state }}" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0700" + + - name: Ensure the local agent configuration directories mounted into the container exist + ansible.builtin.file: + path: "{{ user_home }}/{{ item.path }}" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "{{ item.mode }}" + loop: + - { path: .claude, mode: "0700" } + - { path: .cline, mode: "0700" } + - { path: .config/ai, mode: "0755" } + - { path: .config/glab-cli, mode: "0700" } + + - name: Deploy the cdp dev container configuration + ansible.builtin.template: + src: cdp-devcontainer.json.j2 + dest: "{{ workstation_cdp_workspace }}/.devcontainer/devcontainer.json" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0644" + backup: true + + - name: Deploy the cdp dev container build files + ansible.builtin.copy: + src: "{{ item.src }}" + dest: "{{ workstation_cdp_workspace }}/.devcontainer/{{ item.dest }}" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0644" + backup: true + loop: + - src: cdp-devcontainer.Dockerfile + dest: Dockerfile + - src: "{{ playbook_dir }}/../dotfiles/common/.bashrc" + dest: bashrc + loop_control: + label: "{{ item.dest }}" + + - name: Deploy the shared Bash aliases without the production tunnel + ansible.builtin.copy: + content: >- + {{ lookup('ansible.builtin.file', playbook_dir ~ '/../dotfiles/common/.bashrc.aliases') + | regex_replace('(?m)^(#[^\n]*Nginx Proxy Manager[^\n]*\n)?alias npm-tunnel=[^\n]*\n?', '') }} + dest: "{{ workstation_cdp_workspace }}/.devcontainer/bashrc.aliases" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0644" + backup: true diff --git a/ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_devcontainer.yml b/ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_devcontainer.yml index 483b9ad..6dc20b4 100644 --- a/ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_devcontainer.yml +++ b/ansible/roles/profile_workstation_dev_wsl/tasks/ecaas_devcontainer.yml @@ -12,25 +12,6 @@ ecaas_git_available_cas: >- {{ ecaas_git_ca_probe.results | selectattr('stat.isreg', 'defined') | selectattr('stat.isreg') | map(attribute='item') | list }} - ecaas_agent_config: - - src: .claude/settings.json - dest: claude/settings.json - - src: .claude/CLAUDE.md - dest: claude/CLAUDE.md - - src: .claude/rules - dest: claude/rules - - src: .claude/skills - dest: claude/skills - - src: .config/ai/bootstrap.md - dest: ai/bootstrap.md - - src: .cline/data/globalState.json - dest: cline/data/globalState.json - - src: .cline/data/settings/global-settings.json - dest: cline/data/settings/global-settings.json - - src: .cline/rules - dest: cline/rules - - src: .cline/skills - dest: cline/skills block: - name: Prepare the ecaas Git configuration ansible.builtin.import_tasks: ecaas_git.yml @@ -43,43 +24,63 @@ group: "{{ user_group }}" mode: "0755" - - name: Ensure private ecaas agent state directories exist + - name: Ensure the local Maven directory mounted into the container exists ansible.builtin.file: - path: "{{ ecaas_agent_state }}{{ item }}" + path: "{{ user_home }}/.m2" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0755" + + - name: Ensure the private ecaas Git state directory exists + ansible.builtin.file: + path: "{{ ecaas_agent_state }}" state: directory owner: "{{ username }}" group: "{{ user_group }}" mode: "0700" + + - name: Ensure the local agent configuration directories mounted into the container exist + ansible.builtin.file: + path: "{{ user_home }}/{{ item.path }}" + state: directory + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "{{ item.mode }}" loop: - - "" - - /ai - - /claude - - /cline - - /cline/data - - /cline/data/settings + - { path: .claude, mode: "0700" } + - { path: .cline, mode: "0700" } + - { path: .config/ai, mode: "0755" } + - { path: .config/glab-cli, mode: "0700" } - - name: Locate supported WSL agent configuration - ansible.builtin.stat: - path: "{{ user_home }}/{{ item.src }}" - follow: false - get_checksum: false - get_mime: false - loop: "{{ ecaas_agent_config }}" - register: ecaas_agent_config_sources + - name: Read the WSL Claude account state + ansible.builtin.slurp: + src: "{{ user_home }}/.claude.json" + register: ecaas_claude_account_state + failed_when: false + no_log: true - - name: Seed missing private agent settings without importing credential stores + - name: Read the Claude state used when CLAUDE_CONFIG_DIR is set + ansible.builtin.slurp: + src: "{{ user_home }}/.claude/.claude.json" + register: ecaas_claude_dir_state + failed_when: false + no_log: true + + - name: Seed missing Claude account and onboarding state for the container ansible.builtin.copy: - src: "{{ user_home }}/{{ item.item.src }}{{ '/' if item.stat.isdir | default(false) else '' }}" - dest: "{{ ecaas_agent_state }}/{{ item.item.dest }}" - remote_src: true - mode: preserve - force: false - local_follow: false - become_user: "{{ username }}" - when: - - item.stat.isreg | default(false) or item.stat.isdir | default(false) - - not ansible_check_mode - loop: "{{ ecaas_agent_config_sources.results }}" + content: >- + {{ (ecaas_claude_account_state.content | b64decode | from_json + | dict2items + | selectattr('key', 'in', ['oauthAccount', 'hasCompletedOnboarding', 'userID']) + | items2dict) + | combine(ecaas_claude_dir_state.content | default('e30=' | b64encode) | b64decode | from_json) + | to_nice_json }} + dest: "{{ user_home }}/.claude/.claude.json" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0600" + when: ecaas_claude_account_state.content is defined no_log: true diff: false @@ -107,3 +108,14 @@ dest: bashrc loop_control: label: "{{ item.dest }}" + + - name: Deploy the shared Bash aliases without the production tunnel + ansible.builtin.copy: + content: >- + {{ lookup('ansible.builtin.file', playbook_dir ~ '/../dotfiles/common/.bashrc.aliases') + | regex_replace('(?m)^(#[^\n]*Nginx Proxy Manager[^\n]*\n)?alias npm-tunnel=[^\n]*\n?', '') }} + dest: "{{ workstation_ecaas_workspace }}/.devcontainer/bashrc.aliases" + owner: "{{ username }}" + group: "{{ user_group }}" + mode: "0644" + backup: true diff --git a/ansible/roles/profile_workstation_dev_wsl/tasks/main.yml b/ansible/roles/profile_workstation_dev_wsl/tasks/main.yml index 5220345..0f06ad8 100644 --- a/ansible/roles/profile_workstation_dev_wsl/tasks/main.yml +++ b/ansible/roles/profile_workstation_dev_wsl/tasks/main.yml @@ -4,6 +4,11 @@ when: workstation_ecaas_workspace is defined tags: [ecaas_devcontainer] +- name: Deploy the cdp Java 25 dev container + ansible.builtin.import_tasks: cdp_devcontainer.yml + when: workstation_cdp_workspace is defined + tags: [cdp_devcontainer] + - name: Ensure Windows Emacs authoring directories exist tags: [dotfiles, dotfiles:workstation, emacs, wsl] ansible.builtin.file: @@ -60,51 +65,6 @@ loop_control: label: "{{ item.dest }}" -- name: Check whether the pinned Java version is installed with Mise - tags: [packages, mise, java, wsl] - ansible.builtin.command: - cmd: "mise where java@{{ workstation_mise_java_version }}" - become_user: "{{ username }}" - environment: - HOME: "{{ user_home }}" - register: workstation_mise_java_where - changed_when: false - failed_when: false - -- name: Check whether the pinned Java 25 version is installed with Mise - tags: [packages, mise, java, wsl] - ansible.builtin.command: - cmd: "mise where java@{{ workstation_mise_java_25_version }}" - become_user: "{{ username }}" - environment: - HOME: "{{ user_home }}" - register: workstation_mise_java_25_where - changed_when: false - failed_when: false - -- name: Check whether the pinned Maven version is installed with Mise - tags: [packages, mise, maven, wsl] - ansible.builtin.command: - cmd: "mise where maven@{{ workstation_mise_maven_version }}" - become_user: "{{ username }}" - environment: - HOME: "{{ user_home }}" - register: workstation_mise_maven_where - changed_when: false - failed_when: false - -- name: Install the pinned Mise tools - tags: [packages, mise, java, maven, wsl] - ansible.builtin.command: - cmd: mise install - become_user: "{{ username }}" - environment: - HOME: "{{ user_home }}" - when: >- - workstation_mise_java_where.rc != 0 or - workstation_mise_java_25_where.rc != 0 or - workstation_mise_maven_where.rc != 0 - - name: Ensure WSL boot configuration file exists tags: [packages, services] ansible.builtin.file: diff --git a/ansible/roles/profile_workstation_dev_wsl/templates/cdp-devcontainer.json.j2 b/ansible/roles/profile_workstation_dev_wsl/templates/cdp-devcontainer.json.j2 new file mode 100644 index 0000000..7bdf614 --- /dev/null +++ b/ansible/roles/profile_workstation_dev_wsl/templates/cdp-devcontainer.json.j2 @@ -0,0 +1,60 @@ +{ + "name": "cdp — Java 25 / Node 20", + "build": { + "dockerfile": "Dockerfile", + "args": { + "MAVEN_VERSION": {{ workstation_maven_version | to_json }}, + "NODE_VERSION": {{ workstation_cdp_node_version | to_json }} + } + }, + "remoteUser": "vscode", + "updateRemoteUserUID": true, + "containerEnv": { + "CLAUDE_CONFIG_DIR": "/home/vscode/.claude" + }, + "remoteEnv": { + "ANTHROPIC_AUTH_TOKEN": "${localEnv:ANTHROPIC_AUTH_TOKEN}" + }, + "features": { + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { + "moby": false + } + }, + "mounts": [ + {{ ('type=bind,source=' ~ ecaas_agent_state ~ '/git,target=/run/ecaas-git,readonly') | to_json }}, +{% for ca in ecaas_git_available_cas %} + {{ ('type=bind,source=' ~ user_home ~ '/.local/share/certs/' ~ ca.certificate ~ ',target=/run/ecaas-git-ca/' ~ ca.certificate ~ ',readonly') | to_json }}, +{% endfor %} + {{ ('type=bind,source=' ~ user_home ~ '/.config/ai,target=/home/vscode/.config/ai,readonly') | to_json }}, + {{ ('type=bind,source=' ~ user_home ~ '/.claude,target=/home/vscode/.claude') | to_json }}, + {{ ('type=bind,source=' ~ user_home ~ '/.cline,target=/home/vscode/.cline') | to_json }}, + {{ ('type=bind,source=' ~ user_home ~ '/.m2,target=/home/vscode/.m2') | to_json }}, + {{ ('type=bind,source=' ~ user_home ~ '/.config/glab-cli,target=/home/vscode/.config/glab-cli') | to_json }}, + {{ ('type=bind,source=' ~ user_home ~ '/.kube,target=/home/vscode/.kube') | to_json }} + ], + "forwardPorts": [4200, 4201, 4202, 4210, 8083, 8084], + "customizations": { + "vscode": { + "extensions": [ + "vscjava.vscode-java-pack", + "vmware.vscode-boot-dev-pack", + "redhat.vscode-xml", + "redhat.vscode-yaml", + "ms-kubernetes-tools.vscode-kubernetes-tools", + "angular.ng-template", + "dbaeumer.vscode-eslint", + "emmanuelbeziat.vscode-great-icons" + ], + "settings": { + "workbench.iconTheme": "vscode-great-icons", + "java.configuration.runtimes": [ + { + "name": "JavaSE-25", + "path": "/usr/lib/jvm/msopenjdk-current", + "default": true + } + ] + } + } + } +} diff --git a/ansible/roles/profile_workstation_dev_wsl/templates/ecaas-devcontainer.json.j2 b/ansible/roles/profile_workstation_dev_wsl/templates/ecaas-devcontainer.json.j2 index f15c31e..24e7aae 100644 --- a/ansible/roles/profile_workstation_dev_wsl/templates/ecaas-devcontainer.json.j2 +++ b/ansible/roles/profile_workstation_dev_wsl/templates/ecaas-devcontainer.json.j2 @@ -3,7 +3,7 @@ "build": { "dockerfile": "Dockerfile", "args": { - "MAVEN_VERSION": {{ workstation_mise_maven_version | to_json }} + "MAVEN_VERSION": {{ workstation_maven_version | to_json }} } }, "remoteUser": "vscode", @@ -11,14 +11,24 @@ "containerEnv": { "CLAUDE_CONFIG_DIR": "/home/vscode/.claude" }, + "remoteEnv": { + "ANTHROPIC_AUTH_TOKEN": "${localEnv:ANTHROPIC_AUTH_TOKEN}" + }, + "features": { + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { + "moby": false + } + }, "mounts": [ {{ ('type=bind,source=' ~ ecaas_agent_state ~ '/git,target=/run/ecaas-git,readonly') | to_json }}, {% for ca in ecaas_git_available_cas %} {{ ('type=bind,source=' ~ user_home ~ '/.local/share/certs/' ~ ca.certificate ~ ',target=/run/ecaas-git-ca/' ~ ca.certificate ~ ',readonly') | to_json }}, {% endfor %} - {{ ('type=bind,source=' ~ ecaas_agent_state ~ '/ai,target=/home/vscode/.config/ai,readonly') | to_json }}, - {{ ('type=bind,source=' ~ ecaas_agent_state ~ '/claude,target=/home/vscode/.claude') | to_json }}, - {{ ('type=bind,source=' ~ ecaas_agent_state ~ '/cline,target=/home/vscode/.cline') | to_json }} + {{ ('type=bind,source=' ~ user_home ~ '/.config/ai,target=/home/vscode/.config/ai,readonly') | to_json }}, + {{ ('type=bind,source=' ~ user_home ~ '/.claude,target=/home/vscode/.claude') | to_json }}, + {{ ('type=bind,source=' ~ user_home ~ '/.cline,target=/home/vscode/.cline') | to_json }}, + {{ ('type=bind,source=' ~ user_home ~ '/.m2,target=/home/vscode/.m2') | to_json }}, + {{ ('type=bind,source=' ~ user_home ~ '/.config/glab-cli,target=/home/vscode/.config/glab-cli') | to_json }} ], "forwardPorts": [8080], "customizations": { @@ -28,10 +38,10 @@ "vmware.vscode-boot-dev-pack", "redhat.vscode-xml", "redhat.vscode-yaml", - "anthropic.claude-code", - "saoudrizwan.claude-dev" + "emmanuelbeziat.vscode-great-icons" ], "settings": { + "workbench.iconTheme": "vscode-great-icons", "java.jdt.ls.java.home": "/opt/jdk-21", "spring-boot.ls.java.home": "/opt/jdk-21", "java.configuration.runtimes": [ diff --git a/docs/deadalus-cdp-devcontainer.md b/docs/deadalus-cdp-devcontainer.md new file mode 100644 index 0000000..aad20a9 --- /dev/null +++ b/docs/deadalus-cdp-devcontainer.md @@ -0,0 +1,43 @@ +# cdp Java 25 / Node 20 dev container on deadalus + +Same toolset and mounts as the [ecaas container](deadalus-ecaas-devcontainer.md) +(Git configuration and GitLab CAs, Bash configuration, `~/.m2`, `~/.claude`, +`~/.cline`, `~/.config/ai`, Docker outside of Docker, Claude Code, Cline, delta, +Great Icons), with these differences: + +- Java 25 (`mcr.microsoft.com/devcontainers/java:25-bookworm`) is the default JDK + and also runs the Java and Spring language servers; there is no second JDK. +- Maven is `workstation_maven_version`; Node is + `workstation_cdp_node_version` (20.18.3) from the official Node image, used by + the Angular Module Federation front ends and the Claude/Cline CLIs. +- Angular Language Service and ESLint are added; forwarded ports are 4200, 4201, + 4202, 4210 (front ends) and 8083, 8084 (`mediation-ansc`, `ansc-allegati`). +- `kubectl` 1.37.1 and Helm 4.2.2 are installed from the official releases with + pinned SHA-256 checksums (amd64 and arm64), and the Kubernetes VS Code + extension is added. The WSL `~/.kube` is bind-mounted read-write at + `/home/vscode/.kube`, so contexts, tokens and cached data are shared with the + host; the current `config` embeds the Rancher CA and credentials, which are + therefore readable by anything in the container. The Rancher endpoint must be + reachable from the container (VPN). `KUBECONFIG` on the host is not forwarded. +- `glab` 1.114.0 (pinned checksum) is installed and `~/.config/glab-cli` is + mounted read-write, as described in the ecaas document (tokens included). + +Legacy `serv_roma-capitale-*` modules target Java 21 / Spring Boot 3.3.4 and +are not covered by this image's JDK. + +The workspace is multi-repo and not a Git repository itself; open +`~/Work/sipo/cdp` from Fedora WSL. Maven needs the internal Nexus (VPN) and +`-s settings.xml`, as described in the workspace `AGENTS.md`. + +```sh +ansible-playbook ansible/site.yml --limit deadalus --tags cdp_devcontainer -K +``` + +The deploy writes `~/Work/sipo/cdp/.devcontainer/` (`devcontainer.json`, +`Dockerfile`, `bashrc`, `bashrc.aliases`), backing up changed files. It shares +the rendered Git configuration in `~/.local/state/ecaas-devcontainer/git` with +the ecaas container and therefore also requires the ecaas GitLab CA. Then run +**Dev Containers: Reopen in Container**. The `ANTHROPIC_AUTH_TOKEN` forwarding +and credential caveats are the same as for ecaas. + +Verify inside: `java -version`, `mvn -v`, `node -v` (v20.18.3), `docker info`. diff --git a/docs/deadalus-ecaas-devcontainer.md b/docs/deadalus-ecaas-devcontainer.md index adb8d16..593ef2e 100644 --- a/docs/deadalus-ecaas-devcontainer.md +++ b/docs/deadalus-ecaas-devcontainer.md @@ -19,14 +19,16 @@ Do not use the production context to build or open the workspace. The container uses Java 11 for the application and Maven, and Java 21 only for the Java and Spring language servers. VS Code installs the Java and Spring Boot -extension packs, XML, YAML, Claude Code and Cline inside the container. The Java +extension packs, XML, YAML and the VSCode Great Icons theme (selected as the +file icon theme) inside the container. The Java pack includes Maven, the Java debugger and test integration. Prefer the project's Maven wrapper where present. Node is provided for the Claude and Cline CLIs. Git is installed in the container. The image uses the repository's portable Bash configuration: prompt with Git status, aliases, history search, completion, -`fzf` and `zoxide`. The image -does not load the WSL host's Mise hook, production aliases, or Bash history. +`fzf` and `zoxide`. The shared `.bashrc.aliases` is copied minus the +production `npm-tunnel` alias. The image +does not load the WSL host's production aliases or Bash history. Run the deploy and rebuild the container to pick up changes to the shared Bash configuration. @@ -49,27 +51,58 @@ Open the project from Fedora WSL so VS Code Dev Containers can reuse WSL's HTTPS credential helper (including an existing `.git-credentials` used by `credential.helper=store`) and forward the SSH agent if configured. GPG signing remains enabled and needs the work key available through the GPG -agent. No credential file, SSH private key, or GPG private key is copied or -mounted by the playbook. Do not forward a production SSH identity to this +agent. The WSL `~/.m2` (repository cache and `settings*.xml`, which may hold Maven +server credentials) is bind-mounted read-write at `/home/vscode/.m2`. No other +credential file, SSH private key, or GPG private key is copied or mounted by +the playbook. Do not forward a production SSH identity to this development workspace. To verify GitLab access from the container without changing the repo, run `git ls-remote origin HEAD` after checking that `origin` is the expected GitLab repository. +## Docker + +The `docker-outside-of-docker` Dev Container feature installs the Docker CLI +and Compose plugin and shares the local Fedora WSL engine's socket +(`/var/run/docker.sock`) with the container. Containers started from inside are +siblings on the WSL engine, and bind-mount sources resolve on the WSL host. +The socket grants root-equivalent control of that engine, and the container +never sees the host's Docker contexts, so the production context is +unreachable. Verify with `docker info` and `docker compose version`. + +## GitLab CLI + +`glab` 1.114.0 is installed from the official `.deb` with a pinned SHA-256 +checksum (amd64 and arm64). The WSL `~/.config/glab-cli` is bind-mounted +read-write at `/home/vscode/.config/glab-cli`, so hosts, API tokens and +`skip_tls_verify` settings are shared with the host and readable by anything in +the container; changes made by `glab` inside affect the WSL configuration. +`GITLAB_TOKEN` and similar variables from the host are not forwarded. + ## Agent configuration and smoke test -Claude and Cline seed only the supported settings, instructions, rules and -skills present in the Fedora home into `~/.local/state/ecaas-devcontainer/` -on the host. The initial import does not overwrite existing container settings -or synchronize later changes back to WSL. Rules and skills imported from WSL -must be trusted; host paths and tools referenced by them may need adaptation. -Dedicated credential stores, provider files, VS Code global storage, and MCP -configuration are not imported. Do not embed secrets in the settings or rules -being imported. Sign in or configure providers inside the container when -prompted; legacy Cline settings kept only in VS Code are not migrated. -The state directory is private and must not be committed. Neither the Docker -socket nor the full host home is mounted. +Claude and Cline use the WSL configuration directly: `~/.claude` and `~/.cline` +are bind-mounted read-write at `/home/vscode/.claude` and `/home/vscode/.cline`, +and `~/.config/ai` read-only at `/home/vscode/.config/ai`. Settings, rules, +skills, MCP configuration, sessions and **credential stores** are therefore +shared with, and visible to, the container, and changes made inside it affect +the WSL home. Host paths and tools referenced by rules or skills may need +adaptation. The WSL login is the `ANTHROPIC_AUTH_TOKEN` exported by +`~/.bashrc.d/60-claude-code.sh`, not the OAuth file. `remoteEnv` forwards it with +`${localEnv:ANTHROPIC_AUTH_TOKEN}`: the value is never written to the repository +or the image, but it is visible to processes in the container. VS Code must +therefore be started from a WSL shell that exports it (`code .` after opening a +new terminal; fully close any running VS Code server first). The endpoint and +model come from the mounted `settings.json`. With `CLAUDE_CONFIG_DIR` set, Claude reads its account state from +`~/.claude/.claude.json` instead of `~/.claude.json`, so the playbook seeds the +missing `oauthAccount`, `hasCompletedOnboarding` and `userID` keys there from +the WSL file without overwriting existing keys (`~/.claude.json` itself is not +mounted); VS Code global storage is not shared +either, so legacy Cline settings kept only there are not migrated. The full +host home is not mounted. `~/.local/state/ecaas-devcontainer/` now holds only +the rendered Git configuration. + From the integrated terminal inside the Dev Container, verify: diff --git a/dotfiles/workstation_dev_wsl/.bashrc.d/30-mise.sh b/dotfiles/workstation_dev_wsl/.bashrc.d/30-mise.sh deleted file mode 100644 index aa3f07b..0000000 --- a/dotfiles/workstation_dev_wsl/.bashrc.d/30-mise.sh +++ /dev/null @@ -1,4 +0,0 @@ -# Activate Mise for interactive Bash sessions, including JAVA_HOME for its JDKs. -if command -v mise >/dev/null 2>&1; then - eval "$(mise activate bash)" -fi diff --git a/dotfiles/workstation_dev_wsl/.config/mise/config.toml b/dotfiles/workstation_dev_wsl/.config/mise/config.toml deleted file mode 100644 index 41ab9e6..0000000 --- a/dotfiles/workstation_dev_wsl/.config/mise/config.toml +++ /dev/null @@ -1,6 +0,0 @@ -[tools] -java = ["25.0.2", "temurin-11.0.31+11"] -maven = "3.9.16" - -[env] -JAVA_HOME = "{{ env.HOME }}/.local/share/mise/installs/java/25.0.2"