update 26.7.26

This commit is contained in:
kun
2026-07-26 02:09:48 +08:00
parent 39bb168568
commit 00cb8cd04e
12 changed files with 363 additions and 7 deletions
+1 -1
View File
@@ -291,6 +291,6 @@ NGINX_PROXY_READ_TIMEOUT=3600s
NGINX_PROXY_SEND_TIMEOUT=3600s
NGINX_ENABLE_CERTBOT_CHALLENGE=false
NGINX_SOCKET_IO_UPSTREAM=api_websocket:5001
EXPOSE_NGINX_PORT=3700
EXPOSE_NGINX_PORT=3400
EXPOSE_NGINX_SSL_PORT=8443
COMPOSE_PROFILES=${VECTOR_STORE:-weaviate},${DB_TYPE:-postgresql},collaboration
+2 -2
View File
@@ -129,9 +129,9 @@ def main():
base_dir = os.path.dirname(os.path.abspath(__file__))
env_example_path = os.path.join(base_dir, ".env.example")
template_path = os.path.join(base_dir, "docker-compose-template.yaml")
output_path = os.path.join(base_dir, "docker-compose.yaml")
output_path = os.path.join(base_dir, "compose.yml")
# Define header comments to be added at the top of docker-compose.yaml
# Define header comments to be added at the top of compose.yml
header_comments = (
"# ==================================================================\n"
"# WARNING: This file is auto-generated by generate_docker_compose\n"
+23
View File
@@ -0,0 +1,23 @@
# 时区
TZ=Asia/Shanghai
# 镜像版本
MYSQL_VERSION=8.4
POSTGRES_VERSION=18
REDIS_VERSION=8.6.5-alpine
# 宿主机端口
MYSQL_PORT=4100
POSTGRES_PORT=4200
REDIS_PORT=4300
# MySQL
MYSQL_ROOT_PASSWORD=nxY7HUoJYjUgn
# PostgreSQL
POSTGRES_USER=kun
POSTGRES_PASSWORD=nxY7HUoJYjUgn
POSTGRES_DB=postgres
# Redis
REDIS_PASSWORD=nxY7HUoJYjUgn
+102
View File
@@ -0,0 +1,102 @@
name: home-databases
services:
mysql:
image: mysql:${MYSQL_VERSION:-8.4}
container_name: home_mysql
restart: unless-stopped
environment:
TZ: ${TZ:-Asia/Shanghai}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
ports:
- "${MYSQL_PORT:-4100}:3306"
volumes:
- /volume1/docker/docker_projects/home_database/mysql:/var/lib/mysql
networks:
- database_network
healthcheck:
test:
[
"CMD-SHELL",
"mysqladmin ping -h 127.0.0.1 -uroot -p$$MYSQL_ROOT_PASSWORD --silent"
]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
postgres:
image: postgres:${POSTGRES_VERSION:-18}
container_name: home_postgres
restart: unless-stopped
environment:
TZ: ${TZ:-Asia/Shanghai}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "${POSTGRES_PORT:-4200}:5432"
volumes:
# PostgreSQL 18+ 建议挂载到上一级目录
- /volume1/docker/docker_projects/home_database/postgres:/var/lib/postgresql
networks:
- database_network
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"
]
interval: 10s
timeout: 5s
retries: 10
start_period: 20s
redis:
image: redis:${REDIS_VERSION:-8.6.5-alpine}
container_name: home_redis
restart: unless-stopped
environment:
TZ: ${TZ:-Asia/Shanghai}
REDIS_PASSWORD: ${REDIS_PASSWORD}
command:
- redis-server
- --requirepass
- ${REDIS_PASSWORD}
- --appendonly
- "yes"
- --appendfsync
- everysec
- --save
- "900"
- "1"
- --save
- "300"
- "10"
- --save
- "60"
- "10000"
ports:
- "${REDIS_PORT:-4300}:6379"
volumes:
- /volume1/docker/docker_projects/home_database/redis:/data
networks:
- database_network
healthcheck:
test:
[
"CMD-SHELL",
"redis-cli -a \"$$REDIS_PASSWORD\" --no-auth-warning ping | grep PONG"
]
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
networks:
database_network:
name: home_database_network
driver: bridge
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
# Change these
REG_TOKEN=
DOMAIN=localhost
ROOT_URL=http://localhost:5200
RELEASE=8.6.1
# Change to true after you set your domain and valid lets encrypt email
LETSENCRYPT_ENABLED=false
LETSENCRYPT_EMAIL=demo@email.com
TRAEFIK_PROTOCOL=http
# MongoDB
MONGODB_BIND_IP=127.0.0.1
MONGODB_PORT_NUMBER=27017
# NATS (bundled compose.nats.yml). For external NATS, set NATS_URL and omit compose.nats.yml; see docs/external-nats.md
NATS_PORT_NUMBER=4223
NATS_BIND_IP=127.0.0.1
# NATS_URL=monolith+nats://your-nats-host:4222
+111
View File
@@ -0,0 +1,111 @@
services:
mongodb-fix-permission-container:
image: docker.io/mongodb/mongodb-community-server:${MONGODB_VERSION:-8.2}-ubi8
restart: on-failure
user: "0"
volumes:
- ${MONGODB_HOST_PATH:-mongodb_data}:/data/db:rw
environment:
MONGODB_USER_ID: ${MONGODB_USER_ID:-1001}
entrypoint: |
sh -xc '
owner="$(stat -c %u /data/db)";
# for fresh installs
if [ "$$owner" != "$$MONGODB_USER_ID" ]; then
echo "=====> Fixing directory ownership to uid $$MONGODB_USER_ID"
chown -R "$$MONGODB_USER_ID" /data/db;
else echo "=====> Nothing to do"; fi;
'
# TODO: add user creation here
mongodb-init-container:
image: docker.io/mongodb/mongodb-community-server:${MONGODB_VERSION:-8.2}-ubi8
restart: on-failure
# depends_on:
# mongodb:
# condition: service_healthy
user: "0"
environment:
MONGODB_REPLICA_SET_NAME: ${MONGODB_REPLICA_SET_NAME:-rs0}
MONGODB_PORT_NUMBER: ${MONGODB_PORT_NUMBER:-27017}
MONGODB_URI: ${MONGODB_URI:-mongodb://mongodb:27017/?directConnection=true}
MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongodb}
volumes:
- ${MONGODB_HOST_PATH:-mongodb_data}:/data/db:rw
logging:
driver: "json-file"
labels:
container_tag: "${COMPOSE_PROJECT_NAME:-rocketchat}#mongodb-init-container"
entrypoint: |
sh -xc '
echo "=====> Waiting for MongoDB to be healthy before initiating replica set...";
until mongosh "$$MONGODB_URI" --eval "db.adminCommand(\"ping\")" >/dev/null 2>&1; do
echo "=====> MongoDB not ready yet, retrying in 5 seconds...";
sleep 5;
done;
echo "=====> Initiating ReplSet $$MONGODB_REPLICA_SET_NAME at $$MONGODB_ADVERTISED_HOSTNAME:$$MONGODB_PORT_NUMBER...";
mongosh "$$MONGODB_URI" --eval "rs.initiate({_id: \"$$MONGODB_REPLICA_SET_NAME\", members: [{ _id: 0, host: \"$$MONGODB_ADVERTISED_HOSTNAME:$$MONGODB_PORT_NUMBER\" }]})";
echo "=====> Initiating ReplSet done...";
'
mongodb:
image: docker.io/mongodb/mongodb-community-server:${MONGODB_VERSION:-8.2}-ubi8
restart: always
# depends_on:
# mongodb-fix-permission-container:
# condition: service_completed_successfully
volumes:
- ${MONGODB_HOST_PATH:-mongodb_data}:/data/db:rw
user: "${MONGODB_USER_ID:-1001}"
entrypoint:
- sh
- -ec
- |
echo "=====> Waiting for /data/db to be owned by uid=$$MONGODB_USER_ID (mongodb user) ...";
for i in $(seq 1 60); do
owner="$(stat -c %u /data/db 2>/dev/null || true)";
if [ "$$owner" = "$$MONGODB_USER_ID" ]; then
echo "=====> /data/db ownership OK ($$owner) - starting MongoDB";
exec mongod --replSet "$$MONGODB_REPLICA_SET_NAME" --bind_ip_all;
fi;
echo "=====> /data/db owner is '$$owner' (expected $$MONGODB_USER_ID), retrying in 5 seconds...";
sleep 5;
done;
echo "=====> Giving up waiting for /data/db ownership after 5 minutes";
exit 1
environment:
MONGODB_USER_ID: ${MONGODB_USER_ID:-1001}
MONGODB_REPLICA_SET_NAME: ${MONGODB_REPLICA_SET_NAME:-rs0}
MONGODB_PORT_NUMBER: ${MONGODB_PORT_NUMBER:-27017}
MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongodb}
ALLOW_EMPTY_PASSWORD: ${ALLOW_EMPTY_PASSWORD:-yes}
logging:
driver: "json-file"
labels:
container_tag: "${COMPOSE_PROJECT_NAME:-rocketchat}#mongodb"
healthcheck:
test:
- CMD
- mongosh
- "mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_PORT_NUMBER:-27017}/?directConnection=true"
- --eval
- '"db.adminCommand(''ping'')"'
interval: 30s
timeout: 10s
retries: 10
start_period: 30s
ports:
- "${MONGODB_BIND_IP:-127.0.0.1}:${MONGODB_PORT_NUMBER:-27017}:${MONGODB_PORT_NUMBER:-27017}"
mongodb-exporter:
image: docker.io/percona/mongodb_exporter:${MONGODB_EXPORTER_VERSION:-0.44.0}
depends_on:
- mongodb
expose:
- 9216
command:
- --mongodb.uri=${MONGODB_URI:-mongodb://mongodb:27017}
- --collect-all
- --compatible-mode
volumes:
mongodb_data: {driver: local}
+32
View File
@@ -0,0 +1,32 @@
services:
nats:
image: docker.io/nats:${NATS_VERSION:-2.11-alpine}
restart: always
expose:
- 4222
- 8222
- 6222
# healthcheck:
# test: ["CMD", "nc", "-zv", "-w", "10", "nats", "4222"]
# interval: 30s
# timeout: 10s
# retries: 10
# start_period: 30s
command: --http_port 8222
ports:
- "${NATS_BIND_IP:-127.0.0.1}:${NATS_PORT_NUMBER:-4222}:4222"
logging:
driver: "json-file"
labels:
container_tag: "${COMPOSE_PROJECT_NAME:-rocketchat}#nats"
nats-exporter:
image: docker.io/natsio/prometheus-nats-exporter:${NATS_EXPORTER_VERSION:-0.17.3}
depends_on:
- nats
expose:
- 7777
command:
- -healthz
- -varz
- "http://nats:8222"
+65
View File
@@ -0,0 +1,65 @@
services:
rocketchat:
image: ${IMAGE:-registry.rocket.chat/rocketchat/rocket.chat}:${RELEASE:-8.0.1}
restart: always
labels:
prometheus.io/scrape: "true"
prometheus.io/port: ${METRICS_PORT:-9458}
container_tag: "${COMPOSE_PROJECT_NAME:-rocketchat}#rocketchat"
environment:
ROOT_URL: ${ROOT_URL:-http://localhost}
PORT: ${PORT:-3000}
DEPLOY_METHOD: docker
DEPLOY_PLATFORM: compose
REG_TOKEN: ${REG_TOKEN:-}
LICENSE_DEBUG: true
OVERWRITE_SETTING_Prometheus_Enabled: true
OVERWRITE_SETTING_Prometheus_Port: "${METRICS_PORT:-9458}"
MONGO_URL: ${MONGO_URL:-mongodb://mongodb:27017/rocketchat?replicaSet=rs0}
TRANSPORTER: "${NATS_URL-monolith+nats://nats:4222}"
INSTANCE_IP: "${INSTANCE_IP:-}"
# depends_on:
# mongodb-init-container:
# condition: service_completed_successfully
entrypoint: sh
command:
- -c
- |
protocol=$(echo $$MONGO_URL | awk -F'://' '{print $$1}')
if [ "$$protocol" = "mongodb+srv" ]; then
echo "=====> MongoDB is using SRV protocol, skipping healthcheck before attempting to start rocket.chat ...";
exec node main.js;
fi
host_port=$(echo $$MONGO_URL | awk -F/ '{print $$3}')
if echo $$host_port | grep -q @; then
host_port=$(echo $$host_port | awk -F@ '{print $$2}')
fi
echo "=====> host_port: $$host_port";
host=$${host_port%%:*}
port=$${host_port##*:}
port=$${port:-27017}
echo "=====> Waiting for MongoDB ($$host:$$port) to be ready before starting Rocket.Chat...";
for i in $(seq 1 60); do
if nc -z $$host $$port >/dev/null 2>&1; then
echo "=====> MongoDB is up - starting Rocket.Chat";
exec node main.js;
fi;
echo "=====> MongoDB not ready yet, retrying in 5 seconds...";
sleep 5;
done;
echo "=====> Giving up waiting for MongoDB after 5 minutes";
exit 1
expose:
- ${PORT:-3000}
- ${METRICS_PORT:-9458}
ports:
- "${BIND_IP:-0.0.0.0}:${HOST_PORT:-3000}:${PORT:-3000}"
- "${BIND_IP:-0.0.0.0}:${METRICS_PORT:-9458}:${METRICS_PORT:-9458}"
logging:
driver: "json-file"
# healthcheck:
# test: ["CMD", "nc", "-zv", "-w", "10", "rocketchat", "${PORT:-3000}"]
# interval: 30s
# timeout: 10s
# retries: 10
# start_period: 30s
View File
+4
View File
@@ -0,0 +1,4 @@
include:
- compose.yml
- compose.database.yml
- compose.nats.yml