29 lines
1.3 KiB
Markdown
29 lines
1.3 KiB
Markdown
# mikrotik-netbox-dns-sync Deployment
|
|
NetBox to MikroTik static DNS sync: [source/mikrotik-netbox-dns-sync](https://git.bjphoster.com/source/mikrotik-netbox-dns-sync).
|
|
|
|
Runs the script every 5 minutes on the [cron image](https://git.bjphoster.com/docker/cron) (`bryanpedini/cron`), logging to the container output. Nothing is built: the crontab and a checkout of the source repo are bind mounted, and `python3` (plus `tzdata`) is installed with `apk` when the container starts.
|
|
|
|
## Usage
|
|
```sh
|
|
cp env.example .env
|
|
chmod 600 .env
|
|
$EDITOR .env
|
|
git clone https://git.bjphoster.com/source/mikrotik-netbox-dns-sync.git data/source
|
|
docker compose up -d
|
|
```
|
|
`crontab` must be owned by `0:0`, as crond requires.
|
|
|
|
Every `SYNC_*` variable in `.env` is passed to the script without the prefix (`SYNC_NETBOX_URL` becomes `NETBOX_URL`, and so on), except `SYNC_SOURCE`, the path of the source checkout. See the source README for every variable and for the NetBox and RouterOS permissions.
|
|
|
|
`env.example` ships with `SYNC_DRY_RUN=true`. Run one sync by hand and check the plan before setting it to `false` and running `docker compose up -d` again:
|
|
```sh
|
|
docker compose exec cron python3 /jobs/netbox_dns_sync.py
|
|
docker compose logs -f
|
|
```
|
|
|
|
## Update
|
|
```sh
|
|
git -C data/source pull
|
|
```
|
|
The next run picks up the new script, no restart needed. Crontab changes need a `docker compose restart`.
|