Skip to content

Commit 95db7fa

Browse files
committed
Fix instructions for mounting Sprite over SSHFS
1 parent 8363db8 commit 95db7fa

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

src/content/docs/working-with-sprites.mdx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,17 @@ These features are useful once you're comfortable.
232232

233233
Use SSHFS to mount your Sprite and edit files with your local tools.
234234

235-
**Install SSHFS first:**
235+
**Prepare an SSH server on your Sprite:**
236+
237+
```bash
238+
# Install OpenSSH
239+
sudo apt install -y openssh-server
240+
241+
# Create a service to automatically start it
242+
sprite-env services create sshd --cmd /usr/sbin/sshd
243+
```
244+
245+
**Install SSHFS on your local machine:**
236246

237247
```bash
238248
# macOS
@@ -245,25 +255,37 @@ sudo apt-get install sshfs
245255
sudo dnf install fuse-sshfs
246256
```
247257

258+
**Authorize your SSH public keys:**
259+
260+
```bash
261+
sprite exec mkdir -p .ssh
262+
cat ~/.ssh/id_*.pub | sprite exec tee -a .ssh/authorized_keys
263+
```
264+
248265
**Add this helper to your shell config:**
249266

250267
```bash
251268
# Add to ~/.zshrc or ~/.bashrc
252269
sc() {
253-
local sprite_name="${1:-$(sprite use)}"
270+
local sprite_name="$1"
254271
local mount_point="/tmp/sprite-${sprite_name}"
272+
test -n "$(sprite url -s "${sprite_name}")"
255273
mkdir -p "$mount_point"
274+
sprite proxy -s "${sprite_name}" 2000:22 &
256275
sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 \
257-
"sprite@${sprite_name}.sprites.dev:" "$mount_point"
276+
"sprite@localhost:" -p 2000 "$mount_point"
258277
cd "$mount_point"
259278
}
279+
280+
# Mount the sprite with "sc my-sprite"
260281
```
261282

262283
**Unmount when done:**
263284

264285
```bash
265286
umount /tmp/sprite-my-sprite
266287
# macOS may need: diskutil umount /tmp/sprite-my-sprite
288+
kill "$(lsof -t -i:2000)"
267289
```
268290

269291
### Common Error Scenarios

0 commit comments

Comments
 (0)