https://github.com/null93/cloudflare-public-ip
Container to periodically update public IP address with a Cloudflare DNS record
https://github.com/null93/cloudflare-public-ip
cloudflare-dns cronjob docker-image home-lab
Last synced: 5 months ago
JSON representation
Container to periodically update public IP address with a Cloudflare DNS record
- Host: GitHub
- URL: https://github.com/null93/cloudflare-public-ip
- Owner: null93
- License: mit
- Created: 2019-09-17T00:36:52.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T21:14:48.000Z (over 2 years ago)
- Last Synced: 2025-01-01T00:22:53.961Z (6 months ago)
- Topics: cloudflare-dns, cronjob, docker-image, home-lab
- Language: JavaScript
- Homepage: https://hub.docker.com/r/null93/cloudflare-public-ip
- Size: 37.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Cloudflare — Public IP
> Container to periodically update public IP address with a Cloudflare DNS record


### About
This project aims to provide a docker image that can be used to update an A record through Cloudflare's API. The value would be the external (public) IP address relative to the running container. Why would this be important? If you ever wanted to run a home-lab with a dynamic IP address, then this can be used to periodically ensure that said IP address is saved to a given Cloudflare A record.
### Environmental Variables
| **Key** | **Required** | **Default** | **Type** | **Description** |
|:-----------------:|:------------:|:-----------:|:--------:|:-------------------------:|
| CF_DEBUG | No | false | bool | Display debug info? |
| CF_ZONE | Yes | - | string | Cloudflare Zone ID |
| CF_TOKEN | Yes | - | string | Cloudflare API token |
| CF_RECORD_NAME | Yes | - | string | A record name |
| CF_RECORD_PROXIED | No | true | bool | Proxy through Cloudflare? |
| CF_RECORD_TTL | No | 1 | int | TTL for A record |### Example (Docker)
```shell
docker run -it \
-e CF_DEBUG="true" \
-e CF_ZONE="Sm8k6RYi0yHfsb6AyIIBVdb2AaJ6IX1y" \
-e CF_TOKEN="TzpPptgsMSTrhVWzg9J9XjYJ6G91kr9yhPeTEwkf" \
-e CF_RECORD_NAME="foo.example.com" \
-e CF_RECORD_PROXIED="true" \
-e CF_RECORD_TTL="1" \
null93/cloudflare-public-ip
```### Example (CronJob)
```yaml
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: comcast-foo
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: comcast-foo
image: null93/cloudflare-public-ip
imagePullPolicy: IfNotPresent
env:
- name: CF_DEBUG
value: "false"
- name: CF_ZONE
value: "Sm8k6RYi0yHfsb6AyIIBVdb2AaJ6IX1y"
- name: CF_TOKEN
value: "TzpPptgsMSTrhVWzg9J9XjYJ6G91kr9yhPeTEwkf"
- name: CF_RECORD_NAME
value: "foo.example.com"
- name: CF_RECORD_PROXIED
value: "true"
- name: CF_RECORD_TTL
value: "1"
```### Docker Build & Push
```shell
docker build -t null93/cloudflare-public-ip:latest .
docker push null93/cloudflare-public-ip:latest
```