Skip to content

Commit

Permalink
Add instruction from original repo (script in cron)
Browse files Browse the repository at this point in the history
Signed-off-by: Aurelien Gaston <[email protected]>
  • Loading branch information
Nox-404 committed Mar 13, 2022
1 parent 0179fb5 commit 538c30e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 19 deletions.
48 changes: 32 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,46 @@ A docker image and a Chart is also provided for deployment on kubernetes.

> You may also just use `cron` to run the script.
## Prerequisites

### If using the Chart
## How it works

* Kubernetes 1.21
* helm 3.6.3
1. The command `dig` is used to retrieve the IP address of your domain name.
2. The command `curl` (with the website `ifconfig.co`) is used to retrieve the current public IP address of your machine.
3. The two IPs are compared and if necessary a `curl` command to OVH is used to update your DynHost with your current public IP address.

> Other versions might work but were not tested.
## Prerequisites

### If running on the host

* `curl` - HTTP calls
* `dig` - DNS lookup

> On ubuntu `dig` is provided by the `dnsutils` package
### If using the Chart

* Kubernetes `1.21`
* helm `3.6.3`

> Other versions might work but were not tested.
## Installing as an hourly CRON

1. Download the `dynhost.sh` script and put it in the folder `/etc/cron.hourly` (to check every hour)
2. Add execution permissions to file : `chmod +x dynhost.sh`
3. Rename `dynhost.sh` to `dynhost` (because `.` at the end of the file name is not allowed in cron)
4. Modify the script with variables : `HOST`, `LOGIN`, `PASSWORD`

## Script parameters

The script uses environment variable as parameters.

| Name | Description | Value |
| ---------- | ---------------------------------------------- | ----- |
| `HOST` | **Mandatory** - The dynhost DNS name to update | `""` |
| `LOGIN` | **Mandatory** - The dynhost identifier | `""` |
| `PASSWORD` | **Mandatory** - The dynhost password | `""` |

## Installing the Chart

To install the chart:
Expand All @@ -45,7 +71,7 @@ helm install [RELEASE] chart \
## Uninstalling the Chart

```sh
helm delete [RELEASE]
helm uninstall [RELEASE]
```

## Chart parameters
Expand Down Expand Up @@ -85,16 +111,6 @@ helm delete [RELEASE]
| `tolerations` | Pod tolerations | `[]` |
| `affinity` | Pod affinities | `{}` |

## Script parameters

The script uses environment variable as parameters.

| Name | Description | Value |
| ---------- | ---------------------------------------------- | ----- |
| `HOST` | **Mandatory** - The dynhost DNS name to update | `""` |
| `LOGIN` | **Mandatory** - The dynhost identifier | `""` |
| `PASSWORD` | **Mandatory** - The dynhost password | `""` |

## Building and publishing the Docker image

```sh
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM alpine:latest

ENV HOST=DOMAIN_NAME \
LOGIN=LOGIN \
PASSWORD=PASSWORD
ENV HOST= \
LOGIN= \
PASSWORD=

RUN addgroup dynhost \
&& adduser -G dynhost -D -H dynhost
Expand Down
5 changes: 5 additions & 0 deletions dynhost.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env sh

# Set those accordingly
HOST=
LOGIN=
PASSWORD=

# Account configuration
if [ -z $HOST ]
then
Expand Down

0 comments on commit 538c30e

Please sign in to comment.