From a8edf09bb01fe91edb5f26f86485ab68848103a5 Mon Sep 17 00:00:00 2001 From: Kenny Yang Date: Tue, 20 May 2025 21:01:19 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E8=84=9A=E6=9C=AC=E5=B9=B6=E8=B0=83=E6=95=B4=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将初始化脚本中的目录路径从 `/home/web` 更改为 `/home/app`,并更新相关配置文件的下载路径,以确保与新的目录结构一致。同时,更新了脚本中的下载链接,使其指向正确的仓库分支。 --- main_vps.sh | 11 +++++++++++ vps/init_env.sh | 32 ++++++++++++++++---------------- 2 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 main_vps.sh diff --git a/main_vps.sh b/main_vps.sh new file mode 100644 index 0000000..4a36fe3 --- /dev/null +++ b/main_vps.sh @@ -0,0 +1,11 @@ +# 第1步:下载init_env.sh +cd ~ || exit +wget -O ~/.init_env.sh https://raw.githubusercontent.com/shakenny/containerized-stack/refs/heads/main/vps/init_env.sh +chmod +x ~/.init_env.sh + +# 第2步:执行init_env.sh +~/.init_env.sh + +# 第3步:运行docker-compose,安装必要容器服务 +cd /home/app +docker compose up -d \ No newline at end of file diff --git a/vps/init_env.sh b/vps/init_env.sh index 6ed906f..c2726d3 100644 --- a/vps/init_env.sh +++ b/vps/init_env.sh @@ -9,20 +9,20 @@ curl -L "https://github.com/docker/compose/releases/latest/download/docker-compo chmod +x /usr/local/bin/docker-compose # 创建软件所需的目录结构 -mkdir -p /home/web/html /home/web/certs /home/web/conf.d -mkdir -p /home/web/mysql/conf.d /home/web/mysql/data /home/web/mysql/log -mkdir -p /home/web/redis/conf /home/web/redis/data /home/web/redis/logs -mkdir -p /home/web/postgresql +mkdir -p /home/app/html /home/app/certs /home/app/conf.d +mkdir -p /home/app/mysql/conf.d /home/app/mysql/data /home/app/mysql/log +mkdir -p /home/app/redis/conf /home/app/redis/data /home/app/redis/logs +mkdir -p /home/app/postgresql # 创建默认证书文件 -openssl req -x509 -nodes -newkey rsa:2048 -keyout /home/web/certs/default_server.key -out /home/web/certs/default_server.crt -days 5475 -subj "/C=US/ST=State/L=City/O=Organization/OU=Organizational Unit/CN=Common Name" +openssl req -x509 -nodes -newkey rsa:2048 -keyout /home/app/certs/default_server.key -out /home/app/certs/default_server.crt -days 5475 -subj "/C=US/ST=State/L=City/O=Organization/OU=Organizational Unit/CN=Common Name" # 创建自动续签证书任务 # 切换到一个一致的目录(例如,家目录) cd ~ || exit # 下载并使脚本可执行 -wget -O ~/.auto_cert_renewal.sh https://raw.githubusercontent.com/shakenny/standard-docker/main/auto_cert_renewal.sh +wget -O ~/.auto_cert_renewal.sh https://raw.githubusercontent.com/shakenny/containerized-stack/refs/heads/main/auto_cert_renewal.sh chmod +x ~/.auto_cert_renewal.sh # 设置定时任务字符串 @@ -40,21 +40,21 @@ else fi # 下载配置文件 -wget -O /home/web/nginx.conf https://raw.githubusercontent.com/shakenny/standard-docker/main/nginx.conf -wget -O /home/web/conf.d/default.conf https://raw.githubusercontent.com/shakenny/standard-docker/main/default.conf +wget -O /home/app/nginx.conf https://raw.githubusercontent.com/shakenny/containerized-stack/refs/heads/main/nginx.conf +wget -O /home/app/conf.d/default.conf https://raw.githubusercontent.com/shakenny/containerized-stack/refs/heads/main/default.conf -wget -O /home/web/mysql/conf.d/my.cnf https://raw.githubusercontent.com/shakenny/standard-docker/main/my.cnf -wget -O /home/web/mysql/conf.d/init.sql https://raw.githubusercontent.com/shakenny/standard-docker/main/vps/init.sql +wget -O /home/app/mysql/conf.d/my.cnf https://raw.githubusercontent.com/shakenny/containerized-stack/refs/heads/main/my.cnf +wget -O /home/app/mysql/conf.d/init.sql https://raw.githubusercontent.com/shakenny/containerized-stack/refs/heads/main/vps/init.sql -wget -O /home/web/redis/conf/redis.conf https://raw.githubusercontent.com/redis/redis/7.2/redis.conf +wget -O /home/app/redis/conf/redis.conf https://raw.githubusercontent.com/redis/redis/7.2/redis.conf # 修改Redis配置文件 -sed -i "s/bind 127.0.0.1 -::1/bind 0.0.0.0/g" /home/web/redis/conf/redis.conf -sed -i "s/# requirepass foobared/requirepass \!Ybw324\!/g" /home/web/redis/conf/redis.conf -sed -i "s/appendonly no/appendonly yes/g" /home/web/redis/conf/redis.conf +sed -i "s/bind 127.0.0.1 -::1/bind 0.0.0.0/g" /home/app/redis/conf/redis.conf +sed -i "s/# requirepass foobared/requirepass \!Ybw324\!/g" /home/app/redis/conf/redis.conf +sed -i "s/appendonly no/appendonly yes/g" /home/app/redis/conf/redis.conf # 下载Docker Compose文件和Dockerfile -wget -O /home/web/docker-compose.yml https://raw.githubusercontent.com/shakenny/standard-docker/main/vps/docker-compose.yml -wget -O /home/web/Dockerfile https://raw.githubusercontent.com/shakenny/standard-docker/main/vps/Dockerfile +wget -O /home/app/docker-compose.yml https://raw.githubusercontent.com/shakenny/containerized-stack/refs/heads/main/vps/docker-compose.yml +wget -O /home/app/Dockerfile https://raw.githubusercontent.com/shakenny/containerized-stack/refs/heads/main/vps/Dockerfile echo "Initialization script completed successfully."