diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fb58dee --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.env +data diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a718a7f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,82 @@ +--- +services: + phpipam: + image: phpipam/phpipam-www:latest + restart: unless-stopped + depends_on: + - mariadb + environment: + - TZ=${PI_TIMEZONE} + - IPAM_DATABASE_HOST=mariadb + - IPAM_DATABASE_NAME=${MARIADB_DATABASE} + - IPAM_DATABASE_USER=${MARIADB_USER} + - IPAM_DATABASE_PASS=${MARIADB_PASSWORD} + labels: + ### Section Træfik + - traefik.enable=${TRAEFIK_ENABLED} + - traefik.docker.network=${TRAEFIK_NETWORK} + ## HTTP + - traefik.http.routers.http-${TRAEFIK_ROUTER}.entrypoints=http + # redirect to HTTPS only + - traefik.http.routers.http-${TRAEFIK_ROUTER}.middlewares=${TRAEFIK_HTTP_MIDDLEWARES} + - traefik.http.routers.http-${TRAEFIK_ROUTER}.rule=${TRAEFIK_MATCHRULE} + ## HTTPS + - traefik.http.routers.https-${TRAEFIK_ROUTER}.entrypoints=https + # configure the exposed service + - traefik.http.routers.https-${TRAEFIK_ROUTER}.middlewares=${TRAEFIK_HTTPS_MIDDLEWARES} + - traefik.http.routers.https-${TRAEFIK_ROUTER}.rule=${TRAEFIK_MATCHRULE} + # enable TLS and its certificate provider + - traefik.http.routers.https-${TRAEFIK_ROUTER}.tls=${TRAEFIK_TLSENABLED} + - traefik.http.routers.https-${TRAEFIK_ROUTER}.tls.certresolver=${TRAEFIK_CERTRESOLVER} + # specify a service so a custom port can be used + - traefik.http.services.${TRAEFIK_SERVICE}.loadbalancer.server.port=${TRAEFIK_SERVICE_PORT} + ### Section Diun + - diun.enable=${PI_DIUN_ENABLE} + - diun.watch_repo=${PI_DIUN_WATCHREPO} + - diun.sort_tags=${PI_DIUN_SORTALGO} + - diun.include_tags=${PI_DIUN_INCLUDE} + - diun.exclude_tags=${PI_DIUN_EXCLUDE} + networks: + - traefik + - internal + + cron: + image: phpipam/phpipam-cron:latest + restart: unless-stopped + depends_on: + - mariadb + environment: + - TZ=${PI_TIMEZONE} + - IPAM_DATABASE_HOST=mariadb + - IPAM_DATABASE_NAME=${MARIADB_DATABASE} + - IPAM_DATABASE_USER=${MARIADB_USER} + - IPAM_DATABASE_PASS=${MARIADB_PASSWORD} + - SCAN_INTERVAL=${PI_SCAN_INTERVAL} + networks: + - internal + + mariadb: + image: mariadb:${MARIADB_VERSION} + restart: unless-stopped + environment: + - MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} + - MARIADB_USER=${MARIADB_USER} + - MARIADB_PASSWORD=${MARIADB_PASSWORD} + - MARIADB_DATABASE=${MARIADB_DATABASE} + labels: + ### Section Diun + - diun.enable=${MARIADB_DIUN_ENABLE} + - diun.watch_repo=${MARIADB_DIUN_WATCHREPO} + - diun.sort_tags=${MARIADB_DIUN_SORTALGO} + - diun.include_tags=${MARIADB_DIUN_INCLUDE} + - diun.exclude_tags=${MARIADB_DIUN_EXCLUDE} + networks: + - internal + volumes: + - ${MARIADB_DATA}:/var/lib/mysql + +networks: + internal: + traefik: + external: true + name: ${TRAEFIK_NETWORK} diff --git a/example.env b/example.env new file mode 100644 index 0000000..eb2686d --- /dev/null +++ b/example.env @@ -0,0 +1,36 @@ +# Træfik +TRAEFIK_ENABLED=true +TRAEFIK_NETWORK=traefik +TRAEFIK_ROUTER=phpipam_example_com +TRAEFIK_SERVICE=phpipam_example_com +TRAEFIK_SERVICE_PORT=80 +TRAEFIK_MATCHRULE=Host(`phpipam.example.com`) +TRAEFIK_TLSENABLED=true +TRAEFIK_CERTRESOLVER=letsencrypt +TRAEFIK_HTTP_MIDDLEWARES=http-to-https +TRAEFIK_HTTPS_MIDDLEWARES=hsts + +# PHP IPAM +PI_VERSION=1.5x +PI_TIMEZONE=Europe/Rome +PI_SCAN_INTERVAL=10m +# PHP IPAM Diun +PI_DIUN_ENABLE=true +PI_DIUN_WATCHREPO=true +PI_DIUN_SORTALGO=semver +PI_DIUN_INCLUDE= +PI_DIUN_EXCLUDE= + +# MariaDB +MARIADB_VERSION=11.1.2 +MARIADB_DATA=./data +MARIADB_ROOT_PASSWORD=r00t +MARIADB_DATABASE=phpipam +MARIADB_USER=phpipam +MARIADB_PASSWORD=phpipam +# MariaDB Diun +MARIADB_DIUN_ENABLE=true +MARIADB_DIUN_WATCHREPO=true +MARIADB_DIUN_SORTALGO=semver +MARIADB_DIUN_INCLUDE= +MARIADB_DIUN_EXCLUDE=