Compare commits

..

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
f950b6f60b Fix empty .txt file uploads by preventing stream consumption
Co-authored-by: danielalves96 <62755605+danielalves96@users.noreply.github.com>
2025-10-21 14:29:00 +00:00
copilot-swe-agent[bot]
c19dc6d95e Initial plan 2025-10-21 14:18:19 +00:00
8 changed files with 33 additions and 54 deletions

View File

@@ -73,9 +73,9 @@ ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV API_BASE_URL=http://127.0.0.1:3333
# Define build arguments for user/group configuration (defaults to standard Linux values)
ARG PALMR_UID=1000
ARG PALMR_GID=1000
# Define build arguments for user/group configuration (defaults to current values)
ARG PALMR_UID=1001
ARG PALMR_GID=1001
# Create application user with configurable UID/GID
RUN addgroup --system --gid ${PALMR_GID} nodejs

View File

@@ -9,13 +9,7 @@ Configure user and group permissions for seamless bind mount compatibility acros
Palmr. supports runtime UID/GID configuration to resolve permission conflicts when using bind mounts. This eliminates the need for manual permission management on your host system.
**✅ Good News**: Palmr uses **UID 1000, GID 1000** by default, which matches the standard Linux convention for the first user. For most systems, you won't need to configure these values.
**⚠️ When to Configure**: Only set PALMR_UID/PALMR_GID if:
- You're using bind mounts AND your host system uses different UID/GID values (e.g., NAS systems)
- You're experiencing permission errors with bind mounts
**Note**: Setting these values triggers ownership updates on startup, which can take 1-2 minutes. If left at defaults, startup is fast (~5 seconds).
**⚠️ Important**: Palmr uses **UID 1000, GID 1000** by default, which matches the standard Linux convention. However, some systems may use different UID/GID values, which can cause permission issues with bind mounts.
## The Permission Problem
@@ -41,19 +35,9 @@ drwxr-xr-x 2 user user 4096 Jan 15 10:00 uploads/
## Quick Fix
### For Most Users: No Configuration Needed
### Option 1: Set Palmr to Use Standard UID/GID (Recommended)
If your host system uses the standard Linux UID:GID of 1000:1000 (which is the case for most desktop Linux systems), you don't need to set PALMR_UID or PALMR_GID at all. Just use the default docker-compose.yaml as-is.
To check if you need configuration:
```bash
id
# If output shows uid=1000 and gid=1000, you don't need to configure anything
```
### Option 1: Set Palmr to Match Your Host UID/GID (For Non-Standard Systems)
If your system uses different values (common on NAS devices), add these environment variables to your `docker-compose.yaml`:
Add these environment variables to your `docker-compose.yaml`:
```yaml
services:
@@ -71,14 +55,14 @@ services:
restart: unless-stopped
```
### Option 2: Change Host Directory Permissions (Alternative)
### Option 2: Change Host Directory Permissions
If you prefer not to set environment variables and your host uses different UID/GID:
If you prefer to keep Palmr's defaults:
```bash
# Create directories with Palmr's default ownership (1000:1000)
# Create directories with correct ownership
mkdir -p uploads temp-uploads
sudo chown -R 1000:1000 uploads temp-uploads
chown -R 1001:1001 uploads temp-uploads
```
## Environment Variables
@@ -87,8 +71,8 @@ Configure permissions using these optional environment variables:
| Variable | Description | Default | Example |
| ----------- | -------------------------------- | ------- | ------- |
| `PALMR_UID` | User ID for container processes | `1000` | `1000` |
| `PALMR_GID` | Group ID for container processes | `1000` | `1000` |
| `PALMR_UID` | User ID for container processes | `1001` | `1000` |
| `PALMR_GID` | Group ID for container processes | `1001` | `1000` |
---
@@ -246,19 +230,17 @@ sudo chown -R $(id -u):$(id -g) uploads temp-uploads
UID/GID configuration is **required** when:
- ✅ Using bind mounts AND your host system uses non-standard UID/GID (not 1000:1000)
- ✅ Encountering "permission denied" errors with bind mounts
- ✅ Deploying on NAS systems (Synology, QNAP, etc.) with non-standard user IDs
- ✅ Running multiple containers that need to share files with specific ownership
- ✅ Using bind mounts (most common case)
- ✅ Encountering "permission denied" errors
- ✅ Deploying on NAS systems (Synology, QNAP, etc.)
- ✅ Host system uses different default UID/GID values
- ✅ Running multiple containers that need to share files
UID/GID configuration is **NOT needed** when:
UID/GID configuration is **optional** when:
- ❌ Using Docker named volumes (Docker manages permissions automatically)
- ❌ Your host system uses the standard UID:GID 1000:1000 (most Linux desktop systems)
- ❌ Not using bind mounts at all
- ❌ No permission errors are occurring
**Performance Note**: Configuring custom UID/GID values triggers a recursive ownership update on container startup, which can take 1-2 minutes depending on data volume. If you use the defaults (1000:1000), startup is much faster (~5 seconds).
- ❌ Using Docker named volumes (Docker manages permissions)
- ❌ Not using bind mounts
- ❌ No permission errors occurring
---

