From 56a05ec10e36a214bc2a0f685497a561b61baec3 Mon Sep 17 00:00:00 2001 From: arch3rPro <30855883+arch3rPro@users.noreply.github.com> Date: Thu, 10 Jul 2025 18:54:29 +0800 Subject: [PATCH] fix: update docker-compose.yml --- apps/netbox/latest/data.yml | 36 +++++++------- apps/netbox/latest/docker-compose.yml | 69 +++++++++++++++++++++------ apps/netbox/latest/netbox.env | 11 +++++ 3 files changed, 83 insertions(+), 33 deletions(-) create mode 100644 apps/netbox/latest/netbox.env diff --git a/apps/netbox/latest/data.yml b/apps/netbox/latest/data.yml index dd50379..84083d1 100644 --- a/apps/netbox/latest/data.yml +++ b/apps/netbox/latest/data.yml @@ -1,19 +1,19 @@ additionalProperties: - formFields: - - default: 8000 - edit: true - envKey: PANEL_APP_PORT_HTTP - labelEn: Web UI Port - labelZh: Web界面端口 - required: true - rule: paramPort - type: number - label: - en: Web UI Port - ja: Web UI ポート - ms: Port UI Web - pt-br: Porta da interface web - ru: Веб-порт интерфейса - ko: 웹 UI 포트 - zh-Hant: Web UI 埠 - zh: Web界面端口 \ No newline at end of file + formFields: + - default: 8000 + edit: true + envKey: PANEL_APP_PORT_HTTP + labelEn: Web Port + labelZh: Web端口 + required: true + rule: paramPort + type: number + - default: "" + edit: true + envKey: PANEL_DB_USER_PASSWORD + labelEn: Database Password + labelZh: 数据库用户密码 + random: true + required: true + rule: paramComplexity + type: password \ No newline at end of file diff --git a/apps/netbox/latest/docker-compose.yml b/apps/netbox/latest/docker-compose.yml index 905a722..77f9b75 100644 --- a/apps/netbox/latest/docker-compose.yml +++ b/apps/netbox/latest/docker-compose.yml @@ -1,21 +1,60 @@ +version: '3.4' services: netbox: - container_name: ${CONTAINER_NAME} - image: lscr.io/linuxserver/netbox:latest + image: netboxcommunity/netbox:latest restart: always - networks: - - 1panel-network + env_file: + - netbox.env + depends_on: + - postgres + - redis + - redis-cache ports: - - "${PANEL_APP_PORT_HTTP}:8000" - environment: - - TZ=Asia/Shanghai - - PUID=1000 - - PGID=1000 + - "${PANEL_APP_PORT_HTTP}:8080" volumes: - - ./config:/config - - ./data:/data + - ./netbox-media:/opt/netbox/netbox/media + - ./netbox-reports:/etc/netbox/reports + - ./netbox-scripts:/etc/netbox/scripts + command: /opt/netbox/launch-netbox.sh + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/api/health/", "||", "exit", "1"] + interval: 30s + timeout: 10s + retries: 5 labels: - createdBy: "Apps" -networks: - 1panel-network: - external: true \ No newline at end of file + org.opencontainers.image.source: https://github.com/netbox-community/netbox-docker + postgres: + image: postgres:15-alpine + restart: always + environment: + POSTGRES_DB: netbox + POSTGRES_USER: netbox + POSTGRES_PASSWORD: ${PANEL_DB_USER_PASSWORD} + volumes: + - ./postgres-data:/var/lib/postgresql/data + healthcheck: + test: ["CMD", "pg_isready", "-U", "netbox"] + interval: 10s + timeout: 5s + retries: 5 + redis: + image: redis:7-alpine + restart: always + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + redis-cache: + image: redis:7-alpine + restart: always + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 +volumes: + netbox-media: + netbox-reports: + netbox-scripts: + postgres-data: \ No newline at end of file diff --git a/apps/netbox/latest/netbox.env b/apps/netbox/latest/netbox.env new file mode 100644 index 0000000..cac06ec --- /dev/null +++ b/apps/netbox/latest/netbox.env @@ -0,0 +1,11 @@ +# Netbox 环境变量示例 +SUPERUSER_NAME=admin +SUPERUSER_EMAIL=admin@example.com +SUPERUSER_PASSWORD=admin +ALLOWED_HOSTS=* +DB_NAME=netbox +DB_USER=netbox +DB_PASSWORD=${PANEL_DB_USER_PASSWORD} +DB_HOST=postgres +REDIS_HOST=redis +REDIS_CACHE_HOST=redis-cache \ No newline at end of file