Skip to content

Commit 0aceffb

Browse files
committed
Add docs on floating IP configs
1 parent f54a812 commit 0aceffb

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,41 @@ assign a static IP to a server.
174174
By setting your DNS A-record to a floating IP and adding its ID as an input,
175175
you can hence make your launched server predictably-addressable.
176176

177+
Specifically, working with floating IPs can get a bit messy. Here's an example
178+
configuration.
179+
180+
```yml
181+
jobs:
182+
build:
183+
runs-on: Ubuntu-20.04
184+
steps:
185+
- uses: TimDaub/hetzner-cloud-deploy-server-action@v2
186+
with:
187+
server-name: "server"
188+
server-image: "ubuntu-20.04"
189+
server-type: "cx11"
190+
ssh-key-name: "my key name"
191+
hcloud-token: ${{ secrets.HCLOUD_TOKEN }}
192+
startup-timeout: 40000
193+
floating-ip-id: my-id
194+
floating-ip-assignment-timeout: 30000
195+
- uses: webfactory/ssh-agent@v0.4.1
196+
with:
197+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
198+
- run: mkdir -p ~/.ssh/ && ssh-keyscan -H $SERVER_IPV4 >> ~/.ssh/known_hosts
199+
- run: ssh root@$SERVER_IPV4 "ip addr add $SERVER_FLOATING_IPV4 dev eth0"
200+
- run: mkdir -p ~/.ssh/ && ssh-keyscan -H $SERVER_FLOATING_IPV4 >> ~/.ssh/known_hosts
201+
- run: ssh root@$SERVER_FLOATING_IPV4 touch tim_was_here
202+
- run: ssh root@$SERVER_FLOATING_IPV4 ls
203+
204+
```
205+
206+
Note how we use `ssh-keyscan` twice here to configure the GitHub Action server
207+
for once with the `SERVER_IPV4` but then later also with the
208+
`SERVER_FLOATING_IPV4`.
209+
This specific step is optional, but it allows a subsequent step to directly
210+
connect to the floating IP.
211+
177212
### Can I lose money when running this script?
178213

179214
Yes, you certainly can. There may be instances where something within my

0 commit comments

Comments
 (0)