View File

@@ -1,6 +1,6 @@
{
"name": "palmr-docs",
"version": "3.2.5-beta",
"version": "3.2.4-beta",
"description": "Docs for Palmr",
"private": true,
"author": "Daniel Luiz Alves <daniel@kyantech.com.br>",

View File

@@ -1,6 +1,6 @@
{
"name": "palmr-api",
"version": "3.2.5-beta",
"version": "3.2.4-beta",
"description": "API for Palmr",
"private": true,
"author": "Daniel Luiz Alves <daniel@kyantech.com.br>",

View File

@@ -6,12 +6,12 @@ import { FilesystemController } from "./controller";
export async function filesystemRoutes(app: FastifyInstance) {
const filesystemController = new FilesystemController();
app.addContentTypeParser("*", async (request: FastifyRequest, payload: any) => {
return payload;
app.addContentTypeParser("*", (request: FastifyRequest, payload: any, done: any) => {
done(null, null);
});
app.addContentTypeParser("application/json", async (request: FastifyRequest, payload: any) => {
return payload;
app.addContentTypeParser("application/json", (request: FastifyRequest, payload: any, done: any) => {
done(null, null);
});
app.put(

View File

@@ -1,6 +1,6 @@
{
"name": "palmr-web",
"version": "3.2.5-beta",
"version": "3.2.4-beta",
"description": "Frontend for Palmr",
"private": true,
"author": "Daniel Luiz Alves <daniel@kyantech.com.br>",

View File

@@ -6,13 +6,10 @@ echo "🌴 Starting Palmr Server..."
TARGET_UID=${PALMR_UID:-1000}
TARGET_GID=${PALMR_GID:-1000}
echo "🔧 Runtime UID/GID: $TARGET_UID:$TARGET_GID"
# Check if we need to update ownership
# Only run chown if explicitly configured via environment variables
# This prevents unnecessary slowdowns on default configurations
if ([ -n "$PALMR_UID" ] || [ -n "$PALMR_GID" ]) && [ "$(id -u)" = "0" ]; then
echo "🔐 Updating file ownership to match runtime configuration..."
if [ -n "$PALMR_UID" ] || [ -n "$PALMR_GID" ]; then
echo "🔧 Runtime UID/GID: $TARGET_UID:$TARGET_GID"
echo "🔐 Updating file ownership..."
chown -R $TARGET_UID:$TARGET_GID /app/palmr-app 2>/dev/null || echo "⚠️ Some ownership changes may have failed"
chown -R $TARGET_UID:$TARGET_GID /home/palmr 2>/dev/null || echo "⚠️ Some home directory ownership changes may have failed"

View File

@@ -1,6 +1,6 @@
{
"name": "palmr-monorepo",
"version": "3.2.5-beta",
"version": "3.2.4-beta",
"description": "Palmr monorepo with Husky configuration",
"private": true,
"packageManager": "pnpm@10.6.0",