Compare commits

...

7 Commits

Author SHA1 Message Date
Gitea Actions Bot 0d77a3a0a8 chore: bump version to 1.0.124 (backend + frontend) 2025-09-14 14:25:37 +00:00
paul 0618b78725 feat(setup/docker): auto-set PUID/PGID from invoking user and chown bind-mount folders; create missing data/events dirs
Mirror to GitHub / mirror (push) Successful in 35s
Test and Lint / backend-test (push) Successful in 1m33s
Test and Lint / frontend-test (push) Successful in 2m12s
Version and Release / version-bump (push) Successful in 1m3s
Version and Release / trigger-drone (push) Successful in 3s
2025-09-14 16:20:08 +02:00
paul 0178e71c67 docs: add PUID/PGID note for Docker bind mounts to avoid permission issues
Mirror to GitHub / mirror (push) Successful in 40s
Test and Lint / backend-test (push) Successful in 1m31s
Test and Lint / frontend-test (push) Successful in 2m16s
2025-09-14 16:10:46 +02:00
Gitea Actions Bot aa9b3a0227 chore: bump version to 1.0.123 (backend + frontend) 2025-09-14 13:53:37 +00:00
paul 410a33fecf feat(docker): add PUID/PGID and user mapping to avoid bind mount permission issues; feat(setup): prompt for admin email interactively; docs: PUID/PGID in .env.example
Mirror to GitHub / mirror (push) Successful in 1m41s
Test and Lint / backend-test (push) Successful in 1m47s
Test and Lint / frontend-test (push) Successful in 2m10s
Version and Release / version-bump (push) Successful in 1m5s
Version and Release / trigger-drone (push) Successful in 3s
2025-09-14 15:46:35 +02:00
Gitea Actions Bot 05ebaaeedb chore: bump version to 1.0.122 (backend + frontend) 2025-09-09 18:54:09 +00:00
paul 84d0f63d36 feat(setup): remove --admin-password; print admin credentials from ADMIN_CREDENTIALS.txt; fix ADMIN_URL to avoid /admin/admin; update native service commands
Mirror to GitHub / mirror (push) Successful in 37s
Test and Lint / backend-test (push) Successful in 1m29s
Test and Lint / frontend-test (push) Successful in 2m10s
Version and Release / version-bump (push) Successful in 58s
Version and Release / trigger-drone (push) Successful in 3s
2025-09-09 20:48:49 +02:00
8 changed files with 93 additions and 25 deletions
+6
View File
@@ -53,6 +53,12 @@ VITE_API_URL=/api
# Timezone
TZ=UTC
# Runtime user mapping for Docker (optional)
# Set these to your host user's UID/GID to avoid permission issues on bind mounts.
# Run `id -u` and `id -g` on host to get values. Defaults to 1001.
PUID=1001
PGID=1001
# Analytics (Optional - Umami)
VITE_UMAMI_URL=
VITE_UMAMI_WEBSITE_ID=
+8
View File
@@ -72,6 +72,14 @@ docker-compose up -d
# Access at http://localhost:3005
```
Note on Docker file permissions (PUID/PGID)
- When using bind mounts (e.g., `./storage`, `./data`, `./logs`, `./events`), ensure the container user can write to these host folders. The backend runs as a nonroot user by default.
- Set `PUID` and `PGID` in your `.env` to match your host users UID/GID (run `id -u` and `id -g` on the host). Compose maps the container user to these values.
- Example in `.env`:
- `PUID=1000`
- `PGID=1000`
- Without this, creating events, uploads, thumbnails, or logs can fail with “Permission denied”.
## 📖 Documentation
- 📘 [**Deployment Guide**](DEPLOYMENT_GUIDE.md) - Detailed installation instructions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "picpeak-backend",
"version": "1.0.121",
"version": "1.0.124",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "picpeak-backend",
"version": "1.0.121",
"version": "1.0.124",
"dependencies": {
"@aws-sdk/client-s3": "^3.850.0",
"@aws-sdk/lib-storage": "^3.850.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "picpeak-backend",
"version": "1.0.121",
"version": "1.0.124",
"description": "Backend for PicPeak event photo sharing platform",
"main": "server.js",
"scripts": {
+6 -1
View File
@@ -29,6 +29,11 @@ services:
- ADMIN_URL=${ADMIN_URL:-http://localhost:3001}
- TZ=${TZ:-UTC}
- STORAGE_PATH=/app/storage
# Optional: run container as matching host user to avoid bind mount permission issues
- PUID=${PUID:-1001}
- PGID=${PGID:-1001}
# Use host-matching user ID/GID so bind-mounted folders are writable
user: "${PUID:-1001}:${PGID:-1001}"
volumes:
- ./events:/app/events
- ./data:/app/data
@@ -122,4 +127,4 @@ volumes:
networks:
picpeak-network:
driver: bridge
driver: bridge
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "picpeak-frontend",
"version": "1.0.121",
"version": "1.0.124",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "picpeak-frontend",
"version": "1.0.121",
"version": "1.0.124",
"dependencies": {
"@tanstack/react-query": "^5.0.0",
"@tiptap/extension-character-count": "^2.26.1",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "picpeak-frontend",
"private": true,
"version": "1.0.121",
"version": "1.0.124",
"type": "module",
"scripts": {
"dev": "vite",
+67 -18
View File
@@ -44,7 +44,6 @@ INSTALL_METHOD="" # docker or native
OS_TYPE=""
OS_VERSION=""
PACKAGE_MANAGER=""
ADMIN_PASSWORD=""
ADMIN_EMAIL="admin@example.com"
DOMAIN_NAME=""
SMTP_HOST=""
@@ -78,6 +77,21 @@ run_as_user() {
fi
}
# Prompt for admin email interactively (unless provided or unattended)
prompt_admin_email() {
if [[ -n "$ADMIN_EMAIL" ]]; then
return
fi
if [[ "$UNATTENDED" == "true" ]]; then
ADMIN_EMAIL="admin@example.com"
return
fi
echo
echo "Please enter the admin email address (used for the initial admin account):"
read -p "Admin email [admin@example.com]: " ADMIN_EMAIL
ADMIN_EMAIL=${ADMIN_EMAIL:-admin@example.com}
}
print_banner() {
echo -e "${PURPLE}"
echo "╔════════════════════════════════════════════════════════════════════════╗"
@@ -338,7 +352,7 @@ setup_docker_installation() {
fi
log_step "Creating application directory at $app_dir"
mkdir -p "$app_dir"/{storage/events/{active,archived},logs,backup,config}
mkdir -p "$app_dir"/{storage/events/{active,archived},logs,backup,config,data,events}
# Clone repository
log_step "Downloading PicPeak..."
@@ -349,11 +363,20 @@ setup_docker_installation() {
git clone "$REPO_URL" "$app_dir"
fi
# Determine host user for container mapping (PUID/PGID)
local host_uid host_gid
if [[ -n "${SUDO_USER:-}" ]]; then
host_uid=$(id -u "$SUDO_USER" 2>/dev/null || echo 1000)
host_gid=$(id -g "$SUDO_USER" 2>/dev/null || echo 1000)
else
host_uid=$(id -u 2>/dev/null || echo 1000)
host_gid=$(id -g 2>/dev/null || echo 1000)
fi
# Generate secrets
local jwt_secret=$(generate_jwt_secret)
local db_password=$(generate_password)
local redis_password=$(generate_password)
[[ -z "$ADMIN_PASSWORD" ]] && ADMIN_PASSWORD=$(generate_password)
# Create .env file
log_step "Creating configuration..."
@@ -368,7 +391,10 @@ JWT_SECRET=$jwt_secret
# Admin
ADMIN_EMAIL=$ADMIN_EMAIL
ADMIN_PASSWORD=$ADMIN_PASSWORD
# Runtime user mapping for Docker bind mounts
PUID=$host_uid
PGID=$host_gid
# Database
DB_HOST=postgres
@@ -395,7 +421,7 @@ SMTP_FROM=${SMTP_USER:-noreply@localhost}
# URLs
FRONTEND_URL=${DOMAIN_NAME:+https://$DOMAIN_NAME}
ADMIN_URL=${DOMAIN_NAME:+https://$DOMAIN_NAME/admin}
ADMIN_URL=${DOMAIN_NAME:+https://$DOMAIN_NAME}
# Features
ENABLE_FILE_WATCHER=true
@@ -403,6 +429,9 @@ ENABLE_EXPIRATION_CHECKER=true
ENABLE_EMAIL_SERVICE=true
DEFAULT_EXPIRY_DAYS=30
EOF
# Ensure bind mounts are writable by mapped user
chown -R "$host_uid":"$host_gid" "$app_dir"/storage "$app_dir"/logs "$app_dir"/backup "$app_dir"/data "$app_dir"/events 2>/dev/null || true
# Create docker-compose.yml if it doesn't exist
if [[ ! -f "$app_dir/docker-compose.yml" ]]; then
@@ -618,7 +647,6 @@ setup_native_installation() {
# Generate secrets
local jwt_secret=$(generate_jwt_secret)
[[ -z "$ADMIN_PASSWORD" ]] && ADMIN_PASSWORD=$(generate_password)
# Create .env file
log_step "Creating configuration..."
@@ -633,7 +661,6 @@ JWT_SECRET=$jwt_secret
# Admin
ADMIN_USERNAME=admin
ADMIN_PASSWORD=$ADMIN_PASSWORD
ADMIN_EMAIL=$ADMIN_EMAIL
# Database (native uses SQLite by default)
@@ -653,7 +680,7 @@ SMTP_FROM=${SMTP_USER:-noreply@localhost}
# URLs
FRONTEND_URL=${DOMAIN_NAME:+https://$DOMAIN_NAME}
ADMIN_URL=${DOMAIN_NAME:+https://$DOMAIN_NAME/admin}
ADMIN_URL=${DOMAIN_NAME:+https://$DOMAIN_NAME}
# Features
ENABLE_FILE_WATCHER=true
@@ -906,8 +933,32 @@ print_success_message() {
echo
echo "🔐 Admin Credentials:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo -e "Email: ${CYAN}$ADMIN_EMAIL${NC}"
echo -e "Password: ${CYAN}$ADMIN_PASSWORD${NC}"
# Read from ADMIN_CREDENTIALS.txt when available
local cred_file email_line pass_line admin_email_val admin_pass_val
if [[ "$INSTALL_METHOD" == "docker" ]]; then
cred_file="$app_dir/data/ADMIN_CREDENTIALS.txt"
else
cred_file="$NATIVE_APP_DIR/app/backend/data/ADMIN_CREDENTIALS.txt"
fi
if [[ -f "$cred_file" ]]; then
email_line=$(grep -m1 '^Email:' "$cred_file" || true)
pass_line=$(grep -m1 '^Password:' "$cred_file" || true)
admin_email_val=${email_line#Email: }
admin_pass_val=${pass_line#Password: }
if [[ -n "$admin_email_val" ]]; then
echo -e "Email: ${CYAN}$admin_email_val${NC}"
else
echo -e "Email: ${CYAN}$ADMIN_EMAIL${NC}"
fi
if [[ -n "$admin_pass_val" ]]; then
echo -e "Password: ${CYAN}$admin_pass_val${NC}"
else
echo -e "Password: ${YELLOW}(see $cred_file)${NC}"
fi
else
echo -e "Email: ${CYAN}$ADMIN_EMAIL${NC}"
echo -e "Password: ${YELLOW}(credentials file not found)${NC}"
fi
echo
echo -e "${YELLOW}⚠️ IMPORTANT: Change the admin password on first login!${NC}"
@@ -931,8 +982,8 @@ print_success_message() {
echo "🔧 Service Commands:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "View logs: sudo journalctl -u picpeak-backend -f"
echo "Stop: sudo systemctl stop picpeak-backend picpeak-workers"
echo "Start: sudo systemctl start picpeak-backend picpeak-workers"
echo "Stop: sudo systemctl stop picpeak-backend"
echo "Start: sudo systemctl start picpeak-backend"
echo "Status: sudo systemctl status picpeak-backend"
fi
@@ -1146,10 +1197,6 @@ parse_arguments() {
ADMIN_EMAIL="$2"
shift 2
;;
--admin-password)
ADMIN_PASSWORD="$2"
shift 2
;;
--smtp-host)
SMTP_HOST="$2"
shift 2
@@ -1207,7 +1254,6 @@ Options:
--unattended Run without prompts
--domain DOMAIN Set domain name for HTTPS
--email EMAIL Admin email address
--admin-password Admin password (auto-generated if not set)
--smtp-host HOST SMTP server hostname
--smtp-port PORT SMTP server port
--smtp-user USER SMTP username
@@ -1230,7 +1276,7 @@ Examples:
# Fully automated Docker setup
sudo $0 --docker --unattended --domain photos.example.com \\
--email admin@example.com --admin-password SecurePass123 \\
--email admin@example.com \\
--smtp-host smtp.gmail.com --smtp-port 587 \\
--smtp-user user@gmail.com --smtp-pass app-password \\
--enable-ssl
@@ -1270,6 +1316,9 @@ main() {
# Check system requirements
check_system_requirements
# Prompt for admin email (design choice: always ask unless provided)
prompt_admin_email
# Configure email (optional)
configure_email