chore: 补充部署编排配置
- 增加 Docker Compose、共享服务初始化脚本与 Nginx 配置 - 补充部署环境应用配置与数据库初始化脚本
This commit is contained in:
23
deploy/scripts/init-shared-minio.sh
Normal file
23
deploy/scripts/init-shared-minio.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
minio_alias="${MINIO_ALIAS:-easycard}"
|
||||
minio_endpoint="${MINIO_ENDPOINT:-http://minio-shared:9000}"
|
||||
minio_root_user="${MINIO_ROOT_USER:-easyflowadmin}"
|
||||
minio_root_password="${MINIO_ROOT_PASSWORD:-easyflowadmin123}"
|
||||
minio_bucket="${MINIO_BUCKET:-easycard}"
|
||||
minio_public_bucket="${MINIO_PUBLIC_BUCKET:-true}"
|
||||
|
||||
echo "waiting for shared minio at ${minio_endpoint} ..."
|
||||
until mc alias set "${minio_alias}" "${minio_endpoint}" "${minio_root_user}" "${minio_root_password}"; do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
mc mb -p "${minio_alias}/${minio_bucket}" || true
|
||||
|
||||
if [ "${minio_public_bucket}" = "true" ]; then
|
||||
mc anonymous set download "${minio_alias}/${minio_bucket}" || true
|
||||
fi
|
||||
|
||||
echo "shared minio bucket initialization completed"
|
||||
28
deploy/scripts/init-shared-mysql.sh
Normal file
28
deploy/scripts/init-shared-mysql.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
mysql_host="${MYSQL_HOST:-mysql-shared}"
|
||||
mysql_port="${MYSQL_PORT:-3306}"
|
||||
mysql_root_password="${MYSQL_ROOT_PASSWORD:-root}"
|
||||
mysql_init_sql_file="${MYSQL_INIT_SQL_FILE:-/tmp/scripts/sql/easycard_init.sql}"
|
||||
|
||||
echo "waiting for shared mysql at ${mysql_host}:${mysql_port} ..."
|
||||
until mysqladmin ping \
|
||||
-h "${mysql_host}" \
|
||||
-P "${mysql_port}" \
|
||||
-uroot \
|
||||
-p"${mysql_root_password}" \
|
||||
--silent; do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "initializing database from ${mysql_init_sql_file} ..."
|
||||
mysql \
|
||||
-h "${mysql_host}" \
|
||||
-P "${mysql_port}" \
|
||||
-uroot \
|
||||
-p"${mysql_root_password}" \
|
||||
< "${mysql_init_sql_file}"
|
||||
|
||||
echo "shared mysql initialization completed"
|
||||
12
deploy/scripts/sql/easycard_init.sql
Normal file
12
deploy/scripts/sql/easycard_init.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS `easycard`
|
||||
DEFAULT CHARACTER SET utf8mb4
|
||||
DEFAULT COLLATE utf8mb4_0900_ai_ci;
|
||||
|
||||
USE `easycard`;
|
||||
|
||||
-- 当前阶段收敛为:
|
||||
-- 1. MySQL 初始化脚本只负责建库
|
||||
-- 2. 表结构、基础平台数据、演示数据全部由 Flyway 管理
|
||||
-- 3. 避免脚本目录与 Flyway 目录重复维护两套结构脚本
|
||||
Reference in New Issue
Block a user