GTO-Custom-AI commited on
Commit
5b10aa4
·
verified ·
1 Parent(s): 6320563

Upload start.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. start.sh +29 -8
start.sh CHANGED
@@ -1,8 +1,29 @@
1
- #!/bin/sh
2
- echo "Surgical Permission Fix starting..."
3
- # Fix permissions on the persistent volume
4
- chown -R 1000:1000 /data/.n8n
5
- chmod -R 700 /data/.n8n
6
-
7
- echo "Launching n8n..."
8
- exec n8n start
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # ==============================================================================
3
+ # start.sh – Bootstrap script for n8n on Hugging Face Spaces
4
+ #
5
+ # Runs as root (PID 1 is tini), fixes the permission wall, then drops
6
+ # privileges to uid 1000 before executing n8n.
7
+ # ==============================================================================
8
+ set -euo pipefail
9
+
10
+ N8N_DATA="/data/.n8n"
11
+
12
+ echo "▸ [start.sh] Ensuring data directory exists …"
13
+ mkdir -p "${N8N_DATA}"
14
+
15
+ # ---------- Fix the Permission Wall -------------------------------------------
16
+ # HF mounts /data owned by a different uid. n8n refuses to start if config
17
+ # files are readable by group/other (requires 0600 / 0700).
18
+ echo "▸ [start.sh] Fixing ownership → 1000:1000 …"
19
+ chown -R 1000:1000 /data
20
+
21
+ echo "▸ [start.sh] Fixing permissions → dirs 0700, files 0600 …"
22
+ find "${N8N_DATA}" -type d -exec chmod 0700 {} +
23
+ find "${N8N_DATA}" -type f -exec chmod 0600 {} +
24
+
25
+ # ---------- Drop Privileges & Launch ------------------------------------------
26
+ echo "▸ [start.sh] Dropping to user 1000, starting n8n on port ${N8N_PORT:-7860} …"
27
+
28
+ # su-exec replaces the current process (no intermediate shell)
29
+ exec su-exec 1000:1000 n8n start