升级 AFFINE

Signed-off-by: Meng Sen <qyg2297248353@gmail.com>
This commit is contained in:
Meng Sen
2025-08-26 16:22:16 +08:00
parent d263e2b232
commit 0ae3a7894f
7 changed files with 266 additions and 0 deletions

View File

@@ -0,0 +1,183 @@
additionalProperties:
formFields:
- child:
default: ""
envKey: PANEL_POSTGRES_SERVICE
required: true
type: service
default: postgresql
envKey: PANEL_POSTGRES_TYPE
labelZh: Postgres 服务 (前置检查)
labelEn: Postgres Service (Pre-check)
required: true
type: apps
values:
- label: PostgreSQL
value: postgresql
- child:
default: ""
envKey: PANEL_REDIS_SERVICE
required: true
type: service
default: redis
envKey: PANEL_REDIS_TYPE
labelZh: Redis 服务 (前置检查)
labelEn: Redis Service (Pre-check)
required: true
type: apps
values:
- label: Redis
value: redis
- default: "/home/affine"
edit: true
envKey: AFFINE_ROOT_PATH
labelZh: 数据持久化路径
labelEn: Data persistence path
required: true
type: text
- default: 3010
edit: true
envKey: PANEL_APP_PORT_HTTP
labelZh: WebUI 端口
labelEn: WebUI port
required: true
rule: paramPort
type: number
- default: 5555
edit: true
envKey: PANEL_APP_PORT_COMMUNICATION
labelZh: 通讯端口
labelEn: Communication port
required: true
rule: paramPort
type: number
- default: "http://127.0.0.1:3010"
edit: true
envKey: AFFINE_SERVER_EXTERNAL_URL
labelZh: 服务外部地址
labelEn: Service external address
required: true
type: text
- default: "false"
edit: true
envKey: AFFINE_SERVER_HTTPS
labelZh: 是否启用 HTTPS
labelEn: Enable HTTPS
required: true
type: select
values:
- label: 已开启
value: "true"
- label: 未开启
value: "false"
- default: "smtp.163.com"
edit: true
envKey: MAILER_HOST
labelZh: SMTP 服务器地址
labelEn: SMTP server address
required: true
type: text
- default: 465
edit: true
envKey: MAILER_PORT
labelZh: SMTP 服务器端口
labelEn: SMTP server port
required: true
rule: paramPort
type: number
- default: ""
edit: true
envKey: MAILER_SENDER
labelZh: 邮件发送者
labelEn: Email sender
required: true
type: text
- default: ""
edit: true
envKey: MAILER_USER
labelZh: SMTP 用户名
labelEn: SMTP username
required: true
type: text
- default: ""
edit: true
envKey: MAILER_PASSWORD
labelZh: SMTP 密码
labelEn: SMTP password
required: true
type: password
- default: "127.0.0.1"
edit: true
envKey: POSTGRES_HOST
labelZh: 数据库 主机地址
labelEn: Database Host
required: true
type: text
- default: 5432
edit: true
envKey: POSTGRES_PORT
labelZh: 数据库 端口
labelEn: Database Port
required: true
rule: paramPort
type: number
- default: "affine"
edit: true
envKey: POSTGRES_NAME
labelZh: 数据库 名称
labelEn: Database Name
required: true
rule: paramCommon
type: text
- default: "affine"
edit: true
envKey: POSTGRES_USER
labelZh: 数据库 用户名
labelEn: Database Username
required: true
type: text
- default: ""
edit: true
envKey: POSTGRES_PASSWORD
labelZh: 数据库 密码
labelEn: Database Password
random: true
required: true
rule: paramComplexity
type: password
- default: "127.0.0.1"
edit: true
envKey: REDIS_SERVER_HOST
labelZh: Redis 主机
labelEn: Redis Host
required: true
type: text
- default: 6379
edit: true
envKey: REDIS_SERVER_PORT
labelZh: Redis 端口
labelEn: Redis Port
required: true
rule: paramPort
type: number
- default: 0
edit: true
envKey: REDIS_SERVER_DATABASE
labelZh: Redis 索引 (0-20)
labelEn: Redis Index (0-20)
required: true
type: number
- default: ""
edit: true
envKey: REDIS_SERVER_USER
labelZh: Redis 用户
labelEn: Redis User
required: false
type: text
- default: ""
edit: true
envKey: REDIS_SERVER_PASSWORD
labelZh: Redis 密码
labelEn: Redis Password
required: false
type: password

View File

@@ -0,0 +1,35 @@
networks:
1panel-network:
external: true
services:
affine:
image: ghcr.io/toeverything/affine-graphql:stable-1623f5d
container_name: ${CONTAINER_NAME}
labels:
createdBy: "Apps"
restart: always
networks:
- 1panel-network
ports:
- ${PANEL_APP_PORT_HTTP}:3010
- ${PANEL_APP_PORT_COMMUNICATION}:5555
env_file:
- ${GLOBAL_ENV_FILE:-/etc/1panel/envs/global.env}
- ${ENV_FILE:-/etc/1panel/envs/default.env}
volumes:
- ${AFFINE_ROOT_PATH}/config:/root/.affine/config
- ${AFFINE_ROOT_PATH}/storage:/root/.affine/storage
environment:
- NODE_OPTIONS="--import=./scripts/register.js"
- AFFINE_CONFIG_PATH=/root/.affine/config
- REDIS_SERVER_HOST=redis
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_NAME}
- NODE_ENV=production
- TELEMETRY_ENABLE=false
- AFFINE_SERVER_HOST=localhost
- AFFINE_SERVER_PORT=3010
- AFFINE_SERVER_HTTPS=false
- AFFINE_SERVER_EXTERNAL_URL=http://127.0.0.1:3010
command:
[ 'sh', '-c', 'node ./scripts/self-host-predeploy && node ./dist/index.js' ]

View File

@@ -0,0 +1,2 @@
# copyright© 2024 XinJiang Ms Studio
ENV_FILE=.env

View File

@@ -0,0 +1,2 @@
# copyright© 2024 XinJiang Ms Studio
TZ=Asia/Shanghai

View File

@@ -0,0 +1,17 @@
#!/bin/bash
if [ -f .env ]; then
source .env
# setup-1 add default values
CURRENT_DIR=$(pwd)
sed -i '/^ENV_FILE=/d' .env
sed -i '/^GLOBAL_ENV_FILE=/d' .env
echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env
echo "GLOBAL_ENV_FILE=${CURRENT_DIR}/envs/global.env" >> .env
echo "Check Finish."
else
echo "Error: .env file not found."
fi

View File

@@ -0,0 +1,10 @@
#!/bin/bash
if [ -f .env ]; then
source .env
echo "Check Finish."
else
echo "Error: .env file not found."
fi

View File

@@ -0,0 +1,17 @@
#!/bin/bash
if [ -f .env ]; then
source .env
# setup-1 add default values
CURRENT_DIR=$(pwd)
sed -i '/^ENV_FILE=/d' .env
sed -i '/^GLOBAL_ENV_FILE=/d' .env
echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env
echo "GLOBAL_ENV_FILE=${CURRENT_DIR}/envs/global.env" >> .env
echo "Check Finish."
else
echo "Error: .env file not found."
fi