From 06cbbecdb68058f5266556069a9112ed04bccaf3 Mon Sep 17 00:00:00 2001 From: Meng Sen Date: Tue, 29 Oct 2024 18:44:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Meng Sen --- .github/renovate.json | 10 ++++- apps/postgresql/16.4-alpine/data.yml | 40 +++++++++++++++++++ .../postgresql/16.4-alpine/docker-compose.yml | 25 ++++++++++++ apps/postgresql/16.4-alpine/scripts/init.sh | 15 +++++++ .../16.4-alpine/scripts/uninstall.sh | 10 +++++ .../postgresql/16.4-alpine/scripts/upgrade.sh | 15 +++++++ apps/postgresql/16.4/data.yml | 40 +++++++++++++++++++ apps/postgresql/16.4/docker-compose.yml | 25 ++++++++++++ apps/postgresql/16.4/scripts/init.sh | 15 +++++++ apps/postgresql/16.4/scripts/uninstall.sh | 10 +++++ apps/postgresql/16.4/scripts/upgrade.sh | 15 +++++++ apps/postgresql/17.0-alpine/data.yml | 40 +++++++++++++++++++ .../postgresql/17.0-alpine/docker-compose.yml | 25 ++++++++++++ apps/postgresql/17.0-alpine/scripts/init.sh | 15 +++++++ .../17.0-alpine/scripts/uninstall.sh | 10 +++++ .../postgresql/17.0-alpine/scripts/upgrade.sh | 15 +++++++ apps/postgresql/17.0/data.yml | 40 +++++++++++++++++++ apps/postgresql/17.0/docker-compose.yml | 25 ++++++++++++ apps/postgresql/17.0/scripts/init.sh | 15 +++++++ apps/postgresql/17.0/scripts/uninstall.sh | 10 +++++ apps/postgresql/17.0/scripts/upgrade.sh | 15 +++++++ 21 files changed, 428 insertions(+), 2 deletions(-) create mode 100644 apps/postgresql/16.4-alpine/data.yml create mode 100644 apps/postgresql/16.4-alpine/docker-compose.yml create mode 100644 apps/postgresql/16.4-alpine/scripts/init.sh create mode 100644 apps/postgresql/16.4-alpine/scripts/uninstall.sh create mode 100644 apps/postgresql/16.4-alpine/scripts/upgrade.sh create mode 100644 apps/postgresql/16.4/data.yml create mode 100644 apps/postgresql/16.4/docker-compose.yml create mode 100644 apps/postgresql/16.4/scripts/init.sh create mode 100644 apps/postgresql/16.4/scripts/uninstall.sh create mode 100644 apps/postgresql/16.4/scripts/upgrade.sh create mode 100644 apps/postgresql/17.0-alpine/data.yml create mode 100644 apps/postgresql/17.0-alpine/docker-compose.yml create mode 100644 apps/postgresql/17.0-alpine/scripts/init.sh create mode 100644 apps/postgresql/17.0-alpine/scripts/uninstall.sh create mode 100644 apps/postgresql/17.0-alpine/scripts/upgrade.sh create mode 100644 apps/postgresql/17.0/data.yml create mode 100644 apps/postgresql/17.0/docker-compose.yml create mode 100644 apps/postgresql/17.0/scripts/init.sh create mode 100644 apps/postgresql/17.0/scripts/uninstall.sh create mode 100644 apps/postgresql/17.0/scripts/upgrade.sh diff --git a/.github/renovate.json b/.github/renovate.json index 7c02bbf2..506ea180 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -47,9 +47,15 @@ }, { "matchFileNames": [ - "apps/postgresql/pg*/*.yml" + "apps/postgresql/16.*/*.yml" ], - "allowedVersions": "/^pg17*/" + "allowedVersions": "/^16.*/" + }, + { + "matchFileNames": [ + "apps/postgresql/17.*/*.yml" + ], + "allowedVersions": "/^17.*/" }, { "matchFileNames": [ diff --git a/apps/postgresql/16.4-alpine/data.yml b/apps/postgresql/16.4-alpine/data.yml new file mode 100644 index 00000000..ac55698b --- /dev/null +++ b/apps/postgresql/16.4-alpine/data.yml @@ -0,0 +1,40 @@ +additionalProperties: + formFields: + - default: "/home/postgres" + edit: true + envKey: POSTGRES_ROOT_PATH + labelZh: 数据持久化路径 + labelEn: Data persistence path + required: true + type: text + - default: "" + edit: false + envKey: POSTGRES_PASSWORD + labelZh: Postgres 密码 (首次生效) + labelEn: Postgres Password (First Time) + required: true + random: true + rule: paramComplexity + type: password + - default: 5432 + edit: true + envKey: PANEL_APP_PORT_HTTP + labelZh: Postgres 端口 + labelEn: Postgres Port + required: true + rule: paramPort + type: number + - default: "postgres" + edit: false + envKey: POSTGRES_USER + labelZh: Postgres 用户(不建议改动) + labelEn: Postgres User + required: false + type: text + - default: "postgres" + edit: false + envKey: POSTGRES_DB + labelZh: Postgres 数据库名称(不建议改动) + labelEn: Postgres Database Name + required: false + type: text diff --git a/apps/postgresql/16.4-alpine/docker-compose.yml b/apps/postgresql/16.4-alpine/docker-compose.yml new file mode 100644 index 00000000..5df3b87f --- /dev/null +++ b/apps/postgresql/16.4-alpine/docker-compose.yml @@ -0,0 +1,25 @@ +networks: + 1panel-network: + external: true + +services: + postgresql: + image: postgres:16.4-alpine + container_name: pg16-alpine-${CONTAINER_NAME} + labels: + createdBy: "Apps" + restart: always + networks: + - 1panel-network + ports: + - ${PANEL_APP_PORT_HTTP}:5432 + env_file: + - /etc/1panel/envs/global.env + - ${ENV_FILE:-/etc/1panel/envs/default.env} + volumes: + - ${POSTGRES_ROOT_PATH}/data:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_USER: ${POSTGRES_USER:-postgres} + POSTGRES_DB: ${POSTGRES_DB:-postgres} + POSTGRES_INITDB_ARGS: "--data-checksums" diff --git a/apps/postgresql/16.4-alpine/scripts/init.sh b/apps/postgresql/16.4-alpine/scripts/init.sh new file mode 100644 index 00000000..77b84912 --- /dev/null +++ b/apps/postgresql/16.4-alpine/scripts/init.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + # setup-1 add default values + CURRENT_DIR=$(pwd) + sed -i '/^ENV_FILE=/d' .env + echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/postgresql/16.4-alpine/scripts/uninstall.sh b/apps/postgresql/16.4-alpine/scripts/uninstall.sh new file mode 100644 index 00000000..c86c4fbc --- /dev/null +++ b/apps/postgresql/16.4-alpine/scripts/uninstall.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/postgresql/16.4-alpine/scripts/upgrade.sh b/apps/postgresql/16.4-alpine/scripts/upgrade.sh new file mode 100644 index 00000000..77b84912 --- /dev/null +++ b/apps/postgresql/16.4-alpine/scripts/upgrade.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + # setup-1 add default values + CURRENT_DIR=$(pwd) + sed -i '/^ENV_FILE=/d' .env + echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/postgresql/16.4/data.yml b/apps/postgresql/16.4/data.yml new file mode 100644 index 00000000..ac55698b --- /dev/null +++ b/apps/postgresql/16.4/data.yml @@ -0,0 +1,40 @@ +additionalProperties: + formFields: + - default: "/home/postgres" + edit: true + envKey: POSTGRES_ROOT_PATH + labelZh: 数据持久化路径 + labelEn: Data persistence path + required: true + type: text + - default: "" + edit: false + envKey: POSTGRES_PASSWORD + labelZh: Postgres 密码 (首次生效) + labelEn: Postgres Password (First Time) + required: true + random: true + rule: paramComplexity + type: password + - default: 5432 + edit: true + envKey: PANEL_APP_PORT_HTTP + labelZh: Postgres 端口 + labelEn: Postgres Port + required: true + rule: paramPort + type: number + - default: "postgres" + edit: false + envKey: POSTGRES_USER + labelZh: Postgres 用户(不建议改动) + labelEn: Postgres User + required: false + type: text + - default: "postgres" + edit: false + envKey: POSTGRES_DB + labelZh: Postgres 数据库名称(不建议改动) + labelEn: Postgres Database Name + required: false + type: text diff --git a/apps/postgresql/16.4/docker-compose.yml b/apps/postgresql/16.4/docker-compose.yml new file mode 100644 index 00000000..f7cee895 --- /dev/null +++ b/apps/postgresql/16.4/docker-compose.yml @@ -0,0 +1,25 @@ +networks: + 1panel-network: + external: true + +services: + postgresql: + image: postgres:16.4 + container_name: pg16-${CONTAINER_NAME} + labels: + createdBy: "Apps" + restart: always + networks: + - 1panel-network + ports: + - ${PANEL_APP_PORT_HTTP}:5432 + env_file: + - /etc/1panel/envs/global.env + - ${ENV_FILE:-/etc/1panel/envs/default.env} + volumes: + - ${POSTGRES_ROOT_PATH}/data:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_USER: ${POSTGRES_USER:-postgres} + POSTGRES_DB: ${POSTGRES_DB:-postgres} + POSTGRES_INITDB_ARGS: "--data-checksums" diff --git a/apps/postgresql/16.4/scripts/init.sh b/apps/postgresql/16.4/scripts/init.sh new file mode 100644 index 00000000..77b84912 --- /dev/null +++ b/apps/postgresql/16.4/scripts/init.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + # setup-1 add default values + CURRENT_DIR=$(pwd) + sed -i '/^ENV_FILE=/d' .env + echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/postgresql/16.4/scripts/uninstall.sh b/apps/postgresql/16.4/scripts/uninstall.sh new file mode 100644 index 00000000..c86c4fbc --- /dev/null +++ b/apps/postgresql/16.4/scripts/uninstall.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/postgresql/16.4/scripts/upgrade.sh b/apps/postgresql/16.4/scripts/upgrade.sh new file mode 100644 index 00000000..77b84912 --- /dev/null +++ b/apps/postgresql/16.4/scripts/upgrade.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + # setup-1 add default values + CURRENT_DIR=$(pwd) + sed -i '/^ENV_FILE=/d' .env + echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/postgresql/17.0-alpine/data.yml b/apps/postgresql/17.0-alpine/data.yml new file mode 100644 index 00000000..ac55698b --- /dev/null +++ b/apps/postgresql/17.0-alpine/data.yml @@ -0,0 +1,40 @@ +additionalProperties: + formFields: + - default: "/home/postgres" + edit: true + envKey: POSTGRES_ROOT_PATH + labelZh: 数据持久化路径 + labelEn: Data persistence path + required: true + type: text + - default: "" + edit: false + envKey: POSTGRES_PASSWORD + labelZh: Postgres 密码 (首次生效) + labelEn: Postgres Password (First Time) + required: true + random: true + rule: paramComplexity + type: password + - default: 5432 + edit: true + envKey: PANEL_APP_PORT_HTTP + labelZh: Postgres 端口 + labelEn: Postgres Port + required: true + rule: paramPort + type: number + - default: "postgres" + edit: false + envKey: POSTGRES_USER + labelZh: Postgres 用户(不建议改动) + labelEn: Postgres User + required: false + type: text + - default: "postgres" + edit: false + envKey: POSTGRES_DB + labelZh: Postgres 数据库名称(不建议改动) + labelEn: Postgres Database Name + required: false + type: text diff --git a/apps/postgresql/17.0-alpine/docker-compose.yml b/apps/postgresql/17.0-alpine/docker-compose.yml new file mode 100644 index 00000000..0b13ccb6 --- /dev/null +++ b/apps/postgresql/17.0-alpine/docker-compose.yml @@ -0,0 +1,25 @@ +networks: + 1panel-network: + external: true + +services: + postgresql: + image: postgres:17.0-alpine + container_name: pg17-alpine-${CONTAINER_NAME} + labels: + createdBy: "Apps" + restart: always + networks: + - 1panel-network + ports: + - ${PANEL_APP_PORT_HTTP}:5432 + env_file: + - /etc/1panel/envs/global.env + - ${ENV_FILE:-/etc/1panel/envs/default.env} + volumes: + - ${POSTGRES_ROOT_PATH}/data:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_USER: ${POSTGRES_USER:-postgres} + POSTGRES_DB: ${POSTGRES_DB:-postgres} + POSTGRES_INITDB_ARGS: "--data-checksums" diff --git a/apps/postgresql/17.0-alpine/scripts/init.sh b/apps/postgresql/17.0-alpine/scripts/init.sh new file mode 100644 index 00000000..77b84912 --- /dev/null +++ b/apps/postgresql/17.0-alpine/scripts/init.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + # setup-1 add default values + CURRENT_DIR=$(pwd) + sed -i '/^ENV_FILE=/d' .env + echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/postgresql/17.0-alpine/scripts/uninstall.sh b/apps/postgresql/17.0-alpine/scripts/uninstall.sh new file mode 100644 index 00000000..c86c4fbc --- /dev/null +++ b/apps/postgresql/17.0-alpine/scripts/uninstall.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/postgresql/17.0-alpine/scripts/upgrade.sh b/apps/postgresql/17.0-alpine/scripts/upgrade.sh new file mode 100644 index 00000000..77b84912 --- /dev/null +++ b/apps/postgresql/17.0-alpine/scripts/upgrade.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + # setup-1 add default values + CURRENT_DIR=$(pwd) + sed -i '/^ENV_FILE=/d' .env + echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/postgresql/17.0/data.yml b/apps/postgresql/17.0/data.yml new file mode 100644 index 00000000..ac55698b --- /dev/null +++ b/apps/postgresql/17.0/data.yml @@ -0,0 +1,40 @@ +additionalProperties: + formFields: + - default: "/home/postgres" + edit: true + envKey: POSTGRES_ROOT_PATH + labelZh: 数据持久化路径 + labelEn: Data persistence path + required: true + type: text + - default: "" + edit: false + envKey: POSTGRES_PASSWORD + labelZh: Postgres 密码 (首次生效) + labelEn: Postgres Password (First Time) + required: true + random: true + rule: paramComplexity + type: password + - default: 5432 + edit: true + envKey: PANEL_APP_PORT_HTTP + labelZh: Postgres 端口 + labelEn: Postgres Port + required: true + rule: paramPort + type: number + - default: "postgres" + edit: false + envKey: POSTGRES_USER + labelZh: Postgres 用户(不建议改动) + labelEn: Postgres User + required: false + type: text + - default: "postgres" + edit: false + envKey: POSTGRES_DB + labelZh: Postgres 数据库名称(不建议改动) + labelEn: Postgres Database Name + required: false + type: text diff --git a/apps/postgresql/17.0/docker-compose.yml b/apps/postgresql/17.0/docker-compose.yml new file mode 100644 index 00000000..ab32343b --- /dev/null +++ b/apps/postgresql/17.0/docker-compose.yml @@ -0,0 +1,25 @@ +networks: + 1panel-network: + external: true + +services: + postgresql: + image: postgres:17.0 + container_name: pg17-${CONTAINER_NAME} + labels: + createdBy: "Apps" + restart: always + networks: + - 1panel-network + ports: + - ${PANEL_APP_PORT_HTTP}:5432 + env_file: + - /etc/1panel/envs/global.env + - ${ENV_FILE:-/etc/1panel/envs/default.env} + volumes: + - ${POSTGRES_ROOT_PATH}/data:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_USER: ${POSTGRES_USER:-postgres} + POSTGRES_DB: ${POSTGRES_DB:-postgres} + POSTGRES_INITDB_ARGS: "--data-checksums" diff --git a/apps/postgresql/17.0/scripts/init.sh b/apps/postgresql/17.0/scripts/init.sh new file mode 100644 index 00000000..77b84912 --- /dev/null +++ b/apps/postgresql/17.0/scripts/init.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + # setup-1 add default values + CURRENT_DIR=$(pwd) + sed -i '/^ENV_FILE=/d' .env + echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/postgresql/17.0/scripts/uninstall.sh b/apps/postgresql/17.0/scripts/uninstall.sh new file mode 100644 index 00000000..c86c4fbc --- /dev/null +++ b/apps/postgresql/17.0/scripts/uninstall.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/postgresql/17.0/scripts/upgrade.sh b/apps/postgresql/17.0/scripts/upgrade.sh new file mode 100644 index 00000000..77b84912 --- /dev/null +++ b/apps/postgresql/17.0/scripts/upgrade.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -f .env ]; then + source .env + + # setup-1 add default values + CURRENT_DIR=$(pwd) + sed -i '/^ENV_FILE=/d' .env + echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi