mirror of
https://github.com/fscotto/infra.git
synced 2026-11-26 13:49:52 +00:00
Compare commits
23 Commits
0bd0a4589b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a9ecffecf | ||
| 012cb3534b | |||
| 47acda71b6 | |||
|
|
e74088e85b | ||
|
|
e2370ec91d | ||
|
|
59160abf0d | ||
| cdc102a970 | |||
| 66925b1d0d | |||
| 3facf61866 | |||
| 0b30890464 | |||
| ffa9960c64 | |||
| 7b85314cca | |||
| 95630f74d3 | |||
|
|
a2dca0e0d1 | ||
|
|
269f08a332 | ||
| 3f3781437b | |||
| 52c3615d26 | |||
| 4df3067c38 | |||
|
|
94eb555ff3 | ||
|
|
25a3b97b14 | ||
|
|
e8db4e5f38 | ||
|
|
2cadbf25eb | ||
|
|
d26dddd822 |
40
AGENTS.md
40
AGENTS.md
@@ -7,7 +7,7 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora
|
||||
- Inventory and layering inputs: `ansible/inventory/hosts.yml`, `ansible/inventory/group_vars/*.yml`, `ansible/inventory/host_vars/*.yml`
|
||||
- Dotfiles live under `dotfiles/`
|
||||
- AI agent instructions (bootstrap, dispatcher, knowledge, rules, patterns) are centralized in `dotfiles/common/.config/ai/` and shared between OpenCode, Codex, Gemini CLI, and Cline.
|
||||
- OpenCode loads its entrypoint configuration from `dotfiles/common/.config/opencode/opencode.json`; Codex global instructions deploy from `dotfiles/common/.codex/AGENTS.md`; Cline global instructions deploy from the cross-tool `dotfiles/common/.agents/AGENTS.md` (to `~/.agents/AGENTS.md`).
|
||||
- OpenCode loads its entrypoint configuration from `dotfiles/common/.config/opencode/opencode.json`; Codex global instructions deploy from `dotfiles/common/.codex/AGENTS.md`; Cline deploys both the cross-tool `dotfiles/common/.agents/AGENTS.md` pointer (to `~/.agents/AGENTS.md`) and the always-on global rule `dotfiles/common/.cline/rules/ai-context.md` (to `~/.cline/rules/`), which auto-binds the deployed `bootstrap.md`, dispatcher, safety directives, and distilled ChatGPT knowledge.
|
||||
- Codex config is rendered from `dotfiles/common/.codex/config.toml.j2` so `model_instructions_file` points to the deployed `~/.config/ai/bootstrap.md`.
|
||||
- ChatGPT conversation memory is stored in `dotfiles/common/.config/ai/memory/chatgpt/` and regenerated incrementally by `scripts/chatgpt_export_to_memory.py` from an official ChatGPT data export.
|
||||
|
||||
@@ -29,9 +29,10 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora
|
||||
- Keep completed one-time cleanup operations out of the playbook. Execute them directly
|
||||
with explicit authorization; retain only the ongoing desired-state configuration and
|
||||
historical documentation, not permanent cleanup flags or tasks.
|
||||
- Use Git Flow branch prefixes: `feature/` for new functionality, `bugfix/` for non-urgent fixes,
|
||||
`hotfix/` for urgent production fixes, `release/` for release preparation, and `support/` for
|
||||
maintained release lines. Do not use abbreviated prefixes such as `feat/`.
|
||||
- Use trunk-based development: `main` is the single long-lived branch. Land small,
|
||||
validated changes quickly, either as direct commits or via short-lived branches merged
|
||||
as soon as validation passes. Do not maintain `release/`, `support/`, or other
|
||||
long-lived branch lines: tag releases from the trunk and fix production issues on it.
|
||||
- Desktop and WSL hosts use `ansible_connection: local`; remote infrastructure hosts use SSH.
|
||||
- Treat `secrets/` as sensitive. Never print secret values.
|
||||
- Tmux plugins are bootstrapped by TPM on the host; the repo only keeps tmux config and custom helper scripts.
|
||||
@@ -104,6 +105,8 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora
|
||||
- Prefer declarative modules over `command`/`shell`; when `shell` is required, make idempotency and failure behavior explicit.
|
||||
- Start YAML files with `---`, use 2-space indentation, and keep file modes quoted like `"0644"`.
|
||||
- Keep booleans as booleans and structured vars as YAML lists/maps.
|
||||
- Group similar tasks into list variables (typically in `group_vars`) and apply them
|
||||
with a single task looping over the list, rather than one near-identical task per item.
|
||||
- Put host-specific overrides in `host_vars`, not shared `group_vars`.
|
||||
- Use `no_log: true` for secret-bearing task inputs or outputs.
|
||||
|
||||
@@ -138,7 +141,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
|
||||
@@ -228,6 +230,19 @@ The dotfile vars follow the same split: `desktop_common_dotfiles` carries mode-i
|
||||
injecting the private token for JSON-RPC POST clients; keep this route
|
||||
authenticated and never expose the gateway directly. See `docs/atlas-aria2.md`.
|
||||
|
||||
- Atlas Nextcloud backup preparation (`atlas-nextcloud-backup.service`) is an ordered
|
||||
requirement of the nightly `atlas-borg-backup.service` and the operator-started
|
||||
`atlas-usb-backup.service`. A structurally complete bundle younger than
|
||||
`atlas_nextcloud_backup_reuse_max_seconds` (20 h, asserted below 24 h so the nightly
|
||||
Borg cycle always refreshes it) is reused without pausing the applications: a manual
|
||||
USB run therefore reaches its LUKS prompt within seconds, while preparation failure
|
||||
still blocks the dependent job. Force one fresh preparation with
|
||||
`systemctl set-environment ATLAS_NEXTCLOUD_BACKUP_FORCE=1` before the start and unset
|
||||
the variable afterwards. Deployed and validated on 2026-11-15: a dependency start reused
|
||||
a verified bundle 14 h old and skipped preparation in 14 ms, and an operator-started
|
||||
USB run reached its LUKS prompt in under a second; the FORCE path has not been exercised
|
||||
in production yet. See `docs/atlas-nextcloud.md`.
|
||||
|
||||
## Atlas NAS TODO
|
||||
Completed validation: the existing RAIDZ2 pool and datasets, SELinux, LAN firewall, SSH, Cockpit with
|
||||
the selected 45Drives plugins, encrypted SMB3 `Archive`, the Aegis-only NFSv4 `photobook` export, and the
|
||||
@@ -549,7 +564,7 @@ validated exports of older historical data will use a dedicated Atlas NFS datase
|
||||
- Shared agent dotfiles live in `ai_agents_dotfiles`; rendered configs live in `ai_agents_templates`.
|
||||
- Every `ai_agents.<agent>` entry has independent `install_enabled`, `deploy_enabled`, and `uninstall_enabled` flags. Installation and removal must not both be true for the same agent; the common pre-task fails before changes when they conflict.
|
||||
- Fedora, Void desktop, and WSL workstation profiles consume the shared agent definitions; do not duplicate package entries in profile-specific vars. IBM Bob on the workstation follows its own flags.
|
||||
- WSL (`deadalus`) disables Codex installation and dotfile deployment and selects its managed npm package for removal through host overrides; existing Codex user state remains untouched.
|
||||
- WSL (`deadalus`) installs Claude Code, Codex and the Cline CLI; every other managed agent (including IBM Bob) is disabled and selected for removal through host overrides. `cline_deploy_enabled: true` also keeps Cline's cross-tool AGENTS pointer, global rules, and shared `~/.config/ai` context deployed on the host for the ecaas/cdp devcontainer bind mounts. Existing user state remains untouched.
|
||||
- `dotfiles_common` deploys `ai_agents_dotfiles` and renders `ai_agents_templates` only when deployment is enabled.
|
||||
- Removal is limited to the managed npm packages and `/usr/local/bin/bob`; never remove agent dotfiles, instructions, credentials, or user data.
|
||||
- Keep `.config/ai/` as the common instruction source; update agent-specific entrypoints to reference it rather than duplicating instruction text.
|
||||
@@ -589,3 +604,16 @@ validated exports of older historical data will use a dedicated Atlas NFS datase
|
||||
not depend on the AdGuard container during startup.
|
||||
- Aegis iCloudPD has been retired and is no longer managed by this role. Its service, Quadlet,
|
||||
data, and MFA state were removed with the operator's explicit authorization.
|
||||
|
||||
## Project Devcontainer Generator
|
||||
- `cmd/devcontainer/` generates standalone per-project language configurations;
|
||||
it does not replace existing deadalus ecaas/cdp provisioning or remove host tools.
|
||||
- Keep shared Git/agent behavior documented in `docs/project-devcontainers.md`.
|
||||
- Focused validation: `go -C cmd/devcontainer test ./...`.
|
||||
- Real engine builds, host credential forwarding and Fedora SELinux/Podman checks
|
||||
require target-host validation; do not report generator tests as runtime evidence.
|
||||
|
||||
- `devcontainer_generator` builds the CLI natively on Fedora graphical desktops
|
||||
and development workstations and installs it in `~/.local/bin/devcontainer`.
|
||||
Validate with `ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator --check --diff`;
|
||||
check mode skips compilation and binary installation explicitly.
|
||||
|
||||
@@ -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
|
||||
|
||||
33
README.md
33
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
|
||||
|
||||
@@ -577,8 +577,8 @@ ansible-playbook ansible/site.yml --limit <host> --tags emacs -e emacs_enabled=t
|
||||
## AI coding agents
|
||||
|
||||
The shared npm-managed agents are OpenCode, Claude Code, Codex, Gemini CLI, and
|
||||
GitHub Copilot; IBM Bob is also managed on `deadalus`. Codex Relay is installed
|
||||
only on `ikaros`. Each agent has its own lifecycle flags in
|
||||
GitHub Copilot; IBM Bob is also managed on Fedora workstations. Codex Relay is installed
|
||||
only on `ikaros`. On WSL (`deadalus`), Claude Code is the only installed coding agent. Each agent has its own lifecycle flags in
|
||||
`ansible/inventory/group_vars/all.yml`, so one agent can be installed,
|
||||
configured, or removed without affecting the others:
|
||||
|
||||
@@ -598,9 +598,12 @@ instructions, credentials, and user data. Installation and removal are mutually
|
||||
exclusive per agent: the playbook fails before making changes when both flags are
|
||||
true for the same agent. Servers set `ai_agents: {}` and therefore manage none.
|
||||
|
||||
On WSL (`deadalus`), Codex installation and dotfile deployment are disabled through
|
||||
host overrides; the managed `@openai/codex` npm package is selected for removal.
|
||||
Existing Codex configuration, credentials, and user data are left untouched.
|
||||
On WSL (`deadalus`), Claude Code, Codex and the Cline CLI are installed through
|
||||
`profile_workstation_dev_common`. Every other managed coding agent is disabled through
|
||||
host overrides and its managed npm package or `bob` binary is selected for removal.
|
||||
`cline_deploy_enabled: true` also keeps Cline's cross-tool AGENTS pointer, global rules,
|
||||
and shared `~/.config/ai` context deployed on the WSL host for the ecaas/cdp devcontainers.
|
||||
Existing configuration, credentials, and user data are left untouched.
|
||||
|
||||
The shared agent context is centralized in `dotfiles/common/.config/ai/` and
|
||||
deployed to `~/.config/ai/` for every enabled agent: `bootstrap.md` (operating
|
||||
@@ -609,8 +612,12 @@ context), `AGENTS.md` (task-specific file dispatcher), plus `knowledge/`,
|
||||
`instructions` array in `opencode.json`, Codex through `model_instructions_file`
|
||||
plus the global `~/.codex/AGENTS.md`, Gemini CLI through its settings context
|
||||
files, Claude Code through the `@` imports in `~/.claude/CLAUDE.md`, and Cline
|
||||
through the cross-tool `~/.agents/AGENTS.md` pointer (deployed with
|
||||
`cline_deploy_enabled: true`).
|
||||
through both the cross-tool `~/.agents/AGENTS.md` pointer and the always-on
|
||||
global rule `~/.cline/rules/ai-context.md`, which binds `bootstrap.md`, the
|
||||
dispatcher, the safety directives, and the distilled ChatGPT knowledge under
|
||||
`memory/chatgpt/` (both deployed with `cline_deploy_enabled: true`). Cline
|
||||
shows the rule in its Rules panel as `global:ai-context`, where it can be
|
||||
toggled per project.
|
||||
|
||||
ChatGPT conversation memory lives in
|
||||
`dotfiles/common/.config/ai/memory/chatgpt/`: one Markdown transcript per
|
||||
@@ -886,3 +893,13 @@ For a future Void desktop host:
|
||||
4. Put hardware-specific details in `host_vars/<host>.yml`.
|
||||
|
||||
The legacy `void` and `desktop` groups remain compatibility parents, so hosts in `platform_void` and `graphical_desktop` still receive the existing Void and desktop variables.
|
||||
|
||||
## Project devcontainer generator
|
||||
|
||||
Generate a reusable language environment for an existing project with
|
||||
`devcontainer ~/src/project --language python --agents codex,cline`.
|
||||
Git and selected coding-agent configuration are shared from the development host.
|
||||
See [profiles, host requirements and validation](docs/project-devcontainers.md).
|
||||
|
||||
Deploy `~/.local/bin/devcontainer` on a Fedora desktop/workstation with
|
||||
`ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator -K`.
|
||||
|
||||
@@ -93,6 +93,9 @@ common_dotfiles:
|
||||
# AI coding-agent lifecycle controls are independent for every agent.
|
||||
# Installation and removal are mutually exclusive per agent; the common
|
||||
# pre-task enforces this before any changes are made.
|
||||
opencode_install_enabled: true
|
||||
opencode_deploy_enabled: true
|
||||
opencode_uninstall_enabled: false
|
||||
codex_install_enabled: true
|
||||
codex_deploy_enabled: true
|
||||
codex_uninstall_enabled: false
|
||||
@@ -106,6 +109,8 @@ claude_code_uninstall_enabled: true
|
||||
cline_install_enabled: true
|
||||
cline_deploy_enabled: true
|
||||
cline_uninstall_enabled: false
|
||||
ibm_bob_install_enabled: true
|
||||
ibm_bob_uninstall_enabled: false
|
||||
|
||||
# npm registry requests can be interrupted transiently. Keep retries bounded
|
||||
# so persistent proxy, DNS, or registry failures still fail the play clearly.
|
||||
@@ -115,9 +120,9 @@ ai_agents_npm_install_retry_delay: 10
|
||||
ai_agents:
|
||||
opencode:
|
||||
npm_package: opencode-ai
|
||||
install_enabled: true
|
||||
deploy_enabled: true
|
||||
uninstall_enabled: false
|
||||
install_enabled: "{{ opencode_install_enabled }}"
|
||||
deploy_enabled: "{{ opencode_deploy_enabled }}"
|
||||
uninstall_enabled: "{{ opencode_uninstall_enabled }}"
|
||||
opencode_mobile:
|
||||
npm_package: opencode-mobile
|
||||
install_enabled: false
|
||||
@@ -154,9 +159,9 @@ ai_agents:
|
||||
deploy_enabled: false
|
||||
uninstall_enabled: true
|
||||
ibm_bob:
|
||||
install_enabled: true
|
||||
install_enabled: "{{ ibm_bob_install_enabled }}"
|
||||
deploy_enabled: false
|
||||
uninstall_enabled: false
|
||||
uninstall_enabled: "{{ ibm_bob_uninstall_enabled }}"
|
||||
|
||||
ai_agents_deploy_enabled_names: >-
|
||||
{{ ai_agents | dict2items | selectattr('value.deploy_enabled') | map(attribute='key') | list }}
|
||||
@@ -170,6 +175,7 @@ ai_agents_dotfiles:
|
||||
- opencode
|
||||
- codex
|
||||
- gemini_cli
|
||||
- cline
|
||||
- name: Gemini CLI config
|
||||
src: .gemini/
|
||||
dest: .gemini/
|
||||
@@ -200,6 +206,12 @@ ai_agents_dotfiles:
|
||||
mode: "0644"
|
||||
agents:
|
||||
- cline
|
||||
- name: Cline global rules
|
||||
src: .cline/rules/
|
||||
dest: .cline/rules/
|
||||
mode: preserve
|
||||
agents:
|
||||
- cline
|
||||
|
||||
ai_agents_templates:
|
||||
- name: Codex config
|
||||
|
||||
@@ -91,6 +91,7 @@ fedora_nerd_fonts:
|
||||
fedora_flatpak_packages:
|
||||
- be.alexandervanhee.gradia
|
||||
- com.spotify.Client
|
||||
- org.desktop_plus.desktop-plus
|
||||
- org.onlyoffice.desktopeditors
|
||||
- org.telegram.desktop
|
||||
|
||||
@@ -129,7 +130,8 @@ vscode_extensions:
|
||||
- esbenp.prettier-vscode
|
||||
- github.remotehub
|
||||
- ms-azuretools.vscode-containers
|
||||
- ms-azuretools.vscode-docker
|
||||
# ms-azuretools.vscode-docker is deprecated: since June 2025 it is just an
|
||||
# extension pack wrapping Container Tools. Only the real extension is kept.
|
||||
- ms-vscode-remote.remote-containers
|
||||
- ms-vscode-remote.remote-ssh
|
||||
- ms-vscode-remote.remote-ssh-edit
|
||||
@@ -139,8 +141,31 @@ vscode_extensions:
|
||||
- ms-vscode.remote-explorer
|
||||
- ms-vscode.remote-repositories
|
||||
- ms-vscode.remote-server
|
||||
- pkief.material-icon-theme
|
||||
- redhat.vscode-xml
|
||||
- redhat.vscode-yaml
|
||||
- saoudrizwan.claude-dev
|
||||
- vscodevim.vim
|
||||
vscode_settings: null
|
||||
# Managed user settings deploy as a full-file overlay with a timestamped backup;
|
||||
# any manual settings.json edit is converged away on the next run. These keys cover
|
||||
# the podman Dev Containers engine selection and the Container Tools clients.
|
||||
# editor.fontFamily uses the canonical 'JetBrainsMono Nerd Font' family name: the
|
||||
# live 'JetBriansMono NF' was a typo whose fallback chain rendered Liberation Mono.
|
||||
vscode_settings:
|
||||
containers.containerClient: com.microsoft.visualstudio.containers.podman
|
||||
containers.orchestratorClient: com.microsoft.visualstudio.orchestrators.podmancompose
|
||||
dev.containers.dockerPath: podman
|
||||
editor.cursorStyle: block
|
||||
editor.fontFamily: "'JetBrainsMono Nerd Font', 'Droid Sans Mono', monospace"
|
||||
editor.formatOnPaste: true
|
||||
workbench.iconTheme: material-icon-theme
|
||||
workbench.startupEditor: none
|
||||
# User-level keybindings apply to every window, including Dev Containers, SSH and WSL remotes.
|
||||
# Keys avoid Ctrl+<letter>, which the Vim extension uses for its motions; Alt is not bound by Vim.
|
||||
vscode_keybindings:
|
||||
- key: alt+j
|
||||
command: workbench.action.terminal.toggleTerminal
|
||||
when: "!terminalFocus"
|
||||
- key: alt+j
|
||||
command: workbench.action.togglePanel
|
||||
when: terminalFocus
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -2,12 +2,29 @@
|
||||
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.
|
||||
codex_install_enabled: false
|
||||
# Claude Code, Codex and the Cline CLI are the coding agents installed on WSL; every
|
||||
# other managed agent is disabled. Cline's cross-tool instructions (.agents/AGENTS.md,
|
||||
# .cline/rules/) and the shared ~/.config/ai context are deployed for the ecaas/cdp
|
||||
# devcontainers, and the cline npm package is installed by profile_workstation_dev_common.
|
||||
claude_code_install_enabled: true
|
||||
claude_code_uninstall_enabled: false
|
||||
opencode_install_enabled: false
|
||||
opencode_deploy_enabled: false
|
||||
opencode_uninstall_enabled: true
|
||||
codex_install_enabled: true
|
||||
codex_deploy_enabled: false
|
||||
codex_uninstall_enabled: true
|
||||
codex_uninstall_enabled: false
|
||||
gemini_cli_install_enabled: false
|
||||
gemini_cli_deploy_enabled: false
|
||||
gemini_cli_uninstall_enabled: true
|
||||
cline_install_enabled: true
|
||||
cline_deploy_enabled: true
|
||||
cline_uninstall_enabled: false
|
||||
ibm_bob_install_enabled: false
|
||||
ibm_bob_uninstall_enabled: true
|
||||
|
||||
host_packages: []
|
||||
host_enabled_services: []
|
||||
|
||||
@@ -151,7 +151,7 @@ gnome_gsettings_settings:
|
||||
value: "'file:///usr/share/backgrounds/gnome/morphogenesis-l.svg'"
|
||||
- schema: org.gnome.desktop.search-providers
|
||||
key: sort-order
|
||||
value: "['org.gnome.Settings.desktop', 'org.gnome.Contacts.desktop', 'org.gnome.Nautilus.desktop']"
|
||||
value: "['org.gnome.Settings.desktop', 'org.gnome.Contacts.desktop', 'org.gnome.Nautilus.desktop', 'org.mozilla.firefox.desktop', 'org.gnome.seahorse.Application.desktop', 'org.gnome.Calculator.desktop', 'org.gnome.Calendar.desktop', 'org.gnome.Software.desktop', 'org.gnome.Characters.desktop', 'org.gnome.Boxes.desktop', 'org.gnome.clocks.desktop', 'com.mattjakeman.ExtensionManager.desktop']"
|
||||
- schema: org.gnome.desktop.wm.keybindings
|
||||
key: switch-to-workspace-1
|
||||
value: "['<Super>1']"
|
||||
@@ -242,19 +242,19 @@ gnome_gsettings_settings:
|
||||
- schema: org.gnome.shell
|
||||
key: app-picker-layout
|
||||
value: >-
|
||||
[{'System': <{'position': <0>}>, 'Utilities': <{'position': <1>}>, 'org.fedoraproject.MediaWriter.desktop': <{'position': <2>}>, 'org.gnome.Contacts.desktop': <{'position': <3>}>, 'org.gnome.Calendar.desktop': <{'position': <4>}>, 'org.gnome.Calculator.desktop': <{'position': <5>}>, 'org.gnome.Weather.desktop': <{'position': <6>}>, 'org.gnome.clocks.desktop': <{'position': <7>}>, 'org.gnome.Maps.desktop': <{'position': <8>}>, 'org.gnome.SimpleScan.desktop': <{'position': <9>}>, 'org.gnome.TextEditor.desktop': <{'position': <10>}>, 'org.gnome.Settings.desktop': <{'position': <11>}>, 'org.gnome.Boxes.desktop': <{'position': <12>}>, 'org.gnome.Showtime.desktop': <{'position': <13>}>, 'org.gnome.Snapshot.desktop': <{'position': <14>}>, 'org.gnome.Characters.desktop': <{'position': <15>}>, 'org.gnome.Tour.desktop': <{'position': <16>}>, 'org.gnome.Yelp.desktop': <{'position': <17>}>, 'org.gnome.Software.desktop': <{'position': <18>}>, 'be.alexandervanhee.gradia.desktop': <{'position': <19>}>, 'com.github.jeromerobert.pdfarranger.desktop': <{'position': <20>}>, 'org.onlyoffice.desktopeditors.desktop': <{'position': <21>}>, 'org.gnome.Meld.desktop': <{'position': <22>}>, 'com.mattjakeman.ExtensionManager.desktop': <{'position': <23>}>}, {'com.raspberrypi.rpi-imager.desktop': <{'position': <0>}>, 'org.remmina.Remmina.desktop': <{'position': <1>}>, 'com.nextcloud.desktopclient.nextcloud.desktop': <{'position': <2>}>, 'syncthing-start.desktop': <{'position': <3>}>, 'syncthing-ui.desktop': <{'position': <4>}>, 'emacs.desktop': <{'position': <5>}>, 'emacs-client.desktop': <{'position': <6>}>, 'org.gnome.gitlab.somas.Apostrophe.desktop': <{'position': <7>}>, 'mpv.desktop': <{'position': <8>}>, 'htop.desktop': <{'position': <9>}>, 'ai-media-facefusion.desktop': <{'position': <10>}>, 'ai-media-rvc.desktop': <{'position': <11>}>}]
|
||||
[{'System': <{'position': <0>}>, 'Utilities': <{'position': <1>}>, 'org.fedoraproject.MediaWriter.desktop': <{'position': <2>}>, 'org.gnome.Contacts.desktop': <{'position': <3>}>, 'org.gnome.Calendar.desktop': <{'position': <4>}>, 'org.gnome.Calculator.desktop': <{'position': <5>}>, 'org.gnome.Weather.desktop': <{'position': <6>}>, 'org.gnome.clocks.desktop': <{'position': <7>}>, 'org.gnome.Maps.desktop': <{'position': <8>}>, 'org.gnome.SimpleScan.desktop': <{'position': <9>}>, 'org.gnome.TextEditor.desktop': <{'position': <10>}>, 'org.gnome.Settings.desktop': <{'position': <11>}>, 'org.gnome.Boxes.desktop': <{'position': <12>}>, 'org.gnome.Showtime.desktop': <{'position': <13>}>, 'org.gnome.Snapshot.desktop': <{'position': <14>}>, 'org.gnome.Characters.desktop': <{'position': <15>}>, 'org.gnome.Tour.desktop': <{'position': <16>}>, 'org.gnome.Yelp.desktop': <{'position': <17>}>, 'org.gnome.Software.desktop': <{'position': <18>}>, 'be.alexandervanhee.gradia.desktop': <{'position': <19>}>, 'com.github.jeromerobert.pdfarranger.desktop': <{'position': <20>}>, 'org.onlyoffice.desktopeditors.desktop': <{'position': <21>}>, 'org.gnome.Meld.desktop': <{'position': <22>}>, 'com.mattjakeman.ExtensionManager.desktop': <{'position': <23>}>}, {'com.raspberrypi.rpi-imager.desktop': <{'position': <0>}>, 'org.remmina.Remmina.desktop': <{'position': <1>}>, 'com.nextcloud.desktopclient.nextcloud.desktop': <{'position': <2>}>, 'syncthing-start.desktop': <{'position': <3>}>, 'syncthing-ui.desktop': <{'position': <4>}>, 'emacs.desktop': <{'position': <5>}>, 'emacs-client.desktop': <{'position': <6>}>, 'chatgpt.desktop': <{'position': <7>}>, 'org.gnome.gitlab.somas.Apostrophe.desktop': <{'position': <8>}>, 'mpv.desktop': <{'position': <9>}>, 'htop.desktop': <{'position': <10>}>, 'ai-media-facefusion.desktop': <{'position': <11>}>, 'ai-media-rvc.desktop': <{'position': <12>}>}]
|
||||
- schema: org.gnome.shell
|
||||
key: disabled-extensions
|
||||
value: >-
|
||||
['window-list@gnome-shell-extensions.gcampax.github.com', 'background-logo@fedorahosted.org', 'apps-menu@gnome-shell-extensions.gcampax.github.com', 'places-menu@gnome-shell-extensions.gcampax.github.com']
|
||||
['window-list@gnome-shell-extensions.gcampax.github.com', 'background-logo@fedorahosted.org', 'apps-menu@gnome-shell-extensions.gcampax.github.com', 'places-menu@gnome-shell-extensions.gcampax.github.com', 'maximize-new-windows@VitalyOstanin']
|
||||
- schema: org.gnome.shell
|
||||
key: enabled-extensions
|
||||
value: >-
|
||||
['status-icons@gnome-shell-extensions.gcampax.github.com', 'gnome-ui-tune@itstime.tech', 'appindicatorsupport@rgcjonas.gmail.com', 'bluetooth-battery-monitor@v8v88v8v88.com', 'clipboard-indicator@tudmotu.com', 'status-area-horizontal-spacing@mathematical.coffee.gmail.com', 'MaximizeWindowIntoNewWorkspace@kyleross.com', 'maximize-new-windows@VitalyOstanin']
|
||||
['status-icons@gnome-shell-extensions.gcampax.github.com', 'gnome-ui-tune@itstime.tech', 'appindicatorsupport@rgcjonas.gmail.com', 'bluetooth-battery-monitor@v8v88v8v88.com', 'clipboard-indicator@tudmotu.com', 'status-area-horizontal-spacing@mathematical.coffee.gmail.com', 'MaximizeWindowIntoNewWorkspace@kyleross.com', 'gnome-shell-extension-maximized-by-default@stiggimy.github.com']
|
||||
- schema: org.gnome.shell
|
||||
key: favorite-apps
|
||||
value: >-
|
||||
['org.gnome.Nautilus.desktop', 'org.mozilla.firefox.desktop', 'com.spotify.Client.desktop', 'net.thunderbird.Thunderbird.desktop', 'org.telegram.desktop.desktop', 'chatgpt.desktop', 'Cline.desktop', 'com.microsoft.VSCode.desktop', 'org.gnome.Ptyxis.desktop', 'virt-manager.desktop']
|
||||
['org.gnome.Nautilus.desktop', 'org.mozilla.firefox.desktop', 'com.spotify.Client.desktop', 'net.thunderbird.Thunderbird.desktop', 'org.telegram.desktop.desktop', 'Cline.desktop', 'org.desktop_plus.desktop-plus.desktop', 'com.microsoft.VSCode.desktop', 'org.gnome.Ptyxis.desktop', 'virt-manager.desktop']
|
||||
- schema: org.gnome.shell
|
||||
key: remember-mount-password
|
||||
value: "true"
|
||||
|
||||
4
ansible/roles/devcontainer_generator/defaults/main.yml
Normal file
4
ansible/roles/devcontainer_generator/defaults/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
devcontainer_generator_go_binary: /usr/bin/go
|
||||
devcontainer_generator_install_go: true
|
||||
devcontainer_generator_build_dir: "{{ user_home }}/.cache/infra/devcontainer-generator"
|
||||
64
ansible/roles/devcontainer_generator/tasks/main.yml
Normal file
64
ansible/roles/devcontainer_generator/tasks/main.yml
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
- name: Install Go compiler for the devcontainer generator
|
||||
ansible.builtin.dnf:
|
||||
name: golang
|
||||
state: present
|
||||
when: devcontainer_generator_install_go | bool
|
||||
|
||||
- name: Ensure devcontainer generator directories exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "{{ user_home }}/.local/bin"
|
||||
- "{{ devcontainer_generator_build_dir }}"
|
||||
|
||||
- name: Copy devcontainer generator sources
|
||||
ansible.builtin.copy:
|
||||
src: "{{ playbook_dir }}/../cmd/devcontainer/"
|
||||
dest: "{{ devcontainer_generator_build_dir }}/src/"
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: preserve
|
||||
|
||||
- name: Build devcontainer generator for the target host
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- "{{ devcontainer_generator_go_binary }}"
|
||||
- build
|
||||
- -trimpath
|
||||
- -buildvcs=false
|
||||
- -o
|
||||
- "{{ devcontainer_generator_build_dir }}/devcontainer"
|
||||
- .
|
||||
chdir: "{{ devcontainer_generator_build_dir }}/src"
|
||||
become_user: "{{ username }}"
|
||||
environment:
|
||||
GOCACHE: "{{ devcontainer_generator_build_dir }}/go-cache"
|
||||
GOTOOLCHAIN: local
|
||||
GOPROXY: "off"
|
||||
GOSUMDB: "off"
|
||||
CGO_ENABLED: "0"
|
||||
# Compilation refreshes a cached artifact; copy below reports installation changes.
|
||||
changed_when: false
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Install devcontainer generator in the user PATH
|
||||
ansible.builtin.copy:
|
||||
src: "{{ devcontainer_generator_build_dir }}/devcontainer"
|
||||
remote_src: true
|
||||
dest: "{{ user_home }}/.local/bin/devcontainer"
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0755"
|
||||
when: not ansible_check_mode
|
||||
|
||||
- name: Explain devcontainer generator check-mode behavior
|
||||
ansible.builtin.debug:
|
||||
msg: >-
|
||||
Check mode validates package and source deployment only. Compilation and
|
||||
installation of {{ user_home }}/.local/bin/devcontainer require a normal run.
|
||||
when: ansible_check_mode
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -18,6 +18,11 @@ atlas_nextcloud_redis_image: ""
|
||||
atlas_onlyoffice_image: ""
|
||||
atlas_nextcloud_backup_root: "{{ atlas_mount_root }}/backup/nextcloud"
|
||||
atlas_nextcloud_backup_keep: 2
|
||||
# A structurally complete bundle from an earlier verified run younger than
|
||||
# this many seconds is reused instead of re-preparing. Keep it below 24h so
|
||||
# the nightly Borg run, spaced 24h plus its randomized delay, always refreshes
|
||||
# the bundle; 0 disables reuse.
|
||||
atlas_nextcloud_backup_reuse_max_seconds: 72000
|
||||
atlas_nextcloud_admin: admin
|
||||
atlas_nextcloud_users: []
|
||||
atlas_nextcloud_apps: []
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
tags: [atlas, nextcloud_backup]
|
||||
when: atlas_manage_nextcloud | bool
|
||||
block:
|
||||
- name: Validate private backup scope and local bundle retention
|
||||
- name: Validate private backup scope, retention, and bundle reuse window
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- atlas_nextcloud_backup_root == atlas_mount_root ~ '/backup/nextcloud'
|
||||
- atlas_nextcloud_backup_keep | int >= 2
|
||||
- atlas_nextcloud_backup_reuse_max_seconds | int >= 0
|
||||
# Below 24h the nightly Borg run cannot reuse the previous bundle.
|
||||
- atlas_nextcloud_backup_reuse_max_seconds | int < 86400
|
||||
- atlas_manage_borg_backup | bool
|
||||
- atlas_manage_usb_backup | bool
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ StateDirectory=atlas-nextcloud-backup
|
||||
StateDirectoryMode=0700
|
||||
ExecStart=/usr/local/sbin/atlas-nextcloud-backup
|
||||
ExecStopPost=/usr/local/sbin/atlas-nextcloud-backup --recover
|
||||
# systemctl set-environment ATLAS_NEXTCLOUD_BACKUP_FORCE=1 makes the next run
|
||||
# ignore the bundle reuse window; unset the variable afterwards.
|
||||
PassEnvironment=ATLAS_NEXTCLOUD_BACKUP_FORCE
|
||||
TimeoutStartSec=3h
|
||||
TimeoutStopSec=5min
|
||||
Nice=10
|
||||
|
||||
@@ -7,6 +7,7 @@ readonly source_root={{ atlas_nextcloud_root | quote }}
|
||||
readonly backup_root={{ atlas_nextcloud_backup_root | quote }}
|
||||
readonly state=/var/lib/atlas-nextcloud-backup
|
||||
readonly keep={{ atlas_nextcloud_backup_keep | int }}
|
||||
readonly reuse_max={{ atlas_nextcloud_backup_reuse_max_seconds | int }}
|
||||
readonly owner={{ atlas_admin_username | quote }}
|
||||
readonly uid={{ atlas_admin_uid | int }}
|
||||
|
||||
@@ -64,6 +65,36 @@ recover() {
|
||||
}
|
||||
if [[ "${1:-}" == --recover ]]; then recover; exit; fi
|
||||
recover
|
||||
# Fast path: a structurally complete bundle from an earlier verified run is
|
||||
# reused while younger than the reuse window, without pausing the applications.
|
||||
# ATLAS_NEXTCLOUD_BACKUP_FORCE=1 ignores the window and prepares one anyway.
|
||||
if [[ "${ATLAS_NEXTCLOUD_BACKUP_FORCE:-0}" != 1 ]] && [[ "$reuse_max" -gt 0 ]]; then
|
||||
target="$(readlink -f "$backup_root/latest" 2>/dev/null || true)"
|
||||
if [[ -n "$target" && "$target" == "$backup_root/versions/"* ]]; then
|
||||
name="${target##*/}"
|
||||
if [[ "$name" =~ ^[0-9]{8}T[0-9]{6}Z-[0-9]+$ ]]; then
|
||||
bundle_utc="${name:0:4}-${name:4:2}-${name:6:2} ${name:9:2}:${name:11:2}:${name:13:2} UTC"
|
||||
created="$(date -u -d "$bundle_utc" +%s 2>/dev/null || true)"
|
||||
if [[ -n "$created" ]]; then
|
||||
now="$(date -u +%s)"
|
||||
if [[ "$((now - created))" -le "$reuse_max" ]]; then
|
||||
reusable=true
|
||||
for component in manifest.txt SHA256SUMS database.dump \
|
||||
postgres-globals.sql database-toc.txt images.txt; do
|
||||
[[ -s "$target/$component" ]] || { reusable=false; break; }
|
||||
done
|
||||
for component in app files; do
|
||||
[[ -d "$target/$component" ]] || { reusable=false; break; }
|
||||
done
|
||||
if [[ "$reusable" == true ]]; then
|
||||
echo "Reusing verified Nextcloud bundle $name (age $((now - created))s <= ${reuse_max}s); preparation skipped"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
[[ "$(zfs get -H -o value mounted "$dataset")" == yes ]]
|
||||
[[ "$(zfs get -H -o value mountpoint "$dataset")" == "$source_root" ]]
|
||||
[[ "$(zfs get -H -o value mounted {{ (atlas_zfs_pool ~ '/backup') | quote }})" == yes ]]
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0755"
|
||||
when: vscode_settings is not none
|
||||
when: vscode_settings is not none or vscode_keybindings | length > 0
|
||||
|
||||
- name: Deploy explicitly managed VS Code settings
|
||||
ansible.builtin.copy:
|
||||
@@ -58,3 +58,13 @@
|
||||
mode: "0644"
|
||||
backup: true
|
||||
when: vscode_settings is not none
|
||||
|
||||
- name: Deploy managed VS Code keybindings
|
||||
ansible.builtin.copy:
|
||||
dest: "{{ user_home }}/.config/Code/User/keybindings.json"
|
||||
content: "{{ vscode_keybindings | to_nice_json }}\n"
|
||||
owner: "{{ username }}"
|
||||
group: "{{ user_group }}"
|
||||
mode: "0644"
|
||||
backup: true
|
||||
when: vscode_keybindings | length > 0
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
---
|
||||
- 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 persistent Bash history directory mounted into the container exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ user_home }}/.local/state/devcontainer-bash-history/cdp"
|
||||
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: .agents, mode: "0755" }
|
||||
- { 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
|
||||
@@ -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,72 @@
|
||||
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 persistent Bash history directory mounted into the container exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ user_home }}/.local/state/devcontainer-bash-history/ecaas"
|
||||
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:
|
||||
- ""
|
||||
- /ai
|
||||
- /claude
|
||||
- /cline
|
||||
- /cline/data
|
||||
- /cline/data/settings
|
||||
- { path: .claude, mode: "0700" }
|
||||
- { path: .cline, mode: "0700" }
|
||||
- { path: .agents, mode: "0755" }
|
||||
- { 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 +117,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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"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",
|
||||
"HISTFILE": "/home/vscode/.bash_history.d/history"
|
||||
},
|
||||
"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 ~ '/.local/state/devcontainer-bash-history/cdp,target=/home/vscode/.bash_history.d') | 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 ~ '/.agents,target=/home/vscode/.agents,readonly') | 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",
|
||||
"saoudrizwan.claude-dev",
|
||||
"emmanuelbeziat.vscode-great-icons"
|
||||
],
|
||||
"settings": {
|
||||
"workbench.iconTheme": "vscode-great-icons",
|
||||
"java.configuration.runtimes": [
|
||||
{
|
||||
"name": "JavaSE-25",
|
||||
"path": "/usr/lib/jvm/msopenjdk-current",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,22 +3,35 @@
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"args": {
|
||||
"MAVEN_VERSION": {{ workstation_mise_maven_version | to_json }}
|
||||
"MAVEN_VERSION": {{ workstation_maven_version | to_json }}
|
||||
}
|
||||
},
|
||||
"remoteUser": "vscode",
|
||||
"updateRemoteUserUID": true,
|
||||
"containerEnv": {
|
||||
"CLAUDE_CONFIG_DIR": "/home/vscode/.claude"
|
||||
"CLAUDE_CONFIG_DIR": "/home/vscode/.claude",
|
||||
"HISTFILE": "/home/vscode/.bash_history.d/history"
|
||||
},
|
||||
"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 ~ '/.local/state/devcontainer-bash-history/ecaas,target=/home/vscode/.bash_history.d') | 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 ~ '/.agents,target=/home/vscode/.agents,readonly') | 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 +41,11 @@
|
||||
"vmware.vscode-boot-dev-pack",
|
||||
"redhat.vscode-xml",
|
||||
"redhat.vscode-yaml",
|
||||
"anthropic.claude-code",
|
||||
"saoudrizwan.claude-dev"
|
||||
"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": [
|
||||
|
||||
@@ -152,3 +152,12 @@
|
||||
|
||||
roles:
|
||||
- profile_workstation_dev_wsl
|
||||
|
||||
- name: Deploy project devcontainer generator
|
||||
hosts: platform_fedora
|
||||
become: true
|
||||
tags: [devcontainer_generator]
|
||||
|
||||
roles:
|
||||
- role: devcontainer_generator
|
||||
when: "'graphical_desktop' in group_names or 'workstation_dev_fedora' in group_names"
|
||||
|
||||
11
cmd/devcontainer/delta.Dockerfile
Normal file
11
cmd/devcontainer/delta.Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
RUN apt-get update \
|
||||
&& 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
|
||||
3
cmd/devcontainer/go.mod
Normal file
3
cmd/devcontainer/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module github.com/fscotto/infra/cmd/devcontainer
|
||||
|
||||
go 1.22
|
||||
351
cmd/devcontainer/main.go
Normal file
351
cmd/devcontainer/main.go
Normal file
@@ -0,0 +1,351 @@
|
||||
// Command devcontainer generates project configurations sharing host Git and agent state.
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//go:embed delta.Dockerfile
|
||||
var deltaDockerfile string
|
||||
|
||||
type profile struct {
|
||||
Image, Packages string
|
||||
Extensions []string
|
||||
}
|
||||
type agent struct {
|
||||
Package string
|
||||
Extension string
|
||||
Paths []string
|
||||
}
|
||||
type mount struct {
|
||||
Type string `json:"type"`
|
||||
Source string `json:"source"`
|
||||
Target string `json:"target"`
|
||||
ReadOnly bool `json:"readOnly"`
|
||||
}
|
||||
|
||||
func exists(path string) bool { _, err := os.Stat(path); return err == nil }
|
||||
func isDir(path string) bool { info, err := os.Stat(path); return err == nil && info.IsDir() }
|
||||
func quote(s string) string { return "'" + strings.ReplaceAll(s, "'", "'\"'\"'") + "'" }
|
||||
func symlink(path string) bool {
|
||||
info, err := os.Lstat(path)
|
||||
return err == nil && info.Mode()&os.ModeSymlink != 0
|
||||
}
|
||||
|
||||
func selectAgents(selection, home string) ([]string, error) {
|
||||
result := []string{}
|
||||
candidates := strings.Split(selection, ",")
|
||||
if selection == "none" {
|
||||
return result, nil
|
||||
}
|
||||
if selection == "auto" {
|
||||
candidates = nil
|
||||
for name := range agents {
|
||||
candidates = append(candidates, name)
|
||||
}
|
||||
sort.Strings(candidates)
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
for _, name := range candidates {
|
||||
name = strings.TrimSpace(name)
|
||||
a, ok := agents[name]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unknown agent %q", name)
|
||||
}
|
||||
available := true
|
||||
for _, path := range a.Paths {
|
||||
if !isDir(filepath.Join(home, path)) {
|
||||
available = false
|
||||
}
|
||||
}
|
||||
if selection == "auto" && !available {
|
||||
continue
|
||||
}
|
||||
if !seen[name] {
|
||||
result = append(result, name)
|
||||
seen[name] = true
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func generate(project, language, home string, selected []string, local []string, force bool) (string, error) {
|
||||
p, ok := profiles[language]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("unknown language %q", language)
|
||||
}
|
||||
project, err := filepath.Abs(project)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
project, err = filepath.EvalSymlinks(project)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
home, err = filepath.Abs(home)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
home, err = filepath.EvalSymlinks(home)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if !isDir(project) {
|
||||
return "", fmt.Errorf("project directory does not exist: %s", project)
|
||||
}
|
||||
if home == "/" || strings.ContainsAny(home, "\n\r$,\\\"") {
|
||||
return "", errors.New("unsupported host home path")
|
||||
}
|
||||
target := filepath.Join(project, ".devcontainer")
|
||||
if symlink(target) {
|
||||
return "", errors.New("refusing a symlinked .devcontainer directory")
|
||||
}
|
||||
if exists(target) && !force {
|
||||
return "", errors.New(".devcontainer already exists; use --force to replace generated files")
|
||||
}
|
||||
paths := []struct {
|
||||
path string
|
||||
readonly bool
|
||||
}{{".gitconfig", true}, {".config/git", true}, {".gitignore_global", true}, {".config/ai", true}}
|
||||
claude := false
|
||||
for _, name := range selected {
|
||||
a, ok := agents[name]
|
||||
if !ok {
|
||||
return "", fmt.Errorf("unknown agent %q", name)
|
||||
}
|
||||
for _, path := range a.Paths {
|
||||
if !isDir(filepath.Join(home, path)) {
|
||||
return "", fmt.Errorf("missing host directory for %s: %s", name, filepath.Join(home, path))
|
||||
}
|
||||
paths = append(paths, struct {
|
||||
path string
|
||||
readonly bool
|
||||
}{path, false})
|
||||
}
|
||||
if name == "claude" {
|
||||
claude = true
|
||||
}
|
||||
}
|
||||
if claude {
|
||||
paths = append(paths, struct {
|
||||
path string
|
||||
readonly bool
|
||||
}{".claude.json", false})
|
||||
}
|
||||
mounts := []mount{}
|
||||
for _, item := range paths {
|
||||
if exists(filepath.Join(home, item.path)) {
|
||||
destination := filepath.Join(home, item.path)
|
||||
if item.path == ".gitconfig" {
|
||||
destination = "/run/host-gitconfig"
|
||||
}
|
||||
mounts = append(mounts, mount{"bind", "${localEnv:HOME}/" + item.path, destination, item.readonly})
|
||||
}
|
||||
}
|
||||
// The devcontainers node feature ships an nvm-based Node outside sudo's
|
||||
// secure_path, which broke the postCreateCommand npm install. Copy the
|
||||
// official Node image binaries into /usr/local instead, exactly like the
|
||||
// ecaas and cdp devcontainers, so sudo npm works in every profile.
|
||||
needsNode := len(selected) > 0
|
||||
dockerfile := ""
|
||||
if needsNode {
|
||||
dockerfile += "FROM docker.io/library/node:22-bookworm-slim AS node\n"
|
||||
}
|
||||
dockerfile += fmt.Sprintf("FROM %s\nUSER root\nRUN apt-get update && apt-get install -y --no-install-recommends \\\n bash-completion ca-certificates curl fzf git git-lfs gnupg openssh-client ripgrep zoxide %s \\\n && rm -rf /var/lib/apt/lists/*\n", p.Image, p.Packages)
|
||||
if needsNode {
|
||||
dockerfile += "COPY --from=node /usr/local/bin/node /usr/local/bin/node\n"
|
||||
dockerfile += "COPY --from=node /usr/local/lib/node_modules/npm/ /usr/local/lib/node_modules/npm/\n"
|
||||
dockerfile += "RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \\\n && ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \\\n && node --version && npm --version\n"
|
||||
}
|
||||
dockerfile += deltaDockerfile
|
||||
if home != "/home/vscode" {
|
||||
dockerfile += "RUN usermod --home " + quote(home) + " --move-home vscode\n"
|
||||
}
|
||||
// Docker ENV uses its own quoting syntax, rather than shell quoting.
|
||||
envHome, _ := json.Marshal(home)
|
||||
dockerfile += "ENV HOME=" + string(envHome) + "\n"
|
||||
if language == "python" {
|
||||
dockerfile += "RUN python -m pip install --no-cache-dir uv ruff ty\n"
|
||||
}
|
||||
if language == "infra" {
|
||||
dockerfile += "RUN python -m pip install --no-cache-dir ansible-core ansible-lint yamllint\n"
|
||||
}
|
||||
// The container installs the profile extensions, the VS Code extension of
|
||||
// every selected agent and the extensions currently installed in the local
|
||||
// VS Code, captured at generation time. Regenerate to refresh the local set.
|
||||
extensions := append([]string{}, p.Extensions...)
|
||||
addExtension := func(id string) {
|
||||
if !slices.ContainsFunc(extensions, func(e string) bool { return strings.EqualFold(e, id) }) {
|
||||
extensions = append(extensions, id)
|
||||
}
|
||||
}
|
||||
for _, name := range selected {
|
||||
if id := agents[name].Extension; id != "" {
|
||||
addExtension(id)
|
||||
}
|
||||
}
|
||||
for _, id := range local {
|
||||
addExtension(strings.TrimSpace(id))
|
||||
}
|
||||
slices.Sort(extensions)
|
||||
config := map[string]any{
|
||||
"name": filepath.Base(project) + " — " + language,
|
||||
"build": map[string]string{"dockerfile": "Dockerfile"},
|
||||
"remoteUser": "vscode", "updateRemoteUserUID": true,
|
||||
"containerEnv": map[string]string{"HOME": home}, "mounts": mounts,
|
||||
"customizations": map[string]any{"vscode": map[string]any{"extensions": extensions}},
|
||||
}
|
||||
if len(selected) > 0 {
|
||||
packages := []string{}
|
||||
for _, name := range selected {
|
||||
packages = append(packages, quote(agents[name].Package))
|
||||
}
|
||||
config["postCreateCommand"] = "sudo npm install --global --no-audit --no-fund " + strings.Join(packages, " ")
|
||||
}
|
||||
if claude {
|
||||
config["remoteEnv"] = map[string]string{"ANTHROPIC_AUTH_TOKEN": "${localEnv:ANTHROPIC_AUTH_TOKEN}"}
|
||||
}
|
||||
dockerfile += "USER vscode\n"
|
||||
if exists(filepath.Join(home, ".gitconfig")) {
|
||||
dockerfile += "RUN git config --global include.path /run/host-gitconfig\n"
|
||||
}
|
||||
var data bytes.Buffer
|
||||
encoder := json.NewEncoder(&data)
|
||||
encoder.SetEscapeHTML(false)
|
||||
encoder.SetIndent("", " ")
|
||||
if err := encoder.Encode(config); err != nil {
|
||||
return "", err
|
||||
}
|
||||
files := []struct{ name, content string }{{"Dockerfile", dockerfile}, {"devcontainer.json", data.String()}}
|
||||
// Validate every output before replacing any file.
|
||||
for _, file := range files {
|
||||
path := filepath.Join(target, file.name)
|
||||
if info, err := os.Lstat(path); err == nil {
|
||||
if !info.Mode().IsRegular() {
|
||||
return "", fmt.Errorf("refusing non-regular output: %s", path)
|
||||
}
|
||||
} else if !os.IsNotExist(err) {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
if err := os.MkdirAll(target, 0755); err != nil {
|
||||
return "", err
|
||||
}
|
||||
for _, file := range files {
|
||||
if err := writeAtomic(filepath.Join(target, file.name), file.content); err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
return target, nil
|
||||
}
|
||||
|
||||
func writeAtomic(path, content string) error {
|
||||
file, err := os.CreateTemp(filepath.Dir(path), ".devcontainer-*")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.Remove(file.Name())
|
||||
if _, err = io.WriteString(file, content); err != nil {
|
||||
file.Close()
|
||||
return err
|
||||
}
|
||||
if err = file.Chmod(0644); err != nil {
|
||||
file.Close()
|
||||
return err
|
||||
}
|
||||
if err = file.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Rename(file.Name(), path)
|
||||
}
|
||||
|
||||
// discoverLocalExtensions lists the extensions installed in the local VS Code.
|
||||
// A missing or failing code binary is not fatal: the generated container then
|
||||
// only carries the profile and agent extensions.
|
||||
func discoverLocalExtensions(stderr io.Writer) []string {
|
||||
path, err := exec.LookPath("code")
|
||||
if err != nil {
|
||||
fmt.Fprintln(stderr, "note: no local VS Code found; skipping locally installed extensions")
|
||||
return nil
|
||||
}
|
||||
out, err := exec.Command(path, "--list-extensions").Output()
|
||||
if err != nil {
|
||||
fmt.Fprintf(stderr, "warning: could not list local VS Code extensions: %v\n", err)
|
||||
return nil
|
||||
}
|
||||
extensions := []string{}
|
||||
for _, line := range strings.Split(string(out), "\n") {
|
||||
if id := strings.TrimSpace(line); id != "" {
|
||||
extensions = append(extensions, id)
|
||||
}
|
||||
}
|
||||
return extensions
|
||||
}
|
||||
|
||||
func run(args []string, home string, out, stderr io.Writer) error {
|
||||
flags := flag.NewFlagSet("devcontainer", flag.ContinueOnError)
|
||||
flags.SetOutput(stderr)
|
||||
language := flags.String("language", "", "c-cpp, go, rust, python, node, java, infra (required)")
|
||||
selection := flags.String("agents", "auto", "auto, none, or comma-separated codex,cline,opencode,claude,gemini")
|
||||
force := flags.Bool("force", false, "Replace the two generated files")
|
||||
flags.Usage = func() {
|
||||
fmt.Fprintln(stderr, "Usage: devcontainer PROJECT --language LANGUAGE [--agents AGENTS] [--force]")
|
||||
flags.PrintDefaults()
|
||||
}
|
||||
// Accept the project's original position before the flags as well as flags first.
|
||||
if len(args) > 0 && !strings.HasPrefix(args[0], "-") {
|
||||
args = append(append([]string{}, args[1:]...), args[0])
|
||||
}
|
||||
if err := flags.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if flags.NArg() != 1 || *language == "" {
|
||||
flags.Usage()
|
||||
return errors.New("one project and --language are required")
|
||||
}
|
||||
selected, err := selectAgents(*selection, home)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
local := discoverLocalExtensions(stderr)
|
||||
target, err := generate(flags.Arg(0), *language, home, selected, local, *force)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
names := strings.Join(selected, ", ")
|
||||
if names == "" {
|
||||
names = "none"
|
||||
}
|
||||
fmt.Fprintf(out, "Created %s; agents: %s\n", target, names)
|
||||
if len(local) > 0 {
|
||||
fmt.Fprintf(out, "Included %d local VS Code extensions.\n", len(local))
|
||||
}
|
||||
fmt.Fprintln(out, "Open the project in VS Code and choose Dev Containers: Reopen in Container.")
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
home, err := os.UserHomeDir()
|
||||
if err == nil {
|
||||
err = run(os.Args[1:], home, os.Stdout, os.Stderr)
|
||||
}
|
||||
if errors.Is(err, flag.ErrHelp) {
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
281
cmd/devcontainer/main_test.go
Normal file
281
cmd/devcontainer/main_test.go
Normal file
@@ -0,0 +1,281 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func setup(t *testing.T) (string, string) {
|
||||
t.Helper()
|
||||
root := t.TempDir()
|
||||
home, project := filepath.Join(root, "host home"), filepath.Join(root, "project with spaces")
|
||||
for _, path := range []string{home, project} {
|
||||
if err := os.MkdirAll(path, 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
return home, project
|
||||
}
|
||||
func read(t *testing.T, path string) string {
|
||||
t.Helper()
|
||||
b, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
func put(t *testing.T, path, content string) {
|
||||
t.Helper()
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(path, []byte(content), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
type vscodeCustomizations struct {
|
||||
Customizations struct {
|
||||
Vscode struct {
|
||||
Extensions []string `json:"extensions"`
|
||||
} `json:"vscode"`
|
||||
} `json:"customizations"`
|
||||
}
|
||||
|
||||
func extensionsOf(t *testing.T, target string) []string {
|
||||
t.Helper()
|
||||
var config vscodeCustomizations
|
||||
if err := json.Unmarshal([]byte(read(t, filepath.Join(target, "devcontainer.json"))), &config); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return config.Customizations.Vscode.Extensions
|
||||
}
|
||||
|
||||
func TestProfiles(t *testing.T) {
|
||||
for name := range profiles {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
home, project := setup(t)
|
||||
target, err := generate(project, name, home, nil, nil, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var config map[string]any
|
||||
if err := json.Unmarshal([]byte(read(t, filepath.Join(target, "devcontainer.json"))), &config); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if config["containerEnv"].(map[string]any)["HOME"] != home {
|
||||
t.Fatal("wrong home")
|
||||
}
|
||||
if _, ok := config["postCreateCommand"]; ok {
|
||||
t.Fatal("unexpected agent install")
|
||||
}
|
||||
want := append([]string{}, profiles[name].Extensions...)
|
||||
slices.Sort(want)
|
||||
if got := extensionsOf(t, target); !slices.Equal(got, want) {
|
||||
t.Fatalf("wrong extensions: %v", got)
|
||||
}
|
||||
dockerfile := read(t, filepath.Join(target, "Dockerfile"))
|
||||
if !strings.HasPrefix(dockerfile, "FROM "+profiles[name].Image+"\n") || !strings.HasSuffix(dockerfile, "USER vscode\n") {
|
||||
t.Fatal("wrong Dockerfile")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
func TestSharedConfig(t *testing.T) {
|
||||
home, project := setup(t)
|
||||
put(t, filepath.Join(home, ".codex/auth.json"), "secret-value")
|
||||
put(t, filepath.Join(home, ".gitconfig"), "[user]\nname = Test\n")
|
||||
target, err := generate(project, "python", home, []string{"codex"}, nil, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
configText := read(t, filepath.Join(target, "devcontainer.json"))
|
||||
dockerfile := read(t, filepath.Join(target, "Dockerfile"))
|
||||
if strings.Contains(configText+dockerfile, "secret-value") {
|
||||
t.Fatal("credential leaked")
|
||||
}
|
||||
var config struct {
|
||||
Mounts []mount
|
||||
PostCreateCommand string
|
||||
}
|
||||
if err := json.Unmarshal([]byte(configText), &config); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
foundGit, foundAgent := false, false
|
||||
for _, m := range config.Mounts {
|
||||
if m.Target == "/run/host-gitconfig" {
|
||||
foundGit = m.ReadOnly
|
||||
}
|
||||
if m.Target == filepath.Join(home, ".codex") {
|
||||
foundAgent = !m.ReadOnly
|
||||
}
|
||||
}
|
||||
if !foundGit || !foundAgent || !strings.Contains(dockerfile, "include.path /run/host-gitconfig") {
|
||||
t.Fatal("incorrect sharing")
|
||||
}
|
||||
if !strings.Contains(config.PostCreateCommand, "@openai/codex") || !strings.Contains(dockerfile, "COPY --from=node /usr/local/bin/node") {
|
||||
t.Fatal("missing CLI install or embedded Node")
|
||||
}
|
||||
if !slices.Contains(extensionsOf(t, target), "openai.chatgpt") {
|
||||
t.Fatal("agent VS Code extension missing")
|
||||
}
|
||||
}
|
||||
func TestAgentAndLocalExtensions(t *testing.T) {
|
||||
home, project := setup(t)
|
||||
put(t, filepath.Join(home, ".cline/state/config"), "")
|
||||
put(t, filepath.Join(home, ".agents/AGENTS.md"), "")
|
||||
local := []string{"github.remotehub", "SAOUDRIZWAN.claude-dev", "ms-vscode.cpptools"}
|
||||
target, err := generate(project, "python", home, []string{"cline"}, local, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := []string{"ms-python.python", "charliermarsh.ruff", "saoudrizwan.claude-dev", "github.remotehub", "ms-vscode.cpptools"}
|
||||
slices.Sort(want)
|
||||
if got := extensionsOf(t, target); !slices.Equal(got, want) {
|
||||
t.Fatalf("extensions mismatch: %v", got)
|
||||
}
|
||||
}
|
||||
func TestAgentsShipNpmInsideSudoPath(t *testing.T) {
|
||||
for name := range profiles {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
home, project := setup(t)
|
||||
put(t, filepath.Join(home, ".cline/state/config"), "")
|
||||
put(t, filepath.Join(home, ".agents/AGENTS.md"), "")
|
||||
target, err := generate(project, name, home, []string{"cline"}, nil, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var config map[string]any
|
||||
if err := json.Unmarshal([]byte(read(t, filepath.Join(target, "devcontainer.json"))), &config); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, hasFeature := config["features"]; hasFeature {
|
||||
t.Fatal("the nvm-based node feature breaks the sudo npm postCreateCommand")
|
||||
}
|
||||
post, _ := config["postCreateCommand"].(string)
|
||||
if !strings.Contains(post, "sudo npm install") {
|
||||
t.Fatalf("missing npm agent install: %q", post)
|
||||
}
|
||||
dockerfile := read(t, filepath.Join(target, "Dockerfile"))
|
||||
if !strings.HasPrefix(dockerfile, "FROM docker.io/library/node:22-bookworm-slim AS node\n") ||
|
||||
!strings.Contains(dockerfile, "COPY --from=node /usr/local/bin/node /usr/local/bin/node") ||
|
||||
!strings.Contains(dockerfile, "ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm") {
|
||||
t.Fatal("npm must be reachable inside sudo's secure_path")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
func TestOverwriteAndSymlinks(t *testing.T) {
|
||||
home, project := setup(t)
|
||||
target, err := generate(project, "go", home, nil, nil, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
before := read(t, filepath.Join(target, "Dockerfile"))
|
||||
if _, err := generate(project, "rust", home, nil, nil, false); err == nil {
|
||||
t.Fatal("overwrote existing configuration")
|
||||
}
|
||||
path := filepath.Join(target, "devcontainer.json")
|
||||
if err := os.Remove(path); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
victim := filepath.Join(home, "victim")
|
||||
put(t, victim, "keep")
|
||||
if err := os.Symlink(victim, path); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := generate(project, "rust", home, nil, nil, true); err == nil {
|
||||
t.Fatal("accepted symlink")
|
||||
}
|
||||
if read(t, victim) != "keep" || read(t, filepath.Join(target, "Dockerfile")) != before {
|
||||
t.Fatal("changed files before rejecting symlink")
|
||||
}
|
||||
}
|
||||
func TestInvalidInputs(t *testing.T) {
|
||||
for _, kind := range []string{"agent", "language", "missing-directory", "home", "target-symlink"} {
|
||||
t.Run(kind, func(t *testing.T) {
|
||||
home, project := setup(t)
|
||||
language := "go"
|
||||
var selected []string
|
||||
switch kind {
|
||||
case "agent":
|
||||
selected = []string{"codex"}
|
||||
case "language":
|
||||
language = "unknown"
|
||||
case "missing-directory":
|
||||
project = filepath.Join(project, "missing")
|
||||
case "home":
|
||||
home = "/"
|
||||
case "target-symlink":
|
||||
if err := os.Symlink(home, filepath.Join(project, ".devcontainer")); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if _, err := generate(project, language, home, selected, nil, true); err == nil {
|
||||
t.Fatal("invalid input accepted")
|
||||
}
|
||||
if exists(filepath.Join(project, ".devcontainer/Dockerfile")) {
|
||||
t.Fatal("wrote invalid configuration")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
func TestAgentSelection(t *testing.T) {
|
||||
home, _ := setup(t)
|
||||
put(t, filepath.Join(home, ".codex/config.toml"), "")
|
||||
got, err := selectAgents("auto", home)
|
||||
if err != nil || strings.Join(got, ",") != "codex" {
|
||||
t.Fatalf("auto: %v %v", got, err)
|
||||
}
|
||||
got, err = selectAgents("codex,codex", home)
|
||||
if err != nil || len(got) != 1 {
|
||||
t.Fatal("duplicate agents")
|
||||
}
|
||||
if _, err := selectAgents("invalid", home); err == nil {
|
||||
t.Fatal("unknown agent accepted")
|
||||
}
|
||||
}
|
||||
func TestCLI(t *testing.T) {
|
||||
for _, first := range []bool{true, false} {
|
||||
t.Run(map[bool]string{true: "project-first", false: "flags-first"}[first], func(t *testing.T) {
|
||||
home, project := setup(t)
|
||||
args := []string{"--language", "go", "--agents", "none", project}
|
||||
if first {
|
||||
args = []string{project, "--language", "go", "--agents", "none"}
|
||||
}
|
||||
var out bytes.Buffer
|
||||
if err := run(args, home, &out, &out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(out.String(), "agents: none") {
|
||||
t.Fatal("missing output")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
func TestLocalExtensionDiscovery(t *testing.T) {
|
||||
bin := t.TempDir()
|
||||
script := filepath.Join(bin, "code")
|
||||
if err := os.WriteFile(script, []byte("#!/bin/sh\necho a.b\necho c.d\n"), 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Setenv("PATH", bin+string(os.PathListSeparator)+os.Getenv("PATH"))
|
||||
home, project := setup(t)
|
||||
var out bytes.Buffer
|
||||
if err := run([]string{project, "--language", "go", "--agents", "none"}, home, &out, &out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := []string{"a.b", "c.d", "golang.go"}
|
||||
slices.Sort(want)
|
||||
if got := extensionsOf(t, filepath.Join(project, ".devcontainer")); !slices.Equal(got, want) {
|
||||
t.Fatalf("extensions mismatch: %v", got)
|
||||
}
|
||||
if !strings.Contains(out.String(), "Included 2 local VS Code extensions.") {
|
||||
t.Fatal("missing local extensions summary")
|
||||
}
|
||||
}
|
||||
18
cmd/devcontainer/profiles.go
Normal file
18
cmd/devcontainer/profiles.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
var profiles = map[string]profile{
|
||||
"c-cpp": {Image: "mcr.microsoft.com/devcontainers/base:bookworm", Packages: "build-essential clang clangd cmake gdb valgrind universal-ctags cscope", Extensions: []string{"ms-vscode.cpptools", "ms-vscode.cmake-tools"}},
|
||||
"go": {Image: "mcr.microsoft.com/devcontainers/go:1.25-bookworm", Packages: "", Extensions: []string{"golang.go"}},
|
||||
"rust": {Image: "mcr.microsoft.com/devcontainers/rust:1-bookworm", Packages: "", Extensions: []string{"rust-lang.rust-analyzer"}},
|
||||
"python": {Image: "mcr.microsoft.com/devcontainers/python:3.13-bookworm", Packages: "", Extensions: []string{"ms-python.python", "charliermarsh.ruff"}},
|
||||
"node": {Image: "mcr.microsoft.com/devcontainers/javascript-node:22-bookworm", Packages: "", Extensions: []string{"esbenp.prettier-vscode"}},
|
||||
"java": {Image: "mcr.microsoft.com/devcontainers/java:21-bookworm", Packages: "maven", Extensions: []string{"vscjava.vscode-java-pack"}},
|
||||
"infra": {Image: "mcr.microsoft.com/devcontainers/python:3.13-bookworm", Packages: "shellcheck shfmt", Extensions: []string{"redhat.ansible", "redhat.vscode-yaml"}},
|
||||
}
|
||||
var agents = map[string]agent{
|
||||
"codex": {Package: "@openai/codex", Extension: "openai.chatgpt", Paths: []string{".codex"}},
|
||||
"cline": {Package: "cline", Extension: "saoudrizwan.claude-dev", Paths: []string{".cline", ".agents"}},
|
||||
"opencode": {Package: "opencode-ai", Extension: "sst-dev.opencode", Paths: []string{".config/opencode", ".local/share/opencode", ".local/state/opencode"}},
|
||||
"claude": {Package: "@anthropic-ai/claude-code@2.1.312", Extension: "anthropic.claude-code", Paths: []string{".claude"}},
|
||||
"gemini": {Package: "@google/gemini-cli", Extension: "Google.geminicodeassist", Paths: []string{".gemini"}},
|
||||
}
|
||||
@@ -141,11 +141,22 @@ See `atlas-nextcloud-recovery-test.md` for scope, retained artifact and limitati
|
||||
|
||||
## Recurring consistent bundles
|
||||
|
||||
`atlas-nextcloud-backup.service` is now an ordered requirement of both
|
||||
`atlas-nextcloud-backup.service` is an ordered requirement of both
|
||||
`atlas-borg-backup.service` and the operator-started `atlas-usb-backup.service`.
|
||||
No additional backup timer is needed: the existing Borg schedule prepares a fresh
|
||||
bundle before its pool snapshot, and a manual USB run does the same. Preparation
|
||||
failure blocks the dependent job rather than silently using an old dump.
|
||||
bundle before its pool snapshot. A structurally complete bundle from an earlier
|
||||
verified run is reused instead while younger than
|
||||
`atlas_nextcloud_backup_reuse_max_seconds` (20 h): a manual USB run then skips
|
||||
the application pause, reaches its LUKS prompt within seconds and captures the
|
||||
latest Borg-prepared bundle, while the remaining pool snapshot reflects the
|
||||
moment of the run. Reuse does not re-hash the bundle; it was checksum-verified
|
||||
at publication. The window is asserted below 24 h so the nightly Borg run,
|
||||
spaced 24 h plus its randomized delay, never reuses the previous night's bundle.
|
||||
Preparation failure still blocks the dependent job rather than silently using an
|
||||
old dump; only a verified, bounded-age bundle may be reused. Set
|
||||
`ATLAS_NEXTCLOUD_BACKUP_FORCE=1` with `systemctl set-environment` (the unit
|
||||
passes it through) to ignore the window once and prepare a fresh bundle; unset
|
||||
the variable afterwards.
|
||||
|
||||
The helper checks the mounted datasets and healthy active application state,
|
||||
serializes preparations and briefly pauses cron, Nextcloud and ONLYOFFICE. It
|
||||
@@ -171,10 +182,12 @@ sudo systemctl start atlas-nextcloud-backup.service
|
||||
sudo systemctl show atlas-nextcloud-backup.service -p Result -p ExecMainExitTimestamp
|
||||
```
|
||||
|
||||
The second command briefly interrupts the applications and is an explicit manual
|
||||
run of the recurring job, not a normal deployment side effect. The preparation
|
||||
unit is not enabled as a boot backup; only interrupted-job recovery is enabled.
|
||||
Do not stop a Borg/USB job, break its lock or unmount its source snapshot to run a test.
|
||||
A manual start briefly interrupts the applications only when it prepares a fresh
|
||||
bundle; inside the reuse window it logs `Reusing verified ...` and finishes in
|
||||
seconds without touching them. It remains an explicit manual run of the
|
||||
recurring job, not a normal deployment side effect. The preparation unit is not
|
||||
enabled as a boot backup; only interrupted-job recovery is enabled. Do not stop a
|
||||
Borg/USB job, break its lock or unmount its source snapshot to run a test.
|
||||
|
||||
On 2026-10-04, both a new encrypted Borg archive and USB version
|
||||
`20261004T101101Z-3420114` were independently extracted and their consistent
|
||||
|
||||
43
docs/deadalus-cdp-devcontainer.md
Normal file
43
docs/deadalus-cdp-devcontainer.md
Normal file
@@ -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`, `~/.agents`, `~/.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`.
|
||||
@@ -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, the Cline extension 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,64 @@ 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`,
|
||||
the cross-tool `~/.agents` read-only at `/home/vscode/.agents`, and
|
||||
`~/.config/ai` read-only at `/home/vscode/.config/ai`, so rules, the AGENTS
|
||||
pointer and the shared AI context follow the WSL host. The playbook keeps
|
||||
Cline's managed configuration deployed on the host (`cline_deploy_enabled:
|
||||
true`) even though the cline CLI npm package is not installed there; the CLI
|
||||
ships inside the image and the VS Code Cline extension is installed through
|
||||
the devcontainer customizations. 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:
|
||||
|
||||
|
||||
138
docs/project-devcontainers.md
Normal file
138
docs/project-devcontainers.md
Normal file
@@ -0,0 +1,138 @@
|
||||
# Reusable project devcontainers
|
||||
|
||||
`cmd/devcontainer/` is a Go CLI using only the standard library. Build it with
|
||||
Go 1.22 or newer, from an `infra` checkout:
|
||||
|
||||
```sh
|
||||
go -C cmd/devcontainer build -o "$HOME/.local/bin/devcontainer" .
|
||||
```
|
||||
|
||||
Create `~/.local/bin` first if needed and keep it on `PATH`. The resulting binary
|
||||
has no Python dependency. Run it on **the development host**, against an existing
|
||||
project:
|
||||
|
||||
```sh
|
||||
devcontainer ~/src/my-project --language go
|
||||
devcontainer ~/src/my-project --language python --agents codex,cline
|
||||
devcontainer ~/src/my-project --language c-cpp --agents none
|
||||
```
|
||||
|
||||
## Ansible deployment
|
||||
|
||||
On ikaros, nymph or deadalus, from the local `infra` checkout:
|
||||
|
||||
```sh
|
||||
ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator -K
|
||||
```
|
||||
|
||||
Replace the limit with `nymph` or `deadalus` as appropriate. The task installs
|
||||
Fedora's Go compiler, copies the sources into the user's build cache, compiles
|
||||
natively without downloading Go modules, and installs `~/.local/bin/devcontainer`
|
||||
with mode `0755`. Subsequent runs update the executable only when its contents
|
||||
change. Rebuilds use the Go cache. The role targets Fedora graphical desktops
|
||||
and Fedora development workstations; it does not start any containers.
|
||||
|
||||
Check mode validates packages and source deployment but skips compilation and
|
||||
binary installation, and reports that limitation explicitly:
|
||||
|
||||
```sh
|
||||
ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator --check --diff
|
||||
```
|
||||
|
||||
Profiles: `c-cpp`, `go`, `rust`, `python`, `node`, `java`, `infra`. They generate
|
||||
`.devcontainer/devcontainer.json` and `Dockerfile`. The generated
|
||||
`customizations.vscode.extensions` list combines the profile extensions, the VS
|
||||
Code extension of each selected agent (`cline` → `saoudrizwan.claude-dev`,
|
||||
`claude` → `anthropic.claude-code`, `codex` → `openai.chatgpt`, `gemini` →
|
||||
`Google.geminicodeassist`, `opencode` → `sst-dev.opencode`) and every extension
|
||||
installed in the local VS Code, captured through `code --list-extensions` at
|
||||
generation time; regenerate after installing or removing extensions on the
|
||||
host. Without a local VS Code on PATH only the profile and agent extensions are
|
||||
included. Open the project in local VS
|
||||
Code (in Fedora WSL on deadalus) and choose **Reopen in Container**. The generator
|
||||
never builds or starts a container, selects a Docker context, modifies application
|
||||
sources, or removes host packages. Existing `.devcontainer` directories are refused;
|
||||
`--force` replaces only the two generated files, so commit or back up edits first.
|
||||
|
||||
The definitions live centrally in the generator; generated files are standalone.
|
||||
Regenerate explicitly to take updates. Profile images select a language version
|
||||
or release family, not immutable digests; npm agents other than Claude currently
|
||||
resolve the latest release at container creation, matching the host lifecycle.
|
||||
Agent containers copy Node from the official `docker.io/library/node` image into
|
||||
`/usr/local` instead of using the nvm-based node feature, so the
|
||||
`sudo npm install` postCreateCommand works in every profile.
|
||||
Rebuilds are therefore not bit-for-bit reproducible. Pin image digests and agent
|
||||
versions in generated project files when a project requires that guarantee.
|
||||
Project-specific dependencies, ports, services and build commands belong in the
|
||||
project configuration. The `infra` profile provides Ansible and linters; install
|
||||
that project's collection requirements inside it separately.
|
||||
|
||||
## Shared Git and agents
|
||||
|
||||
Like the ecaas/cdp model, executables run inside the container and personal
|
||||
configuration stays on the host. The generator detects existing configuration
|
||||
paths without reading credentials. With `--agents auto` (the default), it selects
|
||||
agents whose configuration directories already exist. Explicit agent selection
|
||||
fails if required directories are missing. Supported agents: `codex`, `cline`,
|
||||
`opencode`, `claude`, `gemini`. IBM Bob and desktop applications are not included.
|
||||
|
||||
Host `~/.gitconfig` is mounted read-only at `/run/host-gitconfig` and included from
|
||||
a writable container Git config, allowing VS Code to register its credential
|
||||
helper. Existing `~/.config/git` and `~/.gitignore_global` are mounted read-only.
|
||||
Git, Git LFS, delta, OpenSSH and GnuPG are installed. VS Code Dev Containers handles
|
||||
SSH-agent and HTTPS credential-helper forwarding; start VS Code from the host
|
||||
session with its working agent. No SSH/GPG private-key directories are mounted.
|
||||
GPG signing needs a functioning agent-forwarding setup and a test with your key;
|
||||
the generator does not provision it. Host-specific helpers, `pinentry`, external
|
||||
Git includes, conditional includes and CA paths still need container-compatible
|
||||
configuration or additional narrowly scoped mounts. Recreate the container after
|
||||
replacing a bind-mounted configuration file atomically on the host.
|
||||
|
||||
`~/.config/ai` is mounted read-only when present. Selected agents mount their host
|
||||
configuration/state directories read-write, including credentials, sessions and
|
||||
rules; changes inside the container affect the host. OpenCode also shares its
|
||||
XDG data/state directories. The container user remains `vscode`, with its home set
|
||||
to the **same absolute path as the generating host**, so Codex's absolute
|
||||
`model_instructions_file` keeps working. This does not mount the full home.
|
||||
For a different host home path, regenerate there. Host-only programs referenced
|
||||
by agent settings are not made available automatically.
|
||||
|
||||
Claude also mounts `~/.claude.json` when present and forwards
|
||||
`ANTHROPIC_AUTH_TOKEN` using `${localEnv:ANTHROPIC_AUTH_TOKEN}` as on deadalus.
|
||||
Start VS Code from a shell that exports it; no token value is generated. Host
|
||||
keyring-backed logins require separate integration; sharing a directory does not
|
||||
forward the desktop keyring. VS Code extension storage is not shared.
|
||||
|
||||
Only existing paths are mounted. Regenerate after configuring an additional
|
||||
agent. Generated files use `${localEnv:HOME}` for mount sources and contain no
|
||||
credential contents, but do contain the host's absolute home path.
|
||||
|
||||
## Runtime and validation
|
||||
|
||||
Use a local development container engine. Docker CE is currently provisioned on
|
||||
deadalus; ikaros explicitly has Podman, while nymph's runtime needs verification.
|
||||
Podman (5+) works through VS Code's `dev.containers.dockerPath: podman` per the
|
||||
official Dev Containers documentation: the extension drives the container CLI
|
||||
and needs neither the `podman-docker` shim nor a daemon socket or `DOCKER_HOST`.
|
||||
Never install `podman-docker` where docker-ce provides the real Docker CLI
|
||||
(deadalus). Generation alone does not configure the engine; the `desktop_gnome`
|
||||
profile deploys `dev.containers.dockerPath: podman` with its managed VS Code
|
||||
settings, while compatible
|
||||
rootless/UID configuration and SELinux bind-mount access must be validated on the
|
||||
Fedora target host. Do not recursively relabel the personal home.
|
||||
No engine socket is mounted inside these containers by default; add access only
|
||||
for projects that need to launch sibling containers.
|
||||
|
||||
Host-side regression checks:
|
||||
|
||||
```sh
|
||||
go -C cmd/devcontainer test ./...
|
||||
go -C cmd/devcontainer vet ./...
|
||||
```
|
||||
|
||||
On the target host, build/open a generated project, check the language toolchain,
|
||||
`git config --show-origin --get user.email`, `git ls-remote origin HEAD` against
|
||||
the expected development remote, and each selected agent's version/login.
|
||||
Run project tests and verify signing if enabled. These runtime checks require the
|
||||
real host and are separate from generator tests. Existing ecaas/cdp Ansible
|
||||
provisioning is unchanged.
|
||||
23
dotfiles/common/.cline/rules/ai-context.md
Normal file
23
dotfiles/common/.cline/rules/ai-context.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Deployed global AI context
|
||||
|
||||
The standing AI context for this user is deployed by the Ansible-managed
|
||||
dotfiles under `~/.config/ai/` and is maintained in the infrastructure
|
||||
repository. Cline binds to it automatically in every project through this
|
||||
global rule.
|
||||
|
||||
- Operating context: read `~/.config/ai/bootstrap.md` first. It carries the
|
||||
persistent mental model: core principles, system and infrastructure models,
|
||||
and agent behavior.
|
||||
- Safety directives: apply `~/.config/ai/rules/safety.md`.
|
||||
- Task-specific loading: follow the dispatcher `~/.config/ai/AGENTS.md` and
|
||||
read only the files relevant to the current task from `knowledge/`, `rules/`,
|
||||
and `patterns/`. Do not preemptively load all task-specific files.
|
||||
- Distilled knowledge: for prior decisions, history, and stable preferences,
|
||||
start from `~/.config/ai/memory/chatgpt/INDEX.md` and read the matching
|
||||
topic file under `~/.config/ai/memory/chatgpt/knowledge/`. When that is not
|
||||
enough, search the full transcripts with
|
||||
`rg -i "<keyword>" ~/.config/ai/memory/chatgpt/transcripts/`.
|
||||
|
||||
These deployed files are managed state: never record session-specific notes in
|
||||
them. Update them in the source infrastructure repository instead, so the next
|
||||
playbook run converges the change everywhere.
|
||||
@@ -5,6 +5,7 @@ Always follow:
|
||||
- preserve layering
|
||||
- avoid duplication
|
||||
- validate before applying changes
|
||||
- safety directives: always apply `~/.config/ai/rules/safety.md`
|
||||
|
||||
Task-specific file loading:
|
||||
- For general background on the user, the environment, and stable preferences, read `~/.config/ai/memory/chatgpt/knowledge/00-profilo.md`
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
- Keep tasks idempotent
|
||||
- Use group_vars and host_vars properly
|
||||
- Avoid duplication
|
||||
- Group similar tasks into list variables and apply them with a single looping task
|
||||
|
||||
@@ -10,3 +10,4 @@ Never break an existing host.
|
||||
## Git Rules
|
||||
|
||||
- Never auto-commit; always ask the user before committing
|
||||
- Never add your own or any other AI assistant's name as a Git co-author: no `Co-Authored-By: <agent>` trailers, no AI names among the authors. Commits are authored by the human operator only
|
||||
|
||||
@@ -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
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user