Skip to content

Commit 9f9b89a

Browse files
committed
Enhance troubleshooting documentation for server re-provisioning
- Added a new section detailing the steps to re-provision servers from scratch, including removing the IP address from `.spin.yml` and cleaning up SSH known_hosts. - Included code examples for clarity on the necessary commands to execute during the re-provisioning process.
1 parent 5dc38c5 commit 9f9b89a

File tree

1 file changed

+91
-1
lines changed

1 file changed

+91
-1
lines changed

docs/content/docs/7.server-access/2.troubleshooting-your-application.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,4 +380,94 @@ sudo docker config rm $(sudo docker config ls -q) # Remove all configurations
380380
```
381381
::
382382

383-
Run the commands above individually to ensure everything is removed properly. Once you've verified everything is removed, you can deploy a fresh copy of your application.
383+
Run the commands above individually to ensure everything is removed properly. Once you've verified everything is removed, you can deploy a fresh copy of your application.
384+
385+
## Re-provisioning servers from scratch
386+
Sometimes you may want to completely delete a server from your cloud provider and start fresh with a new one. This is common when:
387+
388+
- You ran into issues during initial provisioning and want to start over
389+
- You're testing your infrastructure setup
390+
- You want to move to a different server type or location
391+
392+
When you delete a server from your cloud provider (like Hetzner, DigitalOcean, or Vultr) and want to re-provision, you'll need to clean up a few things first.
393+
394+
### Step 1: Remove the IP address from `.spin.yml`
395+
When Spin provisions a server through a provider, it automatically updates your `.spin.yml` file with the server's IP address. If you delete the server and want Spin to create a new one, you need to remove this `address` property.
396+
397+
::code-panel
398+
---
399+
label: Before - Server with IP address assigned
400+
---
401+
```yaml
402+
servers:
403+
- server_name: ubuntu-2gb-ash-1
404+
environment: production
405+
hardware_profile: hetzner_2c_2gb_ubuntu2404
406+
address: 123.45.67.89 # Remove this line
407+
```
408+
::
409+
410+
::code-panel
411+
---
412+
label: After - Server ready for re-provisioning
413+
---
414+
```yaml
415+
servers:
416+
- server_name: ubuntu-2gb-ash-1
417+
environment: production
418+
hardware_profile: hetzner_2c_2gb_ubuntu2404
419+
```
420+
::
421+
422+
### Step 2: Remove the server from SSH known_hosts
423+
Your local machine stores SSH host keys for servers you've connected to. When you create a new server, it will have a different host key, which causes SSH to show a warning about a potential security issue.
424+
425+
To remove the old host key entry, run:
426+
427+
::code-panel
428+
---
429+
label: Remove server from known_hosts
430+
---
431+
```bash
432+
ssh-keygen -R your.server.ip.address
433+
```
434+
::
435+
436+
Replace `your.server.ip.address` with the IP address or hostname of the server you deleted. For example:
437+
438+
::code-panel
439+
---
440+
label: Example removing a specific IP
441+
---
442+
```bash
443+
ssh-keygen -R 123.45.67.89
444+
```
445+
::
446+
447+
::note
448+
If you used a hostname to connect to your server, you may need to remove both the hostname and IP address entries.
449+
::
450+
451+
::code-panel
452+
---
453+
label: Example removing a hostname and IP address
454+
---
455+
```bash
456+
ssh-keygen -R myserver.example.com
457+
ssh-keygen -R 123.45.67.89 # Remove the IP address entry
458+
```
459+
::
460+
461+
### Step 3: Re-provision your server
462+
Once you've cleaned up the `.spin.yml` file and SSH known_hosts, you can provision a fresh server:
463+
464+
::code-panel
465+
---
466+
label: Provision a new server
467+
---
468+
```bash
469+
spin provision
470+
```
471+
::
472+
473+
Spin will create a new server with your cloud provider and update your `.spin.yml` file with the new IP address.

0 commit comments

Comments
 (0)