Update parameter names to match phpipam-docker project

This commit is contained in:
John Bowdre 2022-01-10 16:32:13 -06:00
parent 396c16564e
commit c4191993c1
4 changed files with 37 additions and 37 deletions

View file

@ -39,15 +39,15 @@ RUN git clone ${PHPIPAM_AGENT_SOURCE}.git
WORKDIR /opt/phpipam-agent
# Use system environment variables into config.php
RUN cp config.dist.php config.php && \
sed -i -e "s/\['key'\] = .*;/\['key'\] = getenv(\"PHPIPAM_AGENT_KEY\");/" \
sed -i -e "s/\['key'\] = .*;/\['key'\] = getenv(\"IPAM_AGENT_KEY\");/" \
-e "s/\['pingpath'\] = .*;/\['pingpath'\] = \"\/usr\/sbin\/fping\";/" \
-e "s/\['reset_autodiscover_addresses'\] = false/\['reset_autodiscover_addresses'\] = getenv(\"PHPIPAM_RESET_AUTODISCOVER\") ?: false/" \
-e "s/\['remove_inactive_dhcp'\].*= false/\['remove_inactive_dhcp'\] = getenv(\"PHPIPAM_REMOVE_DHCP\") ?: false/" \
-e "s/\['db'\]\['host'\] = \"localhost\"/\['db'\]\['host'\] = getenv(\"PHPIPAM_DB_HOST\")/" \
-e "s/\['db'\]\['user'\] = \"phpipam\"/\['db'\]\['user'\] = getenv(\"PHPIPAM_DB_USER\") ?: \"phpipam\"/" \
-e "s/\['db'\]\['pass'\] = \"phpipamadmin\"/\['db'\]\['pass'\] = getenv(\"PHPIPAM_DB_PASS\")/" \
-e "s/\['db'\]\['name'\] = \"phpipam\"/\['db'\]\['name'\] = getenv(\"PHPIPAM_DB_NAME\") ?: \"phpipam\"/" \
-e "s/\['db'\]\['port'\] = 3306/\['db'\]\['port'\] = getenv(\"PHPIPAM_DB_PORT\") ?: 3306/" \
-e "s/\['reset_autodiscover_addresses'\] = false/\['reset_autodiscover_addresses'\] = getenv(\"IPAM_RESET_AUTODISCOVER\") ?: false/" \
-e "s/\['remove_inactive_dhcp'\].*= false/\['remove_inactive_dhcp'\] = getenv(\"IPAM_REMOVE_DHCP\") ?: false/" \
-e "s/\['db'\]\['host'\] = \"localhost\"/\['db'\]\['host'\] = getenv(\"IPAM_DATABASE_HOST\")/" \
-e "s/\['db'\]\['user'\] = \"phpipam\"/\['db'\]\['user'\] = getenv(\"IPAM_DATABASE_USER\") ?: \"phpipam\"/" \
-e "s/\['db'\]\['pass'\] = \"phpipamadmin\"/\['db'\]\['pass'\] = getenv(\"IPAM_DATABASE_PASS\")/" \
-e "s/\['db'\]\['name'\] = \"phpipam\"/\['db'\]\['name'\] = getenv(\"IPAM_DATABASE_NAME\") ?: \"phpipam\"/" \
-e "s/\['db'\]\['port'\] = 3306/\['db'\]\['port'\] = getenv(\"IPAM_DATABASE_PORT\") ?: 3306/" \
config.php \
\
&& chmod +x /entrypoint.sh \

View file

