添加init.sh脚本,修改storage目录初始结构

This commit is contained in:
chenqiang 2024-08-21 14:14:06 +08:00
parent bb150a7eee
commit cee11adbdb
10 changed files with 63 additions and 68 deletions

View File

@ -74,21 +74,12 @@ services:
ports:
- ${NGINX_PORT}:80
depends_on:
rabbitmq:
condition: service_healthy
restart: true
pgadmin:
condition: service_healthy
restart: true
portainer:
condition: service_healthy
restart: true
minio:
condition: service_healthy
restart: true
mongo-express:
condition: service_healthy
restart: true
rabbitmq:
condition: service_healthy
restart: true
minio:
condition: service_healthy
restart: true
# 容器可视化管理应用被nginx代理
portainer:
@ -99,11 +90,6 @@ services:
volumes:
- portainer:/data
- /var/run/docker.sock:/var/run/docker.sock
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000"] # 假设Portainer的HTTP接口在9000端口
interval: 30s
timeout: 10s
retries: 3
# postgres数据库管理应用被nginx代理
pgadmin:
@ -116,13 +102,9 @@ services:
- ./pgadmin/servers.json:/pgadmin4/servers.json
- pgadmin:/var/lib/pgadmin
restart: always
networks:
networks:
- ${NETWORK_NAME}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80"] # 假设PgAdmin的HTTP接口在80端口
interval: 30s
timeout: 10s
retries: 3
depends_on:
postgres:
condition: service_healthy
@ -145,12 +127,12 @@ services:
- ${NETWORK_NAME}
command:
- postgres
- -c
- 'config_file=/etc/postgres/postgresql.conf'
- -c
- 'hba_file=/etc/postgres/pg_hba.conf'
- "config_file=/etc/postgres/postgresql.conf"
- -c
- 'ident_file=/etc/postgres/pg_ident.conf'
- "hba_file=/etc/postgres/pg_hba.conf"
- -c
- "ident_file=/etc/postgres/pg_ident.conf"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U hello"]
interval: 15s
@ -172,11 +154,6 @@ services:
ME_CONFIG_BASICAUTH_USERNAME: hello
ME_CONFIG_BASICAUTH_PASSWORD: helloworld
ME_CONFIG_BASICAUTH: true
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081"] # 假设mongo-express的HTTP接口在8081端口
interval: 30s
timeout: 10s
retries: 3
depends_on:
mongo:
condition: service_healthy
@ -197,9 +174,10 @@ services:
- ./mongo/conf:/etc/mongo
networks:
- ${NETWORK_NAME}
command: ['mongod', '--config', '/etc/mongo/mongod.conf']
command: ["mongod", "--config", "/etc/mongo/mongod.conf"]
healthcheck:
test: ["CMD-SHELL", "mongosh -u hello -p helloworld --eval \"db.stats().ok\""]
test:
["CMD-SHELL", 'mongosh -u hello -p helloworld --eval "db.stats().ok"']
interval: 20s
retries: 5
start_period: 15s
@ -215,7 +193,7 @@ services:
- ./redis/conf:/etc/redis
networks:
- ${NETWORK_NAME}
command: ['redis-server', '/etc/redis/redis.conf']
command: ["redis-server", "/etc/redis/redis.conf"]
healthcheck:
test: ["CMD", "redis-cli", "-a", "helloworld", "ping"]
interval: 15s
@ -238,9 +216,9 @@ services:
command: server --console-address ':9001'
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 15s
retries: 3
start_period: 60s
interval: 20s
retries: 5
start_period: 15s
timeout: 10s
# rabbitmq消息队列服务
@ -255,12 +233,12 @@ services:
volumes:
- rabbitmq:/var/lib/rabbitmq/mnesia
- ./rabbitmq/conf/conf.d:/etc/rabbitmq/conf.d
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "check_running"]
interval: 30s
timeout: 10s
retries: 5
start_period: 5s
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "check_running"]
interval: 30s
timeout: 10s
retries: 5
start_period: 5s
# webman提供的web接口服务提供http和ws服务被nginx代理
# api:
@ -301,4 +279,4 @@ services:
# restart: true
# minio:
# condition: service_healthy
# restart: true
# restart: true

30
init.sh Normal file
View File

@ -0,0 +1,30 @@
#!/bin/bash
# 获取脚本所在目录的绝对路径
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
# 切换工作目录到脚本所在目录
cd "$SCRIPT_DIR" || exit 1
mkdir ./storage/minio
echo "mkdir ./storage/minio\n"
mkdir ./storage/mongo
echo "mkdir ./storage/mongo\n"
mkdir ./storage/pgadmin
echo "mkdir ./storage/pgadmin\n"
mkdir ./storage/portainer
echo "mkdir ./storage/portainer\n"
mkdir ./storage/postgres
echo "mkdir ./storage/postgres\n"
mkdir ./storage/rabbitmq
echo "mkdir ./storage/rabbitmq\n"
mkdir ./storage/redis
echo "mkdir ./storage/redis\n"
chmod 755 -R ./storage
echo "chmod 755 -R ./storage\n"
chown 5050:5050 ./storage/pgadmin
echo "chown 5050:5050 ./storage/pgadmin\n"
echo "All done. Now you can run 'docker compose up -d' to start the services.\n"

7
storage/.gitignore vendored Executable file
View File

@ -0,0 +1,7 @@
/minio/*
/mongo/*
/pgadmin/*
/portainer/*
/postgres/*
/rabbitmq/*
/redis/*

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,8 +0,0 @@
pgdata/*
archived/*
backup/first/*
backup/*
!.gitignore
!pgdata
!backup/first
!archived

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,2 +0,0 @@
*
!.gitignore