Compare commits

..

2 Commits

Author SHA1 Message Date
Gitea Actions Bot 4aa0ff705f chore: bump version to 1.0.114 (backend + frontend) 2025-09-09 15:25:05 +00:00
paul dc482e614a fix(setup/native): Debian 12 compatibility (reliable RAM detection, sudo-less run_as_user, git safe.directory); ensure SQLite data dir; use user for migrate
Mirror to GitHub / mirror (push) Successful in 40s
Test and Lint / backend-test (push) Successful in 1m37s
Test and Lint / frontend-test (push) Successful in 2m8s
Version and Release / version-bump (push) Successful in 57s
Version and Release / trigger-drone (push) Successful in 3s
2025-09-09 17:19:03 +02:00
5 changed files with 45 additions and 16 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "picpeak-backend", "name": "picpeak-backend",
"version": "1.0.113", "version": "1.0.114",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "picpeak-backend", "name": "picpeak-backend",
"version": "1.0.113", "version": "1.0.114",
"dependencies": { "dependencies": {
"@aws-sdk/client-s3": "^3.850.0", "@aws-sdk/client-s3": "^3.850.0",
"@aws-sdk/lib-storage": "^3.850.0", "@aws-sdk/lib-storage": "^3.850.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "picpeak-backend", "name": "picpeak-backend",
"version": "1.0.113", "version": "1.0.114",
"description": "Backend for PicPeak event photo sharing platform", "description": "Backend for PicPeak event photo sharing platform",
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "picpeak-frontend", "name": "picpeak-frontend",
"version": "1.0.113", "version": "1.0.114",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "picpeak-frontend", "name": "picpeak-frontend",
"version": "1.0.113", "version": "1.0.114",
"dependencies": { "dependencies": {
"@tanstack/react-query": "^5.0.0", "@tanstack/react-query": "^5.0.0",
"@tiptap/extension-character-count": "^2.26.1", "@tiptap/extension-character-count": "^2.26.1",
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "picpeak-frontend", "name": "picpeak-frontend",
"private": true, "private": true,
"version": "1.0.113", "version": "1.0.114",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
+39 -10
View File
@@ -61,6 +61,23 @@ UNINSTALL_MODE=false
# Helper Functions # Helper Functions
################################################################################ ################################################################################
# Run a command as the application user, even if sudo is not available
run_as_user() {
local cmd="$*"
if [[ "$(id -u)" -ne 0 ]]; then
# Already non-root; just run
bash -lc "$cmd"
return $?
fi
if command_exists sudo; then
sudo -H -u "$NATIVE_APP_USER" bash -lc "$cmd"
elif command_exists runuser; then
runuser -u "$NATIVE_APP_USER" -- bash -lc "$cmd"
else
su -s /bin/bash - "$NATIVE_APP_USER" -c "$cmd"
fi
}
print_banner() { print_banner() {
echo -e "${PURPLE}" echo -e "${PURPLE}"
echo "╔════════════════════════════════════════════════════════════════════════╗" echo "╔════════════════════════════════════════════════════════════════════════╗"
@@ -110,11 +127,16 @@ generate_jwt_secret() {
} }
get_available_ram_mb() { get_available_ram_mb() {
if command_exists free; then # Prefer /proc/meminfo (always available on Linux), fallback to free(1)
free -m | awk '/^Mem:/{print $2}' if [[ -r /proc/meminfo ]]; then
else awk '/^MemTotal:/ { printf "%d\n", $2/1024 }' /proc/meminfo
echo "0" return
fi fi
if command_exists free; then
free -m | awk '/^Mem:/ {print $2}'
return
fi
echo "0"
} }
get_available_disk_gb() { get_available_disk_gb() {
@@ -552,14 +574,21 @@ setup_native_installation() {
# Create application directory # Create application directory
log_step "Creating application directory..." log_step "Creating application directory..."
mkdir -p "$NATIVE_APP_DIR"/{app,events/{active,archived},logs,config} mkdir -p "$NATIVE_APP_DIR"/{app,events/{active,archived},logs,config}
chown -R $NATIVE_APP_USER:$NATIVE_APP_USER "$NATIVE_APP_DIR"
# Clone repository # Clone repository
log_step "Downloading PicPeak..." log_step "Downloading PicPeak..."
if [[ -d "$NATIVE_APP_DIR/app/.git" ]]; then if [[ -d "$NATIVE_APP_DIR/app/.git" ]]; then
cd "$NATIVE_APP_DIR/app" cd "$NATIVE_APP_DIR/app"
git pull run_as_user "git pull --ff-only" || {
run_as_user "git config --global --add safe.directory $NATIVE_APP_DIR/app"
run_as_user "git pull --ff-only"
}
else else
git clone "$REPO_URL" "$NATIVE_APP_DIR/app" run_as_user "git clone $REPO_URL $NATIVE_APP_DIR/app" || {
run_as_user "git config --global --add safe.directory $NATIVE_APP_DIR/app"
run_as_user "git clone $REPO_URL $NATIVE_APP_DIR/app"
}
fi fi
# Install dependencies # Install dependencies
@@ -629,7 +658,7 @@ EOF
# Run database migrations # Run database migrations
log_step "Initializing database..." log_step "Initializing database..."
cd "$NATIVE_APP_DIR/app/backend" cd "$NATIVE_APP_DIR/app/backend"
sudo -u $NATIVE_APP_USER npm run migrate run_as_user "npm run migrate"
# Create systemd services # Create systemd services
create_systemd_services create_systemd_services
@@ -947,14 +976,14 @@ update_native_installation() {
# Pull latest code # Pull latest code
cd "$NATIVE_APP_DIR/app" cd "$NATIVE_APP_DIR/app"
sudo -u $NATIVE_APP_USER git pull run_as_user "git pull --ff-only" || run_as_user "git pull"
# Update backend dependencies # Update backend dependencies
cd "$NATIVE_APP_DIR/app/backend" cd "$NATIVE_APP_DIR/app/backend"
sudo -u $NATIVE_APP_USER npm install --production run_as_user "npm install --production"
# Run migrations # Run migrations
sudo -u $NATIVE_APP_USER npm run migrate run_as_user "npm run migrate"
# Restart services # Restart services
systemctl start picpeak-backend picpeak-workers systemctl start picpeak-backend picpeak-workers