@ -42,30 +42,30 @@ services:
restart: unless-stopped
image: jbowdre/phpipam-agent:latest
environment:
- PHPIPAM_DB_HOST=ipamhost.local
- PHPIPAM_DB_NAME=phpipam
- PHPIPAM_DB_USER=phpipam
- PHPIPAM_DB_PASS=phpipamadmin
- PHPIPAM_DB_PORT=3306
- PHPIPAM_AGENT_KEY=2RuQ0rt4Rir29vGN4_1ZOqShcUX7PSUb
- PHPIPAM_SCAN_INTERVAL=15m
- PHPIPAM_RESET_AUTODISCOVER=false
- PHPIPAM_REMOVE_DHCP_false
- IPAM_DATABASE_HOST=ipamhost.local
- IPAM_DATABASE_NAME=phpipam
- IPAM_DATABASE_USER=phpipam
- IPAM_DATABASE_PASS=phpipamadmin
- IPAM_DATABASE_PORT=3306
- IPAM_AGENT_KEY=2RuQ0rt4Rir29vGN4_1ZOqShcUX7PSUb
- IPAM_SCAN_INTERVAL=15m
- IPAM_RESET_AUTODISCOVER=false
- IPAM_REMOVE_DHCP_false
- TZ=UTC
```
## Configuration Parameters
| Parameter | Description |
| --- | --- |
| `PHPIPAM_DB_HOST` | IP/FQDN where the phpIPAM database is running |
| `PHPIPAM_DB_NAME` | Name of the database on the host *(Optional; default: `phpipam`)* |
| `PHPIPAM_DB_USER` | Database user with required privileges *(Optional; default: `phpipam`)* |
| `PHPIPAM_DB_PASS` | Password for that user |
| `PHPIPAM_DB_PORT` | Port number for the database listener *(Optional; default: `3306`)* |
| `PHPIPAM_AGENT_KEY` | Unique key generated by phpIPAM for each scan agent |
| `PHPIPAM_SCAN_INTERVAL` | How frequently the Status and Discovery scans will run (Valid options: `5m`, `10m`, `15m`, `30m`, `1h`, `2h`, `4h`, `6h`, `12h`) *(Optional; default: `15m`)* |
| `PHPIPAM_RESET_AUTODISCOVER` | Enable the agent to remove autodiscovered IPs which are offline *(Optional; default: `false`)* |
| `PHPIPAM_REMOVE_DHCP` | Enable the agent to remove inactive DHCP addresses *(Optional; default: `false`)* |
| `IPAM_DATABASE_HOST` | IP/FQDN where the phpIPAM database is running |
| `IPAM_DATABASE_NAME` | Name of the database on the host *(Optional; default: `phpipam`)* |
| `IPAM_DATABASE_USER` | Database user with required privileges *(Optional; default: `phpipam`)* |
| `IPAM_DATABASE_PASS` | Password for that user |
| `IPAM_DATABASE_PORT` | Port number for the database listener *(Optional; default: `3306`)* |
| `IPAM_AGENT_KEY` | Unique key generated by phpIPAM for each scan agent |
| `IPAM_SCAN_INTERVAL` | How frequently the Status and Discovery scans will run (Valid options: `5m`, `10m`, `15m`, `30m`, `1h`, `2h`, `4h`, `6h`, `12h`) *(Optional; default: `15m`)* |
| `IPAM_RESET_AUTODISCOVER` | Enable the agent to remove autodiscovered IPs which are offline *(Optional; default: `false`)* |
| `IPAM_REMOVE_DHCP` | Enable the agent to remove inactive DHCP addresses *(Optional; default: `false`)* |
## Logging
The logs are available on stdout/stderr (allowing to use `docker logs`).

View file

@ -1,7 +1,7 @@
#!/bin/sh
set -e
case "$PHPIPAM_SCAN_INTERVAL" in
case "$IPAM_SCAN_INTERVAL" in
5m) CRON_S="*/5 *"
;;
10m) CRON_S="*/10 *"

View file

@ -3,15 +3,15 @@ services:
phpipam-agent:
container_name: phpipam-agent
restart: unless-stopped
image: jbowdre/phpipam-agent:latest
image: ghcr.io/jbowdre/phpipam-agent:latest
environment:
- PHPIPAM_DB_HOST=ipamhost
- PHPIPAM_DB_NAME=phpipam
- PHPIPAM_DB_USER=phpipam
- PHPIPAM_DB_PASS=phpipamadmin
- PHPIPAM_DB_PORT=3306
- PHPIPAM_AGENT_KEY=2RuQ0rt4Rir29vGN4_1ZOqShcUX7PSUb
- PHPIPAM_SCAN_INTERVAL=15m
- PHPIPAM_RESET_AUTODISCOVER=false
- PHPIPAM_REMOVE_DHCP=false
- IPAM_DATABASE_HOST=ipamhost
- IPAM_DATABASE_NAME=phpipam
- IPAM_DATABASE_USER=phpipam
- IPAM_DATABASE_PASS=phpipamadmin
- IPAM_DATABASE_PORT=3306
- IPAM_AGENT_KEY=2RuQ0rt4Rir29vGN4_1ZOqShcUX7PSUb
- IPAM_SCAN_INTERVAL=15m
- IPAM_RESET_AUTODISCOVER=false
- IPAM_REMOVE_DHCP=false
- TZ=UTC