Use writable home and bump version

This commit is contained in:
Codex
2025-11-12 08:55:00 -06:00
parent 3c0a730ef4
commit 51f57caa72
3 changed files with 9 additions and 11 deletions

View File

@@ -5,7 +5,7 @@
"description": "Next-gen knowledge base that blends docs, whiteboards, and databases for self-hosted teams.", "description": "Next-gen knowledge base that blends docs, whiteboards, and databases for self-hosted teams.",
"website": "https://affine.pro", "website": "https://affine.pro",
"contactEmail": "support@affine.pro", "contactEmail": "support@affine.pro",
"version": "0.1.0", "version": "0.1.1",
"changelog": "Initial Cloudron packaging", "changelog": "Initial Cloudron packaging",
"manifestVersion": 2, "manifestVersion": 2,
"minBoxVersion": "7.0.0", "minBoxVersion": "7.0.0",

View File

@@ -6,8 +6,9 @@ APP_DATA_DIR=${APP_DATA_DIR:-/app/data}
APP_RUNTIME_DIR=${APP_RUNTIME_DIR:-/run/affine} APP_RUNTIME_DIR=${APP_RUNTIME_DIR:-/run/affine}
APP_TMP_DIR=${APP_TMP_DIR:-/tmp/data} APP_TMP_DIR=${APP_TMP_DIR:-/tmp/data}
APP_BUILD_DIR=${APP_BUILD_DIR:-/app/code/affine} APP_BUILD_DIR=${APP_BUILD_DIR:-/app/code/affine}
AFFINE_HOME=/home/cloudron/.affine APP_HOME_DIR=${APP_HOME_DIR:-/app/data/home}
export APP_CODE_DIR APP_DATA_DIR APP_RUNTIME_DIR APP_TMP_DIR APP_BUILD_DIR AFFINE_HOME=${AFFINE_HOME:-$APP_HOME_DIR/.affine}
export APP_CODE_DIR APP_DATA_DIR APP_RUNTIME_DIR APP_TMP_DIR APP_BUILD_DIR APP_HOME_DIR AFFINE_HOME
log() { log() {
printf '[%s] %s\n' "$(date --iso-8601=seconds)" "$*" printf '[%s] %s\n' "$(date --iso-8601=seconds)" "$*"
@@ -23,7 +24,7 @@ require_env() {
prepare_data_dirs() { prepare_data_dirs() {
log "Preparing persistent directories" log "Preparing persistent directories"
mkdir -p "$APP_DATA_DIR/config" "$APP_DATA_DIR/storage" "$APP_DATA_DIR/logs" "$APP_RUNTIME_DIR" "$AFFINE_HOME" mkdir -p "$APP_DATA_DIR/config" "$APP_DATA_DIR/storage" "$APP_DATA_DIR/logs" "$APP_RUNTIME_DIR" "$APP_HOME_DIR" "$AFFINE_HOME"
if [ ! -f "$APP_DATA_DIR/config/config.json" ]; then if [ ! -f "$APP_DATA_DIR/config/config.json" ]; then
log "Seeding default configuration" log "Seeding default configuration"
@@ -42,7 +43,7 @@ prepare_data_dirs() {
ln -sf "$APP_DATA_DIR/config" "$AFFINE_HOME/config" ln -sf "$APP_DATA_DIR/config" "$AFFINE_HOME/config"
ln -sf "$APP_DATA_DIR/storage" "$AFFINE_HOME/storage" ln -sf "$APP_DATA_DIR/storage" "$AFFINE_HOME/storage"
chown -R cloudron:cloudron "$APP_DATA_DIR" "$APP_RUNTIME_DIR" /home/cloudron chown -R cloudron:cloudron "$APP_DATA_DIR" "$APP_RUNTIME_DIR" "$APP_HOME_DIR"
} }
configure_database() { configure_database() {
@@ -140,10 +141,6 @@ PY
fi fi
} }
finalize_permissions() {
chown -R cloudron:cloudron "$APP_DATA_DIR"
}
update_server_config() { update_server_config() {
python3 - <<'PY' python3 - <<'PY'
import json import json
@@ -164,7 +161,7 @@ PY
} }
main() { main() {
export HOME=/home/cloudron export HOME="$APP_HOME_DIR"
prepare_data_dirs prepare_data_dirs
configure_database configure_database
configure_redis configure_redis
@@ -172,7 +169,7 @@ main() {
configure_server_metadata configure_server_metadata
update_server_config update_server_config
configure_auth configure_auth
finalize_permissions chown -R cloudron:cloudron "$APP_DATA_DIR" "$APP_HOME_DIR"
log "Starting supervisor" log "Starting supervisor"
exec /usr/bin/supervisord -c "$APP_CODE_DIR/supervisord.conf" exec /usr/bin/supervisord -c "$APP_CODE_DIR/supervisord.conf"
} }

View File

@@ -22,6 +22,7 @@ autorestart=true
startsecs=5 startsecs=5
priority=20 priority=20
user=cloudron user=cloudron
environment=HOME=/app/data/home
stdout_logfile=/dev/stdout stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile=/dev/stderr