|
| 1 | +# Testing SSH Remote Support |
| 2 | + |
| 3 | +This guide explains how to set up a Podman container with SSH to test the Prompt Registry extension in VS Code remote SSH scenarios. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Podman installed |
| 8 | +- VS Code with Remote-SSH extension installed |
| 9 | +- SSH client on host machine |
| 10 | + |
| 11 | +## Quick Start |
| 12 | + |
| 13 | +### 1. Create SSH Test Container |
| 14 | + |
| 15 | +Create a Dockerfile for the SSH-enabled container: |
| 16 | + |
| 17 | +```bash |
| 18 | +cat > Dockerfile.ssh-test << 'EOF' |
| 19 | +FROM ubuntu:22.04 |
| 20 | +
|
| 21 | +# Install SSH server and dependencies |
| 22 | +RUN apt-get update && \ |
| 23 | + apt-get install -y openssh-server sudo curl git && \ |
| 24 | + apt-get clean && \ |
| 25 | + rm -rf /var/lib/apt/lists/* |
| 26 | +
|
| 27 | +# Create SSH directory |
| 28 | +RUN mkdir /var/run/sshd |
| 29 | +
|
| 30 | +# Create test user |
| 31 | +RUN useradd -rm -d /home/testuser -s /bin/bash -g users -G sudo -u 1001 testuser && \ |
| 32 | + echo 'testuser:testpass' | chpasswd |
| 33 | +
|
| 34 | +# Allow password authentication |
| 35 | +RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \ |
| 36 | + sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config |
| 37 | +
|
| 38 | +# Allow root login (optional, for debugging) |
| 39 | +RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config |
| 40 | +
|
| 41 | +# Expose SSH port |
| 42 | +EXPOSE 22 |
| 43 | +
|
| 44 | +# Start SSH service |
| 45 | +CMD ["/usr/sbin/sshd", "-D"] |
| 46 | +EOF |
| 47 | +``` |
| 48 | + |
| 49 | +### 2. Build the Container Image |
| 50 | + |
| 51 | +```bash |
| 52 | +podman build -f Dockerfile.ssh-test -t vscode-ssh-test . |
| 53 | +``` |
| 54 | + |
| 55 | +### 3. Run the Container |
| 56 | + |
| 57 | +```bash |
| 58 | +podman run -d \ |
| 59 | + --name vscode-ssh-test \ |
| 60 | + -p 2222:22 \ |
| 61 | + vscode-ssh-test |
| 62 | +``` |
| 63 | + |
| 64 | +### 4. Verify SSH Access |
| 65 | + |
| 66 | +```bash |
| 67 | +ssh -p 2222 testuser@localhost |
| 68 | +# Password: testpass |
| 69 | +``` |
| 70 | + |
| 71 | +### 5. Configure VS Code Remote-SSH |
| 72 | + |
| 73 | +Edit `~/.ssh/config`: |
| 74 | + |
| 75 | +```bash |
| 76 | +cat >> ~/.ssh/config << 'EOF' |
| 77 | +
|
| 78 | +Host vscode-ssh-test |
| 79 | + HostName localhost |
| 80 | + Port 2222 |
| 81 | + User testuser |
| 82 | + StrictHostKeyChecking no |
| 83 | + UserKnownHostsFile /dev/null |
| 84 | +EOF |
| 85 | +``` |
| 86 | + |
| 87 | +### 6. Connect from VS Code |
| 88 | + |
| 89 | +1. Install "Remote - SSH" extension in VS Code |
| 90 | +2. Press `F1` and select "Remote-SSH: Connect to Host..." |
| 91 | +3. Select "vscode-ssh-test" |
| 92 | +4. Enter password: `testpass` |
| 93 | + |
| 94 | +### 7. Install Extension in Remote |
| 95 | + |
| 96 | +Once connected: |
| 97 | + |
| 98 | +```bash |
| 99 | +# Build VSIX first (on host) |
| 100 | +npm run package:vsix |
| 101 | + |
| 102 | +# Copy to container |
| 103 | +podman cp prompt-registry-0.0.2.vsix vscode-ssh-test:/home/testuser/ |
| 104 | + |
| 105 | +# In VS Code remote terminal |
| 106 | +code --install-extension ~/prompt-registry-0.0.2.vsix |
| 107 | +``` |
| 108 | + |
| 109 | +### 8. Test the Extension |
| 110 | + |
| 111 | +1. Check `vscode.env.remoteName` - should be `'ssh-remote'` |
| 112 | +2. Install a prompt collection |
| 113 | +3. Check Output → "Prompt Registry" for logs |
| 114 | +4. Verify prompts sync to remote filesystem |
| 115 | + |
| 116 | +## Cleanup |
| 117 | + |
| 118 | +```bash |
| 119 | +podman stop vscode-ssh-test |
| 120 | +podman rm vscode-ssh-test |
| 121 | +podman rmi vscode-ssh-test |
| 122 | +``` |
| 123 | + |
| 124 | +## Testing Checklist |
| 125 | + |
| 126 | +- [ ] Container starts and SSH is accessible |
| 127 | +- [ ] VS Code connects to SSH remote |
| 128 | +- [ ] Extension installs in remote |
| 129 | +- [ ] Extension activates without errors |
| 130 | +- [ ] Can install prompt collections |
| 131 | +- [ ] Prompts sync to remote filesystem |
| 132 | +- [ ] No errors in Output panel |
0 commit comments