From 7740e63575e44bb0e6675e00af6cef62a767b29a Mon Sep 17 00:00:00 2001 From: okxlin Date: Fri, 3 Nov 2023 15:52:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=95=BF=E4=BA=AD=E9=9B=B7=E6=B1=A0redis?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E7=8B=AC=E7=AB=8B=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/safeline/3.10.0/.env.sample | 4 +- apps/safeline/3.10.0/data.yml | 14 ++-- apps/safeline/3.10.0/docker-compose.yml | 61 ++++++++++++------ apps/safeline/latest/.env.sample | 4 +- apps/safeline/latest/data.yml | 14 ++-- apps/safeline/latest/docker-compose.yml | 61 ++++++++++++------ apps/safeline/newnet-3.10.0/.env.sample | 4 +- apps/safeline/newnet-3.10.0/data.yml | 8 +-- .../safeline/newnet-3.10.0/docker-compose.yml | 64 ++++++++++++------- apps/safeline/newnet-latest/.env.sample | 4 +- apps/safeline/newnet-latest/data.yml | 8 +-- .../safeline/newnet-latest/docker-compose.yml | 64 ++++++++++++------- 12 files changed, 194 insertions(+), 116 deletions(-) diff --git a/apps/safeline/3.10.0/.env.sample b/apps/safeline/3.10.0/.env.sample index 519f16aa..01ca84fd 100644 --- a/apps/safeline/3.10.0/.env.sample +++ b/apps/safeline/3.10.0/.env.sample @@ -2,8 +2,8 @@ CONTAINER_NAME="safeline" PANEL_APP_PORT_HTTP="40080" PANEL_APP_PORT_HTTP2="40081" POSTGRES_PASSWORD="password_xxJdZD" -REDIS_HOST="redis" -PANEL_REDIS_ROOT_PASSWORD="" +REDIS_HOST="safeline-redis" +PANEL_REDIS_ROOT_PASSWORD="redis_password" REDIS_PORT="6379" SAFELINE_DIR="./data" SUBNET_PREFIX="172.18.0" diff --git a/apps/safeline/3.10.0/data.yml b/apps/safeline/3.10.0/data.yml index 11e7f42f..abc6d6a3 100644 --- a/apps/safeline/3.10.0/data.yml +++ b/apps/safeline/3.10.0/data.yml @@ -1,15 +1,15 @@ additionalProperties: formFields: - - default: "" - edit: true + - default: "safeline-redis" + disabled: true envKey: REDIS_HOST key: redis labelEn: Redis Service labelZh: Redis服务 required: true - type: service + type: text - default: "6379" - edit: true + disabled: true envKey: REDIS_PORT labelEn: Redis Service Port labelZh: Redis服务端口 @@ -58,7 +58,7 @@ additionalProperties: - default: 172.18.0 edit: true envKey: SUBNET_PREFIX - labelEn: 1panel-network subnet prefix - labelZh: 1panel-network 子网前缀 + labelEn: 1panel-network subnet prefix (Check the docker network to get it) + labelZh: 1panel-network 子网前缀 (查看docker网络获取) required: true - type: text + type: text \ No newline at end of file diff --git a/apps/safeline/3.10.0/docker-compose.yml b/apps/safeline/3.10.0/docker-compose.yml index 666865f9..b2a07080 100644 --- a/apps/safeline/3.10.0/docker-compose.yml +++ b/apps/safeline/3.10.0/docker-compose.yml @@ -1,24 +1,5 @@ version: '3' services: - safeline-postgres: - container_name: ${CONTAINER_NAME}-postgres - restart: always - networks: - 1panel-network: - ipv4_address: ${SUBNET_PREFIX}.232 - image: postgres:15.4-bookworm - volumes: - - ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data - - /etc/localtime:/etc/localtime:ro - environment: - - POSTGRES_USER=safeline-ce - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - cap_drop: - - net_raw - command: [postgres, -c, max_connections=200] - labels: - createdBy: Apps - safeline-management: container_name: ${CONTAINER_NAME}-mgt-api restart: always @@ -39,7 +20,7 @@ services: - DATABASE_URL=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-postgres/safeline-ce - MARIO_URL=http://safeline-mario:3335 - DETECTOR_URL=http://safeline-detector:8001 - - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/2 + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/0 - MANAGEMENT_LOGS_DIR=/logs/management dns: - 119.29.29.29 @@ -88,7 +69,7 @@ services: - LOG_DIR=/logs/mario - GOGC=100 - DATABASE_URL=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-postgres/safeline-ce - - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/2 + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/0 cap_drop: - net_raw labels: @@ -107,6 +88,7 @@ services: - ${SAFELINE_DIR}/resources/cache:/usr/local/nginx/cache - /etc/resolv.conf:/etc/resolv.conf environment: + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${SUBNET_PREFIX}.233:${REDIS_PORT}/0 - MGT_ADDR=${SUBNET_PREFIX}.234:9002 ulimits: nofile: 131072 @@ -114,6 +96,43 @@ services: labels: createdBy: Apps + safeline-postgres: + container_name: ${CONTAINER_NAME}-postgres + restart: always + networks: + 1panel-network: + ipv4_address: ${SUBNET_PREFIX}.232 + image: postgres:15.4-bookworm + volumes: + - ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data + - /etc/localtime:/etc/localtime:ro + environment: + - POSTGRES_USER=safeline-ce + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + cap_drop: + - net_raw + command: [postgres, -c, max_connections=200] + labels: + createdBy: Apps + + safeline-redis: + container_name: ${CONTAINER_NAME}-redis + restart: always + networks: + 1panel-network: + ipv4_address: ${SUBNET_PREFIX}.233 + image: redis:7.2.2 + volumes: + - ${SAFELINE_DIR}/resources/redis/data:/data + - /etc/localtime:/etc/localtime:ro + command: redis-server --appendonly yes --requirepass ${PANEL_REDIS_ROOT_PASSWORD} + cap_drop: + - net_raw + sysctls: + net.core.somaxconn: "511" + labels: + createdBy: Apps + networks: 1panel-network: external: true \ No newline at end of file diff --git a/apps/safeline/latest/.env.sample b/apps/safeline/latest/.env.sample index 519f16aa..01ca84fd 100644 --- a/apps/safeline/latest/.env.sample +++ b/apps/safeline/latest/.env.sample @@ -2,8 +2,8 @@ CONTAINER_NAME="safeline" PANEL_APP_PORT_HTTP="40080" PANEL_APP_PORT_HTTP2="40081" POSTGRES_PASSWORD="password_xxJdZD" -REDIS_HOST="redis" -PANEL_REDIS_ROOT_PASSWORD="" +REDIS_HOST="safeline-redis" +PANEL_REDIS_ROOT_PASSWORD="redis_password" REDIS_PORT="6379" SAFELINE_DIR="./data" SUBNET_PREFIX="172.18.0" diff --git a/apps/safeline/latest/data.yml b/apps/safeline/latest/data.yml index 11e7f42f..abc6d6a3 100644 --- a/apps/safeline/latest/data.yml +++ b/apps/safeline/latest/data.yml @@ -1,15 +1,15 @@ additionalProperties: formFields: - - default: "" - edit: true + - default: "safeline-redis" + disabled: true envKey: REDIS_HOST key: redis labelEn: Redis Service labelZh: Redis服务 required: true - type: service + type: text - default: "6379" - edit: true + disabled: true envKey: REDIS_PORT labelEn: Redis Service Port labelZh: Redis服务端口 @@ -58,7 +58,7 @@ additionalProperties: - default: 172.18.0 edit: true envKey: SUBNET_PREFIX - labelEn: 1panel-network subnet prefix - labelZh: 1panel-network 子网前缀 + labelEn: 1panel-network subnet prefix (Check the docker network to get it) + labelZh: 1panel-network 子网前缀 (查看docker网络获取) required: true - type: text + type: text \ No newline at end of file diff --git a/apps/safeline/latest/docker-compose.yml b/apps/safeline/latest/docker-compose.yml index 1e6c03c8..97ce27d6 100644 --- a/apps/safeline/latest/docker-compose.yml +++ b/apps/safeline/latest/docker-compose.yml @@ -1,24 +1,5 @@ version: '3' services: - safeline-postgres: - container_name: ${CONTAINER_NAME}-postgres - restart: always - networks: - 1panel-network: - ipv4_address: ${SUBNET_PREFIX}.232 - image: postgres:15.4-bookworm - volumes: - - ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data - - /etc/localtime:/etc/localtime:ro - environment: - - POSTGRES_USER=safeline-ce - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - cap_drop: - - net_raw - command: [postgres, -c, max_connections=200] - labels: - createdBy: Apps - safeline-management: container_name: ${CONTAINER_NAME}-mgt-api restart: always @@ -39,7 +20,7 @@ services: - DATABASE_URL=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-postgres/safeline-ce - MARIO_URL=http://safeline-mario:3335 - DETECTOR_URL=http://safeline-detector:8001 - - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/2 + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/0 - MANAGEMENT_LOGS_DIR=/logs/management dns: - 119.29.29.29 @@ -88,7 +69,7 @@ services: - LOG_DIR=/logs/mario - GOGC=100 - DATABASE_URL=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-postgres/safeline-ce - - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/2 + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/0 cap_drop: - net_raw labels: @@ -107,6 +88,7 @@ services: - ${SAFELINE_DIR}/resources/cache:/usr/local/nginx/cache - /etc/resolv.conf:/etc/resolv.conf environment: + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${SUBNET_PREFIX}.233:${REDIS_PORT}/0 - MGT_ADDR=${SUBNET_PREFIX}.234:9002 ulimits: nofile: 131072 @@ -114,6 +96,43 @@ services: labels: createdBy: Apps + safeline-postgres: + container_name: ${CONTAINER_NAME}-postgres + restart: always + networks: + 1panel-network: + ipv4_address: ${SUBNET_PREFIX}.232 + image: postgres:15.4-bookworm + volumes: + - ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data + - /etc/localtime:/etc/localtime:ro + environment: + - POSTGRES_USER=safeline-ce + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + cap_drop: + - net_raw + command: [postgres, -c, max_connections=200] + labels: + createdBy: Apps + + safeline-redis: + container_name: ${CONTAINER_NAME}-redis + restart: always + networks: + 1panel-network: + ipv4_address: ${SUBNET_PREFIX}.233 + image: redis:7.2.2 + volumes: + - ${SAFELINE_DIR}/resources/redis/data:/data + - /etc/localtime:/etc/localtime:ro + command: redis-server --appendonly yes --requirepass ${PANEL_REDIS_ROOT_PASSWORD} + cap_drop: + - net_raw + sysctls: + net.core.somaxconn: "511" + labels: + createdBy: Apps + networks: 1panel-network: external: true \ No newline at end of file diff --git a/apps/safeline/newnet-3.10.0/.env.sample b/apps/safeline/newnet-3.10.0/.env.sample index d55063b4..f05adf95 100644 --- a/apps/safeline/newnet-3.10.0/.env.sample +++ b/apps/safeline/newnet-3.10.0/.env.sample @@ -2,8 +2,8 @@ CONTAINER_NAME="safeline" PANEL_APP_PORT_HTTP="40080" PANEL_APP_PORT_HTTP2="40081" POSTGRES_PASSWORD="password_xxJdZD" -REDIS_HOST="redis" -PANEL_REDIS_ROOT_PASSWORD="" +REDIS_HOST="safeline-redis" +PANEL_REDIS_ROOT_PASSWORD="redis_password" REDIS_PORT="6379" SAFELINE_DIR="./data" SUBNET_PREFIX="169.254.0" \ No newline at end of file diff --git a/apps/safeline/newnet-3.10.0/data.yml b/apps/safeline/newnet-3.10.0/data.yml index 30d3dd67..a95ec2a5 100644 --- a/apps/safeline/newnet-3.10.0/data.yml +++ b/apps/safeline/newnet-3.10.0/data.yml @@ -1,15 +1,15 @@ additionalProperties: formFields: - - default: "" - edit: true + - default: "safeline-redis" + disabled: true envKey: REDIS_HOST key: redis labelEn: Redis Service labelZh: Redis服务 required: true - type: service + type: text - default: "6379" - edit: true + disabled: true envKey: REDIS_PORT labelEn: Redis Service Port labelZh: Redis服务端口 diff --git a/apps/safeline/newnet-3.10.0/docker-compose.yml b/apps/safeline/newnet-3.10.0/docker-compose.yml index dd8632e3..5087ceb7 100644 --- a/apps/safeline/newnet-3.10.0/docker-compose.yml +++ b/apps/safeline/newnet-3.10.0/docker-compose.yml @@ -1,25 +1,5 @@ version: '3' services: - safeline-postgres: - container_name: ${CONTAINER_NAME}-postgres - restart: always - networks: - 1panel-network: - safeline-ce: - ipv4_address: ${SUBNET_PREFIX}.2 - image: postgres:15.4-bookworm - volumes: - - ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data - - /etc/localtime:/etc/localtime:ro - environment: - - POSTGRES_USER=safeline-ce - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - cap_drop: - - net_raw - command: [postgres, -c, max_connections=200] - labels: - createdBy: Apps - safeline-management: container_name: ${CONTAINER_NAME}-mgt-api restart: always @@ -41,7 +21,7 @@ services: - DATABASE_URL=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-postgres/safeline-ce - MARIO_URL=http://safeline-mario:3335 - DETECTOR_URL=http://safeline-detector:8001 - - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/2 + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/0 - MANAGEMENT_LOGS_DIR=/logs/management dns: - 119.29.29.29 @@ -90,7 +70,7 @@ services: - LOG_DIR=/logs/mario - GOGC=100 - DATABASE_URL=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-postgres/safeline-ce - - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/2 + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/0 cap_drop: - net_raw labels: @@ -109,6 +89,7 @@ services: - ${SAFELINE_DIR}/resources/cache:/usr/local/nginx/cache - /etc/resolv.conf:/etc/resolv.conf environment: + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${SUBNET_PREFIX}.3:${REDIS_PORT}/0 - MGT_ADDR=${SUBNET_PREFIX}.4:9002 ulimits: nofile: 131072 @@ -116,6 +97,45 @@ services: labels: createdBy: Apps + safeline-postgres: + container_name: ${CONTAINER_NAME}-postgres + restart: always + networks: + 1panel-network: + safeline-ce: + ipv4_address: ${SUBNET_PREFIX}.2 + image: postgres:15.4-bookworm + volumes: + - ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data + - /etc/localtime:/etc/localtime:ro + environment: + - POSTGRES_USER=safeline-ce + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + cap_drop: + - net_raw + command: [postgres, -c, max_connections=200] + labels: + createdBy: Apps + + safeline-redis: + container_name: ${CONTAINER_NAME}-redis + restart: always + networks: + 1panel-network: + safeline-ce: + ipv4_address: ${SUBNET_PREFIX}.3 + image: redis:7.2.2 + volumes: + - ${SAFELINE_DIR}/resources/redis/data:/data + - /etc/localtime:/etc/localtime:ro + command: redis-server --appendonly yes --requirepass ${PANEL_REDIS_ROOT_PASSWORD} + cap_drop: + - net_raw + sysctls: + net.core.somaxconn: "511" + labels: + createdBy: Apps + networks: 1panel-network: external: true diff --git a/apps/safeline/newnet-latest/.env.sample b/apps/safeline/newnet-latest/.env.sample index d55063b4..f05adf95 100644 --- a/apps/safeline/newnet-latest/.env.sample +++ b/apps/safeline/newnet-latest/.env.sample @@ -2,8 +2,8 @@ CONTAINER_NAME="safeline" PANEL_APP_PORT_HTTP="40080" PANEL_APP_PORT_HTTP2="40081" POSTGRES_PASSWORD="password_xxJdZD" -REDIS_HOST="redis" -PANEL_REDIS_ROOT_PASSWORD="" +REDIS_HOST="safeline-redis" +PANEL_REDIS_ROOT_PASSWORD="redis_password" REDIS_PORT="6379" SAFELINE_DIR="./data" SUBNET_PREFIX="169.254.0" \ No newline at end of file diff --git a/apps/safeline/newnet-latest/data.yml b/apps/safeline/newnet-latest/data.yml index 30d3dd67..a95ec2a5 100644 --- a/apps/safeline/newnet-latest/data.yml +++ b/apps/safeline/newnet-latest/data.yml @@ -1,15 +1,15 @@ additionalProperties: formFields: - - default: "" - edit: true + - default: "safeline-redis" + disabled: true envKey: REDIS_HOST key: redis labelEn: Redis Service labelZh: Redis服务 required: true - type: service + type: text - default: "6379" - edit: true + disabled: true envKey: REDIS_PORT labelEn: Redis Service Port labelZh: Redis服务端口 diff --git a/apps/safeline/newnet-latest/docker-compose.yml b/apps/safeline/newnet-latest/docker-compose.yml index 276656ae..da4c29a6 100644 --- a/apps/safeline/newnet-latest/docker-compose.yml +++ b/apps/safeline/newnet-latest/docker-compose.yml @@ -1,25 +1,5 @@ version: '3' services: - safeline-postgres: - container_name: ${CONTAINER_NAME}-postgres - restart: always - networks: - 1panel-network: - safeline-ce: - ipv4_address: ${SUBNET_PREFIX}.2 - image: postgres:15.4-bookworm - volumes: - - ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data - - /etc/localtime:/etc/localtime:ro - environment: - - POSTGRES_USER=safeline-ce - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - cap_drop: - - net_raw - command: [postgres, -c, max_connections=200] - labels: - createdBy: Apps - safeline-management: container_name: ${CONTAINER_NAME}-mgt-api restart: always @@ -41,7 +21,7 @@ services: - DATABASE_URL=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-postgres/safeline-ce - MARIO_URL=http://safeline-mario:3335 - DETECTOR_URL=http://safeline-detector:8001 - - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/2 + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/0 - MANAGEMENT_LOGS_DIR=/logs/management dns: - 119.29.29.29 @@ -90,7 +70,7 @@ services: - LOG_DIR=/logs/mario - GOGC=100 - DATABASE_URL=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-postgres/safeline-ce - - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/2 + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}/0 cap_drop: - net_raw labels: @@ -109,6 +89,7 @@ services: - ${SAFELINE_DIR}/resources/cache:/usr/local/nginx/cache - /etc/resolv.conf:/etc/resolv.conf environment: + - REDIS_URL=redis://:${PANEL_REDIS_ROOT_PASSWORD}@${SUBNET_PREFIX}.3:${REDIS_PORT}/0 - MGT_ADDR=${SUBNET_PREFIX}.4:9002 ulimits: nofile: 131072 @@ -116,6 +97,45 @@ services: labels: createdBy: Apps + safeline-postgres: + container_name: ${CONTAINER_NAME}-postgres + restart: always + networks: + 1panel-network: + safeline-ce: + ipv4_address: ${SUBNET_PREFIX}.2 + image: postgres:15.4-bookworm + volumes: + - ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data + - /etc/localtime:/etc/localtime:ro + environment: + - POSTGRES_USER=safeline-ce + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + cap_drop: + - net_raw + command: [postgres, -c, max_connections=200] + labels: + createdBy: Apps + + safeline-redis: + container_name: ${CONTAINER_NAME}-redis + restart: always + networks: + 1panel-network: + safeline-ce: + ipv4_address: ${SUBNET_PREFIX}.3 + image: redis:7.2.2 + volumes: + - ${SAFELINE_DIR}/resources/redis/data:/data + - /etc/localtime:/etc/localtime:ro + command: redis-server --appendonly yes --requirepass ${PANEL_REDIS_ROOT_PASSWORD} + cap_drop: + - net_raw + sysctls: + net.core.somaxconn: "511" + labels: + createdBy: Apps + networks: 1panel-network: external: true