Fix read-only filesystem issues by improving logging config and working directory
This commit is contained in:
18
start.sh
18
start.sh
@ -45,8 +45,11 @@ bridge:
|
|||||||
|
|
||||||
logging:
|
logging:
|
||||||
handlers:
|
handlers:
|
||||||
|
console:
|
||||||
|
format: json
|
||||||
file:
|
file:
|
||||||
filename: /app/data/mautrix-whatsapp.log
|
filename: /app/data/mautrix-whatsapp.log
|
||||||
|
level: info
|
||||||
EOF
|
EOF
|
||||||
cat > "$REGISTRATION_PATH" << 'EOF'
|
cat > "$REGISTRATION_PATH" << 'EOF'
|
||||||
id: whatsapp
|
id: whatsapp
|
||||||
@ -100,6 +103,18 @@ EOF
|
|||||||
echo " 5. Authenticate with WhatsApp using QR code scanning"
|
echo " 5. Authenticate with WhatsApp using QR code scanning"
|
||||||
else
|
else
|
||||||
echo "=> Using existing configuration"
|
echo "=> Using existing configuration"
|
||||||
|
# Fix logging configuration in existing config if needed
|
||||||
|
if [ -f "$CONFIG_PATH" ]; then
|
||||||
|
# Check if config has problematic logging path and fix it
|
||||||
|
if grep -q "filename.*logs/" "$CONFIG_PATH" 2>/dev/null || ! grep -q "/app/data/" "$CONFIG_PATH" 2>/dev/null; then
|
||||||
|
echo "=> Fixing logging configuration in existing config"
|
||||||
|
# Ensure logging goes to the writable /app/data directory
|
||||||
|
yq -i ".logging.handlers.file.filename = \"/app/data/mautrix-whatsapp.log\"" "$CONFIG_PATH" 2>/dev/null || true
|
||||||
|
# Add console logging as well for debugging
|
||||||
|
yq -i ".logging.handlers.console.format = \"json\"" "$CONFIG_PATH" 2>/dev/null || true
|
||||||
|
yq -i ".logging.level = \"info\"" "$CONFIG_PATH" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Final permission fix before starting
|
# Final permission fix before starting
|
||||||
@ -112,6 +127,7 @@ if [ -f "/run/tls/tls.crt" ] && [ -f "/run/tls/tls.key" ]; then
|
|||||||
yq -i ".appservice.tls_key = \"/run/tls/tls.key\"" "$CONFIG_PATH"
|
yq -i ".appservice.tls_key = \"/run/tls/tls.key\"" "$CONFIG_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the bridge
|
# Start the bridge from the data directory to ensure relative paths work
|
||||||
echo "=> Starting mautrix-whatsapp bridge"
|
echo "=> Starting mautrix-whatsapp bridge"
|
||||||
|
cd /app/data
|
||||||
exec gosu cloudron:cloudron /app/pkg/mautrix-whatsapp -c "$CONFIG_PATH"
|
exec gosu cloudron:cloudron /app/pkg/mautrix-whatsapp -c "$CONFIG_PATH"
|
Reference in New Issue
Block a user