57ff236f2d
- Add ssh_key_id column to ConfigProfile model and migration - Update config profile API to accept/return ssh_key_id - Include ssh_key_id in ResolvedProfile and resolver logic - Mount selected SSH key into container home dir at start_instance - Frontend config profile form with SSH key selector dropdown - Git mount URL validation defaults to profile's SSH key Quality gates: pytest (231 passed, 6 pre-existing), tsc --noEmit clean
1.4 KiB
1.4 KiB
Exploration: SSH Key Mounting in Config Profiles
Current State
- SSH keys are stored in
ssh_keystable, user-scoped - Keys are attached to
GitRepositoryviassh_key_id - On clone-mode instance start, the repo's key is mounted to
/root/.ssh prepare_ssh_key_fileswrites toinstance_dir/.ssh- Only works for clone mode; always mounts to
/root/.ssh
Problem
- Keys are tied to repositories, not selectable per-instance or per-profile
- Always mounted to
/root/.ssh, not the container user's home dir - Only clone-mode instances get SSH keys; mount-mode instances can't use SSH
Solution
Add ssh_key_id to ConfigProfile. When a profile with an SSH key is applied:
- Fetch the SSH key
- Stage decrypted files to
instance_dir/mounts/ssh/.ssh - Add volume mount to compose:
instance_dir/mounts/ssh/.ssh→{home_dir}/.ssh - This works for all instance types (manifest, legacy, clone, mount)
Files to Change
apps/api/src/models/config_profile.py— addssh_key_idcolumnapps/api/alembic/versions/— migrationapps/api/src/services/config_profile_resolver.py— resolve + applyapps/api/src/services/ssh_keys.py— allow custom output subdirapps/api/src/api/config_profiles.py— CRUD + validationapps/web/src/api/config_profiles.ts— type + APIapps/web/src/pages/config-profiles.tsx— SSH key selector UI